Description Usage Arguments Details See Also Examples

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) `inspect()`

function is
now simply a shortcut for `lavInspect()`

with default arguments.

1 2 3 4 5 6 7 8 9 |

`object` |
An object of class |

`what` |
Character. What needs to be inspected/extracted? See Details for a
full list. Note: the |

`add.labels` |
If |

`add.class` |
If |

`list.by.group` |
Logical. Only used when the output are model matrices.
If |

`drop.list.single.group` |
If |

`...` |
Additional arguments. Not used by lavaan, but by other packages. |

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:

`"free"`

:A list of model matrices. The non-zero integers represent the free parameters. The numbers themselves correspond to the position of the free parameter in the parameter vector. This determines the order of the model parameters in the output of for example

`coef()`

and`vcov()`

.`"partable"`

:A list of model matrices. The non-zero integers represent both the fixed parameters (for example, factor loadings fixed at 1.0), and the free parameters if we ignore any equality constraints. They correspond with all entries (fixed or free) in the parameter table. See

`parTable`

.`"se"`

:A list of model matrices. The non-zero numbers represent the standard errors for the free parameters in the model. If two parameters are constrained to be equal, they will have the same standard error for both parameters. Aliases:

`"std.err"`

and`"standard.errors"`

.`"start"`

:A list of model matrices. The values represent the starting values for all model parameters. Alias:

`"starting.values"`

.`"est"`

:A list of model matrices. The values represent the estimated model parameters. Aliases:

`"estimates"`

, and`"x"`

.`"dx.free"`

:A list of model matrices. The values represent the gradient (first derivative) values of the model parameters. If two parameters are constrained to be equal, they will have the same gradient value.

`"dx.all"`

:A list of model matrices. The values represent the first derivative with respect to all possible matrix elements. Currently, this is only available when the estimator is

`"ML"`

or`"GLS"`

.`"std"`

:A list of model matrices. The values represent the (completely) standardized model parameters (the variances of both the observed and the latent variables are set to unity). Aliases:

`"std.all"`

,`"standardized"`

.`"std.lv"`

:A list of model matrices. The values represent the standardized model parameters (only the variances of the latent variables are set to unity.)

`"std.nox"`

:A list of model matrices. The values represent the (completely) standardized model parameters (the variances of both the observed and the latent variables are set to unity; however, the variances of any observed exogenous variables are not set to unity; hence no-x.)

Information about the data:

`"data"`

:A matrix containing the observed variables that have been used to fit the model. No column/row names are provided. Column names correspond to the output of

`lavNames(object)`

, while the rows correspond to the output of`lavInspect(object, "case.idx"`

.`"ordered"`

:A character vector. The ordered variables.

`"nobs"`

:Integer vector. The number of observations in each group that were used in the analysis.

`"norig"`

:Integer vector. The original number of observations in each group.

`"ntotal"`

:Integer. The total number of observations that were used in the analysis. If there is just a single group, this is the same as the

`"nobs"`

option; if there are multiple groups, this is the sum of the`"nobs"`

numbers for each group.`"case.idx"`

:Integer vector. The case/observation numbers that were used in the analysis. In the case of multiple groups: a list of numbers.

`"empty.idx"`

:The case/observation numbers of those cases/observations that contained missing values only (at least for the observed variables that were included in the model). In the case of multiple groups: a list of numbers.

`"patterns"`

:A binary matrix. The rows of the matrix are the missing data patterns where 1 and 0 denote non-missing and missing values for the corresponding observed variables respectively (or

`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"`

:A symmetric matrix where each element contains the proportion of observed datapoints for the corresponding pair of observed variables. In the case of multiple groups: a list of coverage matrices.

`"group"`

:A character string. The group variable in the data.frame (if any).

`"ngroups"`

:Integer. The number of groups.

`"group.label"`

:A character vector. The group labels.

`"level.label"`

:A character vector. The level labels.

`"cluster"`

:A character vector. The cluster variable(s) in the data.frame (if any).

`"nlevels"`

:Integer. The number of levels.

`"nclusters"`

:Integer. The number of clusters that were used in the analysis.

`"ncluster.size"`

:Integer. The number of different cluster sizes.

`"cluster.size"`

:Integer vector. The number of observations within each cluster. For multigroup multilevel models, a list of integer vectors, indicating cluster sizes within each group.

`"cluster.id"`

:Integer vector. The cluster IDs identifying the clusters. For multigroup multilevel models, a list of integer vectors, indicating cluster IDs within each group.

`"cluster.idx"`

:Integer vector. The cluster index for each observation. The cluster index ranges from 1 to the number of clusters. For multigroup multilevel models, a list of integer vectors, indicating cluster indices within each group.

`"cluster.label"`

:Integer vector. The cluster ID for each observation. For multigroup multilevel models, a list of integer vectors, indicating the cluster ID for each observation within each group.

`"cluster.sizes"`

:Integer vector. The different cluster sizes that were used in the analysis. For multigroup multilevel models, a list of integer vectors, indicating the different cluster sizes within each group.

`"average.cluster.size"`

:Integer. The average cluster size (using the formula

`s = (N^2 - sum(cluster.size^2)) / (N*(nclusters - 1L))`

). For multigroup multilevel models, a list containing the average cluster size per group.

Observed sample statistics:

`"sampstat"`

:Observed sample statistics. Aliases:

`"obs"`

,`"observed"`

,`"samp"`

,`"sample"`

,`"samplestatistics"`

. Since 0.6-3, we always check if an h1 slot is available (the estimates for the unrestricted model); if present, we extract the sample statistics from this slot. This implies that if variables are continuous, and`missing = "ml"`

(or`"fiml"`

), we return the covariance matrix (and mean vector) as computed by the EM algorithm under the unrestricted (h1) model. If the h1 is not present (perhaps, because the model was fitted with`h1 = FALSE`

), we return the sample statistics from the SampleStats slot. Here, pairwise deletion is used for the elements of the covariance matrix (or correlation matrix), and listwise deletion for all univariate statistics (means, intercepts and thresholds).`"sampstat.h1"`

:Deprecated. Do not use any longer.

`"wls.obs"`

:The observed sample statistics (covariance elements, intercepts/thresholds, etc.) in a single vector.

`"wls.v"`

:The weight vector as used in weighted least squares estimation.

`"gamma"`

:N times the asymptotic variance matrix of the sample statistics. Alias:

`"sampstat.nacov"`

.

Model features:

`"meanstructure"`

:Logical.

`TRUE`

if a meanstructure was included in the model.`"categorical"`

:Logical.

`TRUE`

if categorical endogenous variables were part of the model.`"fixed.x"`

:Logical.

`TRUE`

if the exogenous x-covariates are treated as fixed.`"parameterization"`

:Character. Either

`"delta"`

or`"theta"`

.

Model-implied sample statistics:

`"implied"`

:The model-implied summary statistics. Alias:

`"fitted"`

,`"expected"`

,`"exp"`

.`"resid"`

:The difference between observed and model-implied summary statistics. Alias:

`"residuals"`

,`"residual"`

,`"res"`

.`"cov.lv"`

:The model-implied variance-covariance matrix of the latent variables. Alias:

`"veta"`

[for V(eta)].`"cor.lv"`

:The model-implied correlation matrix of the latent variables.

`"mean.lv"`

:The model-implied mean vector of the latent variables. Alias:

`"eeta"`

[for E(eta)].`"cov.ov"`

:The model-implied variance-covariance matrix of the observed variables. Aliases:

`"sigma"`

,`"sigma.hat"`

.`"cor.ov"`

:The model-implied correlation matrix of the observed variables.

`"mean.ov"`

:The model-implied mean vector of the observed variables. Aliases:

`"mu"`

,`"mu.hat"`

.`"cov.all"`

:The model-implied variance-covariance matrix of both the observed and latent variables.

`"cor.all"`

:The model-implied correlation matrix of both the observed and latent variables.

`"th"`

:The model-implied thresholds. Alias:

`"thresholds"`

.`"wls.est"`

:The model-implied sample statistics (covariance elements, intercepts/thresholds, etc.) in a single vector.

`"vy"`

:The model-implied unconditional variances of the observed variables.

`"rsquare"`

:The R-square value for all endogenous variables. Aliases:

`"r-square"`

,`"r2"`

.

Optimizer information:

`"converged"`

:Logical.

`TRUE`

if the optimizer has converged;`FALSE`

otherwise.`"iteratons"`

:Integer. The number of iterations used by the optimizer.

`"optim"`

:List. All available information regarding the optimization results.

`"npar"`

:Integer. Number of free parameters (ignoring constraints).

`"coef"`

:Numeric. The estimated parameter vector.

Gradient, Hessian, observed, expected and first.order information matrices:

`"gradient"`

:Numeric vector containing the first derivatives of the discrepancy function with respect to the (free) model parameters.

`"hessian"`

:Matrix containing the second derivatives of the discrepancy function with respect to the (free) model parameters.

`"information"`

:Matrix containing either the observed or the expected information matrix (depending on the information option of the fitted model). This is unit-information, not total-information.

`"information.expected"`

:Matrix containing the expected information matrix for the free model parameters.

`"information.observed"`

:Matrix containing the observed information matrix for the free model parameters.

`"information.first.order"`

:Matrix containing the first.order information matrix for the free model parameters. This is the outer product of the gradient elements (the first derivative of the discrepancy function with respect to the (free) model parameters). Alias:

`"first.order"`

.`"augmented.information"`

:Matrix containing either the observed or the expected augmented (or bordered) information matrix (depending on the information option of the fitted model. Only relevant if constraints have been used in the model.

`"augmented.information.expected"`

:Matrix containing the expected augmented (or bordered) information matrix. Only relevant if constraints have been used in the model.

`"augmented.information.observed"`

:Matrix containing the observed augmented (or bordered) information matrix. Only relevant if constraints have been used in the model.

`"augmented.information.first.order"`

:Matrix containing the first.order augmented (or bordered) information matrix. Only relevant if constraints have been used in the model.

`"inverted.information"`

:Matrix containing either the observed or the expected inverted information matrix (depending on the information option of the fitted model.

`"inverted.information.expected"`

:Matrix containing the inverted expected information matrix for the free model parameters.

`"inverted.information.observed"`

:Matrix containing the inverted observed information matrix for the free model parameters.

`"inverted.information.first.order"`

:Matrix containing the inverted first.order information matrix for the free model parameters.

`"h1.information"`

:Matrix containing either the observed, expected or first.order information matrix (depending on the information option of the fitted model) of the unrestricted h1 model. This is unit-information, not total-information.

`"h1.information.expected"`

:Matrix containing the expected information matrix for the unrestricted h1 model.

`"h1.information.observed"`

:Matrix containing the observed information matrix for the unrestricted h1 model.

`"h1.information.first.order"`

:Matrix containing the first.order information matrix for the the unrestricted h1 model. Alias:

`"h1.first.order"`

.

Variance covariance matrix of the model parameters:

`"vcov"`

:Matrix containing the variance covariance matrix of the estimated model parameters.

`"vcov.std.all"`

:Matrix containing the variance covariance matrix of the standardized estimated model parameters. Standardization is done with respect to both observed and latent variables.

`"vcov.std.lv"`

:Matrix containing the variance covariance matrix of the standardized estimated model parameters. Standardization is done with respect to the latent variables only.

`"vcov.std.nox"`

:Matrix containing the variance covariance matrix of the standardized estimated model parameters. Standardization is done with respect to both observed and latent variables, but ignoring any exogenous observed covariates.

`"vcov.def"`

:Matrix containing the variance covariance matrix of the user-defined (using the := operator) parameters.

`"vcov.def.std.all"`

:Matrix containing the variance covariance matrix of the standardized user-defined parameters. Standardization is done with respect to both observed and latent variables.

`"vcov.def.std.lv"`

:Matrix containing the variance covariance matrix of the standardized user-defined parameters. Standardization is done with respect to the latent variables only.

`"vcov.def.std.nox"`

:Matrix containing the variance covariance matrix of the standardized user-defined parameters. Standardization is done with respect to both observed and latent variables, but ignoring any exogenous observed covariates.

`"vcov.def.joint"`

:Matrix containing the joint variance covariance matrix of both the estimated model parameters and the defined (using the := operator) parameters.

`"vcov.def.joint.std.all"`

:Matrix containing the joint variance covariance matrix of both the standardized model parameters and the user-defined parameters. Standardization is done with respect to both observed and latent variables.

`"vcov.def.joint.std.lv"`

:Matrix containing the joint variance covariance matrix of both the standardized model parameters and the user-defined parameters. Standardization is done with respect to the latent variables only.

`"vcov.def.joint.std.nox"`

:Matrix containing the joint variance covariance matrix of both the standardized model parameters and the user-defined parameters. Standardization is done with respect to both observed and latent variables, but ignoring any exogenous observed covariates.

Miscellaneous:

`"coef.boot"`

:Matrix containing estimated model parameters for for each bootstrap sample. Only relevant when bootstrapping was used.

`"UGamma"`

:Matrix containing the product of 'U' and 'Gamma' matrices as used by the Satorra-Bentler correction. The trace of this matrix, divided by the degrees of freedom, gives the scaling factor.

`"UfromUGamma"`

:Matrix containing the 'U' matrix as used by the Satorra-Bentler correction. Alias:

`"U"`

.`"list"`

:The parameter table. The same output as given by

`parTable()`

.`"fit"`

:The fit measures. Aliases:

`"fitmeasures"`

,`"fit.measures"`

,`"fit.indices"`

. The same output as given by`fitMeasures()`

.`"mi"`

:The modification indices. Alias:

`"modindices"`

,`"modification.indices"`

. The same output as given by`modindices()`

.`"loglik.casewise"`

:Vector containing the casewise loglikelihood contributions. Only available if estimator =

`"ML"`

.`"options"`

:List. The option list.

`"call"`

:List. The call as returned by match.call, coerced to a list.

`"timing"`

:List. The timing (in milliseconds) of various lavaan subprocedures.

`"test"`

:List. All available information regarding the (goodness-of-fit) test statistic(s).

`"baseline.test"`

:List. All available information regarding the (goodness-of-fit) test statistic(s) of the baseline model.

`"baseline.partable"`

:Data.frame. The parameter table of the (internal) baseline model.

`"post.check"`

:Post-fitting check if the solution is admissible. A warning is raised if negative variances are found, or if either

`lavInspect(fit, "cov.lv")`

or`lavInspect(fit, "theta")`

return a non-positive definite matrix.`"zero.cell.tables"`

:List. List of bivariate frequency tables where at least one cell is empty.

`"version"`

:The lavaan version number that was used to construct the fitted lavaan object.

1 2 3 4 5 6 7 8 9 10 11 | ```
# 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")
``` |

```
This is lavaan 0.6-3
lavaan is BETA software! Please report any bugs.
$Pasteur
$Pasteur$cov
x1 x2 x3 x4 x5 x6 x7 x8 x9
x1 1.395
x2 0.402 1.504
x3 0.620 0.477 1.346
x4 0.568 0.089 0.165 1.320
x5 0.472 0.143 0.066 1.080 1.708
x6 0.498 0.194 0.222 0.755 0.934 0.974
x7 0.046 -0.204 -0.025 0.322 0.171 0.219 1.170
x8 0.165 0.039 0.152 0.147 0.152 0.206 0.426 0.952
x9 0.351 0.219 0.332 0.155 0.208 0.186 0.287 0.352 0.978
$Pasteur$mean
x1 x2 x3 x4 x5 x6 x7 x8 x9
4.941 5.984 2.487 2.823 3.995 1.922 4.432 5.563 5.418
$`Grant-White`
$`Grant-White`$cov
x1 x2 x3 x4 x5 x6 x7 x8 x9
x1 1.319
x2 0.414 1.226
x3 0.534 0.478 1.073
x4 0.440 0.283 0.381 1.257
x5 0.411 0.205 0.344 0.933 1.342
x6 0.412 0.244 0.407 0.906 0.898 1.280
x7 0.123 0.076 0.080 0.241 0.303 0.208 1.062
x8 0.370 0.195 0.259 0.122 0.240 0.143 0.633 1.094
x9 0.573 0.281 0.396 0.361 0.422 0.315 0.442 0.567 1.051
$`Grant-White`$mean
x1 x2 x3 x4 x5 x6 x7 x8 x9
4.930 6.200 1.996 3.317 4.712 2.469 3.921 5.488 5.327
$Pasteur
$Pasteur$cov
[,1] [,2] [,3] [,4] [,5] [,6]
[1,] 1.39522952 0.40210319 0.62010670 0.5679263 0.47193972 0.4975629
[2,] 0.40210319 1.50374959 0.47675768 0.0885040 0.14255116 0.1940365
[3,] 0.62010670 0.47675768 1.34578916 0.1646600 0.06644477 0.2221019
[4,] 0.56792635 0.08850400 0.16466004 1.3196864 1.07980974 0.7551208
[5,] 0.47193972 0.14255116 0.06644477 1.0798097 1.70790958 0.9339206
[6,] 0.49756289 0.19403646 0.22210188 0.7551208 0.93392064 0.9744487
[7,] 0.04616439 -0.20384455 -0.02469771 0.3215544 0.17090488 0.2191072
[8,] 0.16519525 0.03851188 0.15161078 0.1469887 0.15150549 0.2056474
[9,] 0.35114303 0.21867810 0.33207834 0.1551634 0.20842750 0.1861841
[,7] [,8] [,9]
[1,] 0.04616439 0.16519525 0.3511430
[2,] -0.20384455 0.03851188 0.2186781
[3,] -0.02469771 0.15161078 0.3320783
[4,] 0.32155439 0.14698868 0.1551634
[5,] 0.17090488 0.15150549 0.2084275
[6,] 0.21910719 0.20564743 0.1861841
[7,] 1.16992003 0.42609205 0.2872255
[8,] 0.42609205 0.95199077 0.3524254
[9,] 0.28722552 0.35242542 0.9775531
$Pasteur$mean
[1] 4.941239 5.983974 2.487179 2.822650 3.995192 1.922161 4.432274 5.563141
[9] 5.417735
$`Grant-White`
$`Grant-White`$cov
[,1] [,2] [,3] [,4] [,5] [,6] [,7]
[1,] 1.3186471 0.41431034 0.53374951 0.4398679 0.4111336 0.4120276 0.12328525
[2,] 0.4143103 1.22637931 0.47844828 0.2831034 0.2045690 0.2438916 0.07572714
[3,] 0.5337495 0.47844828 1.07336504 0.3809651 0.3442331 0.4070707 0.07968128
[4,] 0.4398679 0.28310344 0.38096512 1.2572123 0.9332977 0.9063971 0.24130486
[5,] 0.4111336 0.20456897 0.34423306 0.9332977 1.3416647 0.8980839 0.30299437
[6,] 0.4120276 0.24389163 0.40707066 0.9063971 0.8980839 1.2801417 0.20829506
[7,] 0.1232853 0.07572714 0.07968128 0.2413049 0.3029944 0.2082951 1.06179961
[8,] 0.3695228 0.19458621 0.25857015 0.1217654 0.2397277 0.1433800 0.63283504
[9,] 0.5731334 0.28139847 0.39573507 0.3614595 0.4222771 0.3152449 0.44190187
[,8] [,9]
[1,] 0.3695228 0.5731334
[2,] 0.1945862 0.2813985
[3,] 0.2585702 0.3957351
[4,] 0.1217654 0.3614595
[5,] 0.2397277 0.4222771
[6,] 0.1433800 0.3152449
[7,] 0.6328350 0.4419019
[8,] 1.0943798 0.5666523
[9,] 0.5666523 1.0510480
$`Grant-White`$mean
[1] 4.929885 6.200000 1.995690 3.317241 4.712069 2.468966 3.920840 5.488276
[9] 5.327203
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.