
Fit Measures for a Latent Variable Model estimated using INLA
Source:R/method-fitmeasures.R
fitmeasures.RdFit Measures for a Latent Variable Model estimated using INLA
Usage
# S4 method for class 'INLAvaan'
fitMeasures(object, fit_measures = "all",
baseline_model = NULL, h1_model = NULL, fm_args,
output = "vector", level = NULL, ...)
# S4 method for class 'INLAvaan'
fitmeasures(object, fit_measures = "all",
baseline_model = NULL, h1_model = NULL, fm_args,
output = "vector", level = NULL, ...)Arguments
- object
An object of class INLAvaan.
- fit_measures
If
"all", all fit measures available will be returned. If only a single or a few fit measures are specified by name, only those are computed and returned. The LOO measures"elpd_loo","se_loo","p_loo"and"looic"(seeloo()), and the WAIC measures"elpd_waic","se_waic","p_waic"and"waic"(seewaic()), are included in"all"only when stored with the fit (testincluding"loo","waic"or"full"ininlavaan(), oradd_loo()); otherwise they are computed on demand when requested by name, and recomputed on every call – store the result withfit <- add_loo(fit)(or callloo()/waic()directly) for repeated access. INLAvaan's stable spellingfit.measuresis also accepted.- baseline_model
The baseline (null) model for the incremental fit indices (BCFI, BTLI, BNFI).
NULL(default) fits the independence model automatically, as lavaan does. Supply an INLAvaan object to use another baseline, orFALSEto skip the incremental indices. INLAvaan's stable spellingbaseline.modelis also accepted; seebfit_indices().- h1_model
Ignored (included for compatibility with the lavaan generic).
- fm_args
Ignored (included for compatibility with the lavaan generic).
- output
Ignored (included for compatibility with the lavaan generic).
- level
Ignored (included for compatibility with the lavaan generic).
- ...
Additional arguments. Currently supports:
rescaleCharacter string controlling how the Bayesian chi-square is computed, following
blavaan::blavFitIndices(). Options are"devM"(default) which uses the deviance rescaled bypDfrom DIC, or"MCMC"which uses the classical chi-square ((N-1) * F_ML) and classical degrees of freedom (p - npar) at each posterior sample.
Examples
# \donttest{
HS.model <- "
visual =~ x1 + x2 + x3
textual =~ x4 + x5 + x6
speed =~ x7 + x8 + x9
"
utils::data("HolzingerSwineford1939", package = "lavaan")
fit <- acfa(HS.model, HolzingerSwineford1939, std.lv = TRUE, nsamp = 100,
verbose = FALSE)
# All available fit measures
fitMeasures(fit)
#> npar margloglik ppp dic p_dic BRMSEA
#> 21 -3838.108 0.000 7551.513 20.173 0.090
#> BGammaHat adjBGammaHat BMc BCFI BTLI BNFI
#> 0.957 0.922 0.904 0.931 0.899 0.907
# Specific measures
fitMeasures(fit, c("npar", "dic", "p_dic", "ppp"))
#> npar ppp dic p_dic
#> 21 0.000 7551.513 20.173
# }