lavInspect()
and lavTech()
functions can be used to
inspect/extract information that is stored inside (or can be computed from) a
fitted lavaan object. Note: the (older) inspect()
function is
now simply a shortcut for lavInspect()
with default arguments.lavInspect(object, what = "free", add.labels = TRUE, add.class = TRUE,
list.by.group = TRUE,
drop.list.single.group = TRUE)lavTech(object, what = "free", add.labels = FALSE, add.class = FALSE,
list.by.group = FALSE,
drop.list.single.group = FALSE)
inspect(object, what = "free", ...)
what
argument is not case-sensitive
(everything is converted to lower case.)TRUE
, variable names are added to the vectors
and/or matrices.TRUE
, vectors are given the `lavaan.vector' class;
matrices are given the `lavaan.matrix' class, and symmetric matrices are
given the `lavaan.matrix.symmetric' class. This only affects the way they
are printed on the screen.TRUE
, the model matrices are nested within groups. If FALSE
,
a flattened list is returned containing all model matrices, with repeated
names for multiple groups.FALSE
, the results are returned as
a list, where each element corresponds to a group (even if there is only
a single group.) If TRUE
, the list will be unlisted if there is
only a single group.lavInspect()
and lavTech()
functions only differ in the way
they return the results. The lavInspect()
function will prettify the
output by default, while the lavTech()
will not attempt to prettify the
output by default. The (older) inspect()
function is a simplified
version of lavInspect()
with only the first two arguments. Below is a list of possible values for the what
argument, organized
in several sections: Model matrices: "free"
:coef()
and vcov()
."partable"
:parTable
."se"
:"std.err"
and "standard.errors"
."start"
:"starting.values"
."est"
:"estimates"
, and "x"
."dx.free"
:"dx.all"
:"ML"
or "GLS"
."std"
:"std.all"
, "standardized"
."std.lv"
:"std.nox"
:"data"
:lavNames(object)
,
while the rows correspond to the output of
lavInspect(object, "case.idx"
."group"
:"ngroups"
:"group.label"
:"cluster"
:"ordered"
:"nobs"
:"norig"
:"ntotal"
:"nobs"
option; if there are multiple groups,
this is the sum of the "nobs"
numbers for each group."case.idx"
:"empty.idx"
:"patterns"
:TRUE
and FALSE
if lavTech()
is used.)
If the data is complete (no missing values), there will be only
a single pattern. In the case of multiple groups: a list of
pattern matrices."coverage"
:"sampstat"
:"samp"
, "sample"
, "samplestatistics"
. In the
presence of missing values, the sample covariance matrix is computed
using use="pairwise"
, while listwise deletion is used for the
means (and thresholds, if any)."sampstat.h1"
:missing = "ml"
(or "fiml"
),
the EM algorithm is used to compute an
estimate of the sample covariance matrix and mean vector under
the unrestricted (H1) model. Aliases: "h1"
, "missing.h1"
."wls.obs"
:"wls.v"
:"gamma"
:"sampstat.nacov"
."meanstructure"
:TRUE
if a meanstructure
was included in the model."categorical"
:TRUE
if categorical endogenous
variables were part of the model."fixed.x"
:TRUE
if the exogenous x-covariates
are treated as fixed."parameterization"
:"delta"
or
"theta"
."cov.lv"
:"veta"
[for V(eta)]."cor.lv"
:"mean.lv"
:"eeta"
[for E(eta)]."cov.ov"
:"sigma"
, "sigma.hat"
."cor.ov"
:"mean.ov"
:"mu"
, "mu.hat"
."cov.all"
:"cor.all"
:"th"
:"thresholds"
."wls.est"
:"vy"
:"rsquare"
:"r-square"
, "r2"
."converged"
:TRUE
if the optimizer has
converged; FALSE
otherwise."iteratons"
:"optim"
:"npar"
:"coef"
:"gradient"
:"hessian"
:"information"
:"information.expected"
:"information.observed"
:"information.first.order"
:"first.order"
."augmented.information"
:"augmented.information.expected"
:"augmented.information.observed"
:"augmented.information.first.order"
:"inverted.information"
:"inverted.information.expected"
:"inverted.information.observed"
:"inverted.information.first.order"
:"vcov"
:"vcov.std.all"
:"vcov.std.lv"
:"vcov.std.nox"
:"UGamma"
:"list"
:parTable()
."fit"
:"fitmeasures"
,
"fit.measures"
, "fit.indices"
. The same output as
given by fitMeasures()
."mi"
:"modindices"
,
"modification.indices"
. The same output as given
by modindices()
."options"
:"call"
:"timing"
:"test"
:"post.check"
:lavInspect(fit, "cov.lv")
or
lavInspect(fit, "theta")
return a non-positive definite matrix."zero.cell.tables"
:lavaan
# fit model
HS.model <- ' visual =~ x1 + x2 + x3
textual =~ x4 + x5 + x6
speed =~ x7 + x8 + x9 '
fit <- cfa(HS.model, data=HolzingerSwineford1939, group = "school")
# extract information
lavInspect(fit, "sampstat")
lavTech(fit, "sampstat")
Run the code above in your browser using DataLab