Skip to contents

Print the content of a model_set-class object.

Usage

# S3 method for class 'model_set'
print(
  x,
  bic_digits = 3,
  bpp_digits = 3,
  sort_models = TRUE,
  max_models = 20,
  bpp_target = NULL,
  target_name = "original",
  more_fit_measures = c("cfi", "rmsea"),
  fit_measures_digits = 3,
  short_names = FALSE,
  cumulative_bpp = FALSE,
  ...
)

Arguments

x

A model_set-class object.

bic_digits

The number of decimal places to be displayed for BIC. Default is 3.

bpp_digits

The number of decimal places to be displayed for BIC posterior probability and prior probabilities. Default is 3.

sort_models

Whether the models will be sorted by BIC posterior probability. Default is TRUE.

max_models

The maximum number of models to be printed. Default is 20.

bpp_target

The desired BIC probability. Used to compute and print the minimum prior probability of the target model required to achieve bpp_target. Default is NULL.

target_name

The name of the target model as appeared in the model list. Default is "original". Used if bpp_target is not NULL.

more_fit_measures

Character vector. To be passed to lavaan::fitMeasures(). Default is c("cfi", "rmsea"). Set it to NULL to disable printing additional fit measures.

fit_measures_digits

The number of decimal places to be displayed for additional fit measures, if requested. Default is 3.

short_names

If TRUE, then simple short names will be printed along with full model names. Default is FALSE. Short names can be used when interpreting the graph from model_graph() if short names are used in the graph.

cumulative_bpp

If TRUE and the models are sorted by BPPs, cumulative BPPs will be printed. Default is FALSE.

...

Optional arguments. Ignored.

Value

x is returned invisibly. Called for its side effect.

Details

It is the print method of the output of model_set().

See also

A model_set-class object is generated by model_set().

Examples


library(lavaan)

dat <- dat_path_model

mod <-
"
x3 ~ a*x1 + b*x2
x4 ~ a*x1
ab := a*b
"

fit <- sem(mod, dat_path_model, fixed.x = TRUE)

out <- model_set(fit)
#> 
#> Generate 2 less restrictive model(s):
#> 
  |                                                  | 0 % ~calculating  
  |+++++++++++++++++++++++++                         | 50% ~00s          
  |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=00s  
#> 
#> Generate 2 more restrictive model(s):
#> 
  |                                                  | 0 % ~calculating  
  |+++++++++++++++++++++++++                         | 50% ~00s          
  |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=00s  
#> 
#> Check for duplicated models (5 model[s] to check):
#> 
  |                                                        
  |                                                  |   0%
  |                                                        
  |+++++                                             |  10%
  |                                                        
  |++++++++++                                        |  20%
  |                                                        
  |+++++++++++++++                                   |  30%
  |                                                        
  |++++++++++++++++++++                              |  40%
  |                                                        
  |+++++++++++++++++++++++++                         |  50%
  |                                                        
  |++++++++++++++++++++++++++++++                    |  60%
  |                                                        
  |+++++++++++++++++++++++++++++++++++               |  70%
  |                                                        
  |++++++++++++++++++++++++++++++++++++++++          |  80%
  |                                                        
  |+++++++++++++++++++++++++++++++++++++++++++++     |  90%
  |                                                        
  |++++++++++++++++++++++++++++++++++++++++++++++++++| 100%
#> 
#> Fit the 5 model(s) (duplicated models removed):
out
#> 
#> Call:
#> model_set(sem_out = fit)
#> 
#> Number of model(s) fitted           : 5
#> Number of model(s) converged        : 5
#> Number of model(s) passed post.check: 5
#> 
#> The models (sorted by BPP):
#>                      model_df df_diff Prior     BIC   BPP   cfi rmsea
#> add: x4~x2                  1       1 0.200 400.291 1.000 1.000 0.017
#> original                    2       0 0.200 431.452 0.000 0.736 0.417
#> add: (x3~x1),(x4~x1)        1       1 0.200 435.397 0.000 0.733 0.593
#> drop: x3~~x4                3      -1 0.200 441.229 0.000 0.634 0.401
#> drop: x3~x2                 3      -1 0.200 455.926 0.000 0.522 0.458
#> 
#> Note:
#> - BIC: Bayesian Information Criterion.
#> - BPP: BIC posterior probability.
#> - model_df: Model degrees of freedom.
#> - df_diff: Difference in df compared to the original/target model.
#> - To show cumulative BPPs, call print() with 'cumulative_bpp = TRUE'.
#> - At least one model has fixed.x = TRUE. The models are not checked for
#>   equivalence.
#> - Since Version 0.1.3.5, the default values of exclude_feedback and
#>   exclude_xy_cov changed to TRUE. Set them to FALSE to reproduce
#>   results from previous versions.