Learn R Programming

lavaan (version 0.5-21)

lavInspect: Inspect or extract information from a fitted lavaan object

Description

The 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.

Usage

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)

Arguments

lavobject
An object of class lavaan.
what
Character. What needs to be inspected/extracted? See Details for a full list. Note: the what argument is not case-sensitive (everything is converted to lower case.)
add.labels
If TRUE, variable names are added to the vectors and/or matrices.
add.class
If 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.
list.by.group
Logical. Only used when the output are model matrices. If 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.
drop.list.single.group
If 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.

Details

The 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:

See Also

lavaan

Examples

Run this code
# 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