fitmeasures: Fit Measures for a Latent Variable Model estimated using INLA

fitmeasuresR Documentation

Fit Measures for a Latent Variable Model estimated using INLA

Description

Fit Measures for a Latent Variable Model estimated using INLA

Usage

## S4 method for signature 'INLAvaan'
fitMeasures(object, fit_measures = "all",
  baseline_model = NULL, h1_model = NULL, fm_args,
  output = "vector", level = NULL, ...)

## S4 method for signature '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" (see loo()), and the WAIC measures "elpd_waic", "se_waic", "p_waic" and "waic" (see waic()), are included in "all" only when stored with the fit (test including "loo", "waic" or "full" in inlavaan(), or add_loo()); otherwise they are computed on demand when requested by name, and recomputed on every call – store the result with fit <- add_loo(fit) (or call loo()/waic() directly) for repeated access. INLAvaan's stable spelling fit.measures is 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, or FALSE to skip the incremental indices. INLAvaan's stable spelling baseline.model is also accepted; see bfit_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:

rescale

Character string controlling how the Bayesian chi-square is computed, following blavaan::blavFitIndices(). Options are "devM" (default) which uses the deviance rescaled by pD from DIC, or "MCMC" which uses the classical chi-square ((N-1) * F_ML) and classical degrees of freedom (p - npar) at each posterior sample.

Value

A named numeric vector of fit measures.

See Also

bfit_indices(), compare(), diagnostics()

Examples


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)

# Specific measures
fitMeasures(fit, c("npar", "dic", "p_dic", "ppp"))



INLAvaan documentation built on Oct. 2, 2026, 1:07 a.m.