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) S4 inspect()
method is now a
shortcut for lavInspect()
with default arguments.
lavInspect(lavobject, what = "free", add.labels = TRUE, add.class = TRUE, list.by.group = TRUE, drop.list.single.group = TRUE)
lavTech(lavobject, what = "free", add.labels = FALSE, add.class = FALSE, list.by.group = FALSE, drop.list.single.group = FALSE)
lavaan
.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:
Information about the data (including missing patterns):
Observed sample statistics:
Model features:
Model-implied sample statistics:
Optimizer information:
Gradient, Hessian, observed, expected and first.order information matrices:
Variance covariance matrix of the model parameters:
Miscellaneous:
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