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,
drop.list.single.group = TRUE)lavTech(lavobject, what = "free", add.labels = FALSE, add.class = 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.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:
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Observed sample statistics and information about the data:
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Model-implied sample statistics and fit information:
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Hessian, observed, expected and first.order information matrices:
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Variance covariance matrix of the model parameters:
[object Object],[object Object],[object Object],[object Object]
Miscellaneous:
[object Object],[object Object],[object Object],[object Object]
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