[Stable]
Compare the fit indices of models (see below for model support)

compare_fit(
  ...,
  digits = 3,
  quite = FALSE,
  streamline = FALSE,
  return_result = FALSE
)

Arguments

...

model. If it is a lavaan object, it will try to compute the measurement invariance. Other model types will be passed to performance::compare_performance().

digits

number of digits to round to

quite

suppress printing output

streamline

print streamlined output

return_result

If it is set to TRUE, it will return the the compare fit data frame.

Value

a dataframe with fit indices and change in fit indices

Examples

# lme model

fit1 <- lm_model(
  data = popular,
  response_variable = popular,
  predictor_var = c(sex, extrav)
)
#> Fitting Model with lm:
#>  Formula = popular ~ sex + extrav

fit2 <- lm_model(
  data = popular,
  response_variable = popular,
  predictor_var = c(sex, extrav),
  two_way_interaction_factor = c(sex, extrav)
)
#> Fitting Model with lm:
#>  Formula = popular ~ sex + extrav + sex*extrav

compare_fit(fit1, fit2)
#> Model Summary
#> Model Type = Model Comparison
#> 
#> ────────────────────────────────────────────────────────────────────────────────────────────────
#>   Model       AIC  AIC_wt      AICc  AICc_wt       BIC  BIC_wt     R2  R2_adjusted   RMSE  Sigma
#> ────────────────────────────────────────────────────────────────────────────────────────────────
#>      lm  5977.415   0.727  5977.435    0.728  5999.819   0.978  0.394        0.393  1.076  1.077
#>      lm  5979.369   0.273  5979.399    0.272  6007.374   0.022  0.394        0.393  1.076  1.077
#> ────────────────────────────────────────────────────────────────────────────────────────────────

# see ?measurement_invariance for measurement invariance example