lavInspect: Inspect or extract information from a fitted lavaan object

View source: R/00generic.R

lavInspectR Documentation

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) inspect() function is now simply a shortcut for lavInspect() with default arguments.

Usage

## S3 method for class 'lavaan'
lavInspect(object, what = "free", add_labels = TRUE, add_class = TRUE,
           list_by_group = TRUE,
           drop_list_single_group = TRUE, ...)

## S3 method for class 'lavaan'
lavTech(object, what = "free", add_labels = FALSE, add_class = FALSE,
        list_by_group = FALSE,
        drop_list_single_group = FALSE, ...)

## S3 method for class 'lavaan'
inspect(object, what = "free", ...)

Arguments

object

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), and dots and underscores are interchangeable ("cov_lv" and "cov.lv" are the same keyword).

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.

...

For inspect() additional arguments can be specified, not used by lavaan, but by other packages. For the functions lavInspect() and lavTech() this argument is used to support old names of arguments.

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.

The keywords are case-insensitive, and dots and underscores are interchangeable: "cov_lv", "cov.lv" and "COV_LV" all select the same output. The snake_case spelling is used below; the dotted spelling (used in older versions of lavaan, and in many existing scripts) remains accepted. The component names inside the returned objects (for example res.cov in the "sampstat" output) are not affected.

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 (ignoring any equality constraints). They correspond to 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 share the same standard error. Aliases: "std_err" and "standard_errors".

"se_std":

A list of model matrices. The non-zero numbers represent the standard errors for the (completely) standardized free parameters in the model. Alias: "std_se".

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

"est_unrotated":

A list of model matrices. The values represent the estimated model parameters before rotation was applied. Only relevant if rotation was used (for example in EFA); otherwise this is identical to "est".

"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.)

"mm_lambda":

The estimated factor loading matrix (per group), as extracted from the @GLIST slot. Alias: "lambda".

"mm_delta":

The estimated delta (scaling) matrix (per group), as extracted from the @GLIST slot. Only available for categorical data or when a correlation structure is used. (Note: this is the delta model matrix, not the delta jacobian that is returned by "delta".)

To extract a single model matrix (from the @GLIST slot), use the "mm_*" options (for example "mm_lambda" for the factor loading matrix). For backward compatibility, the (older) bare names are still accepted as aliases.

Information about the data:

"data":

A matrix containing the observed variables that were used to fit the model. The matrix has no row or column names. The columns correspond to the output of lav_object_vnames(object), while the rows correspond to the output of lavInspect(object, "case_idx").

"ordered":

A character vector. The ordered variables.

"nobs":

Numeric vector. The effective number of observations in each group that were used in the analysis. If sampling weights were provided, this is the (per group) sum of the weights, consistent with the value returned by the nobs() method. Use "norig" to obtain the number of rows in the data.

"norig":

Integer vector. The original number of observations (rows in the data) in each group.

"ntotal":

Numeric. The total effective 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. If sampling weights were provided, this is the sum of the weights.

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

"th_idx":

Integer vector. For categorical data, the index of the observed variable that each threshold belongs to. In the case of multiple groups: a list of integer vectors.

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

"patterns_freq":

Integer vector. The number of cases (rows in the data) per missing data pattern, in the same order as the rows of the "patterns" matrix. If the data is complete, a single number (the number of observations). In the case of multiple groups: a list of integer vectors. Alias: "pattern_freq".

"patterns_stats":

The sample statistics per missing data pattern, as used by the full information maximum likelihood (FIML) and two-stage estimation methods. Only available if missing = "ml", "ml.x", "two.stage" or "robust.two.stage". A list with one element per missing data pattern; each element is a list with the following components: cov (the covariance matrix of the observed variables in this pattern, divided by the number of cases), mean (the mean vector of the observed variables in this pattern), freq (the number of cases in this pattern; if sampling weights were used, the sum of the weights), and var_idx (a logical vector indicating which observed variables are observed in this pattern). In the case of multiple groups: a list of such lists. Aliases: "pattern_stats", "missing_stats".

"response_patterns":

The response patterns of the ordered (categorical) variables. A list with the following components: pat (a matrix with one row per observed response pattern, sorted from the most to the least frequent pattern; the columns correspond to the ordered variables), freq (the number of cases per response pattern), npatterns (the number of observed response patterns), total_patterns (the number of possible response patterns), and empty_patterns (the number of possible response patterns that were not observed). Only available if the model contains ordered variables and raw data was used. In the case of multiple groups: a list of such lists. Alias: "resp_patterns".

"coverage":

A symmetric matrix in which each element contains the proportion of jointly observed data points for the corresponding pair of observed variables. In the case of multiple groups: a list of coverage matrices.

"sampling_weights":

Numeric vector. The (normalized) sampling weights that were used in the analysis, one per case (in the order of "case_idx"). Depending on the sampling_weights_normalization option, the weights are rescaled so that they sum to the number of observations within each group ("group", the default), to the total number of observations ("total"), or not at all ("none"). Only available if sampling weights were provided. In the case of multiple groups: a list of numeric vectors. Alias: "weights".

"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 the 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 slot is not present (for example, because the model was fitted with h1 = FALSE), we return the sample statistics from the SampleStats slot. In that case, 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_std":

Standardized observed sample statistics. The covariance matrix is rescaled to a correlation matrix. Aliases: "obs_std", "observed_std", "samp_std", "sample_std", "samplestatistics_std".

"sampstat_h1":

Deprecated. Do not use any longer.

"var":

Numeric vector. The observed variances of the observed variables: the diagonal of the covariance matrix returned by "sampstat" (that is, the h1-based estimates if the h1 slot is available). If conditional_x = TRUE, the variances of the joint (y, x) sample covariance matrix are returned; use "res_var" to obtain the residual variances. In the case of multiple groups (or levels): a list of vectors. Alias: "sampstat_var".

"res_var":

Numeric vector. The residual variances of the (non-exogenous) observed variables, after conditioning on the exogenous covariates: the diagonal of the res.cov matrix returned by "sampstat". Only available if conditional_x = TRUE.

"icov":

The inverse of the observed sample covariance matrix (as returned by "sampstat"). In the case of multiple groups: a list of matrices. Not available for multilevel models. Alias: "sampstat_icov".

"res_icov":

The inverse of the residual sample covariance matrix (the res.cov matrix returned by "sampstat"). Only available if conditional_x = TRUE.

"cov_log_det":

Numeric. The logarithm of the determinant of the observed sample covariance matrix (as returned by "sampstat"). In the case of multiple groups: a numeric vector with one value per group. Not available for multilevel models. Alias: "sampstat_cov_log_det".

"res_cov_log_det":

Numeric. The logarithm of the determinant of the residual sample covariance matrix. Only available if conditional_x = TRUE.

"res_th_nox":

Numeric vector. For categorical data, the sample thresholds of the ordered variables, ignoring the exogenous covariates (that is, the thresholds of the marginal distribution of each ordered variable). If conditional_x = TRUE, these differ from the (residual) thresholds returned by "sampstat"; if no covariates are used, they are identical to the th element of "sampstat". In the case of multiple groups: a list of vectors. Alias: "th_nox".

"wls_obs":

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

"wls_v":

The weight matrix as used in weighted least squares estimation. If the estimator is "DWLS" or "ULS", only the diagonal is used, but a full (diagonal) matrix is returned.

"wls_vd":

Numeric vector. The diagonal of the "wls_v" weight matrix. For the "DWLS" and "ULS" estimators, this vector contains the (only) weights that are used in the estimation. In the case of multiple groups: a list of vectors.

"gamma":

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

"group_w":

Numeric vector. The observed group weights: the logarithm of the (effective) number of observations in each group. This is the same metric as the group.w element of the "implied" and "sampstat" output (which is only shown if group_w_free = TRUE). Alias: "group_weights".

"logl":

Numeric vector. The loglikelihood of the fitted model, per group (NA if the estimator does not provide a loglikelihood). The sum over the groups is the value returned by logLik(). Alias: "loglik".

"h1_logl":

Numeric vector. The loglikelihood of the unrestricted (h1) model, per group. The sum over the groups is the unrestricted.logl fit measure. Only available if the h1 slot is available (h1 = TRUE, the default). Alias: "h1_loglik".

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

"mm_theta":

The (residual) variance-covariance matrix of the observed variables (the theta model matrix). Aliases: "theta", "theta_cov".

"theta_cor":

The (residual) variance-covariance matrix of the observed variables, expressed in correlation metric.

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

"fs_determinacy":

The factor determinacies (based on regression factor scores). They represent the (estimated) correlation between the factor scores and the latent variable scores.

"fs_reliability":

The factor reliabilities (based on regression factor scores). They are the square of the factor determinacies.

"fs_determinacy_Bartlett":

The factor determinacies (based on Bartlett factor scores). They represent the (estimated) correlation between the factor scores and the latent variable scores.

"fs_reliability_bartlett":

The factor reliabilities (based on Bartlett factor scores). They are the square of the factor determinacies.

"icc":

The intraclass correlation coefficients for clustered data with multilevel models. Computed from the model-implied (H1) within-group and between-group covariance matrices. Only available for models with clustered data and multiple levels.

"ranef":

The random effects (empirical Bayes predictions of the cluster-level latent variables). Only available for clustered data (in the long format) with multiple levels.

"sampstat_2l":

The intermediate (sufficient) sample statistics of the two-level data, as used by the multilevel estimation routines. A list with the following components: sigma_w and mu_w (the pooled within-cluster covariance matrix, divided by the number of observations minus the number of clusters, and the within-level means), sigma_b and mu_b (the moment-based between-level covariance matrix and means, as used for starting values), s_b (the between covariance matrix of the cluster means), s (the average cluster size, see "average_cluster_size"), y1y1 (the crossproduct matrix of the level-1 data), y2 (the cluster means, one row per cluster), mean_d and cov_d (the mean vectors and covariance matrices of the cluster means, per cluster size, in the order of "cluster_sizes"; the between-only variables come first), and loglik_x (the loglikelihood contribution of the fixed exogenous covariates). Only available for multilevel models. In the case of multiple groups: a list of such lists. Aliases: "sampstat_twolevel", "sampstat_cluster".

Diagnostics:

"mdist2_fs":

The squared Mahalanobis distances for the (Bartlett) factor scores.

"mdist_fs":

The Mahalanobis distances for the (Bartlett) factor scores.

"mdist2_resid":

The squared Mahalanobis distances for the (Bartlett-based) casewise residuals.

"mdist_resid":

The Mahalanobis distances for the (Bartlett-based) casewise residuals.

If (some of) the data is ordered categorical, the Mahalanobis distances are generalized as in Mansolf and Reise (2017): each distance is replaced by its expected value over the region of the (multivariate normally distributed) latent response vector that is consistent with the observed response pattern, approximated by Monte Carlo integration (set.seed() can be used for reproducibility). Observed continuous variables are conditioned on, and missing values are integrated out. Note that in this case "mdist_fs"/"mdist_resid" return the expected distance E[d] (the person-fit indices d_f^* and d_r^* of Mansolf and Reise), while "mdist2_fs"/"mdist2_resid" return the expected squared distance E[d^2], which is not the square of the former.

Optimizer information:

"converged":

Logical. TRUE if the optimizer has converged; FALSE otherwise.

"iterations":

Integer. The number of iterations used by the optimizer.

"optim":

List. All available information regarding the optimization results.

"rstarts":

List. The results of the random-start runs (only available if the model was fitted with rstarts > 0). One element per run, containing the free parameter vector at the end of that run, with the attributes converged (logical), fx (the value of the discrepancy function at the solution), start (the random starting values that were used) and iterations. A run that failed with an error is an all-NA vector with converged = FALSE and the error message in the error attribute. Among the converged runs, the run with the smallest fx value is the one that provided the final solution (unless the initial run did better). Alias: "random_starts".

"npar":

Integer. Number of free parameters (ignoring constraints).

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.

"gradient_logl":

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

"optim_gradient":

Numeric vector containing the first derivatives of the objective function (as seen by the optimizer) 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 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.

Constraint information (equality/inequality constraints, bounds). All matrices and vectors are reconstructed from the fitted model (the constraint functions are evaluated at the final parameter estimates), and are labeled so that rows correspond to individual constraints and columns to free parameters:

"constraints":

List. All constraint information for the fitted model: $ceq.jac (the Jacobian of the equality constraints, one row per constraint, evaluated at the final estimates), $ceq.rhs (right-hand side constants), $ceq.resid (the values of the equality constraint functions at the solution; all (near) zero), $ceq.rank (the number of linearly independent equality restrictions; this is the number subtracted from the parameter count in the degrees of freedom), $ceq.lambda (Lagrange multipliers, when available), $cin.jac, $cin.rhs, $cin.slack (the slack of each inequality constraint at the solution; (near) zero if the constraint is binding), $cin.active (logical; TRUE for inequality constraints that were binding at the solution), $cin.lambda, $k (see "constraints_nullspace" below), $k0 (offset vector; only non-NULL when the model contains only linear equality constraints, in which case any admissible parameter vector can be written as theta = k0 + K %*% theta.reduced), and $ceq.simple (logical; TRUE when simple equality constraints (a == b) were absorbed into the parameter vector (see the ceq_simple option), so that the free parameter vector already satisfies them and $ceq.jac is empty). The inequality rows appear in this order: finite upper bounds, finite lower bounds, explicit "<"/">" constraints; all are written in slack form (the row value is nonnegative at an admissible point). Alias: "con".

"constraints_jacobian":

Matrix. The Jacobian of all constraints: the equality rows stacked above the inequality rows, evaluated at the final estimates. The attribute "active" is a logical vector flagging, per row, whether the constraint was binding at the solution (equality rows are always active). Alias: "con_jac".

"constraints_nullspace":

Matrix. An orthonormal basis K of the null space of the equality-constraint Jacobian, as used by the standard error and (robust) test statistic machinery: post-multiplying the Jacobian of the model-implied sample statistics ("delta") by K restricts it to the directions that satisfy the (linearized) equality constraints. For example, the information matrix of the constrained model in reduced form is t(K) %*% I %*% K, and its constrained (Moore-Penrose) inverse in the full parameter space is K %*% solve(t(K) %*% I %*% K) %*% t(K). If the model contains no equality constraints, the identity matrix is returned. The row names indicate the parameter space: they correspond to the free parameters, with one row per parameter-table row when simple equality constraints were absorbed (ceq_simple = TRUE). Aliases: "constraints_k", "eq_constraints_k", "con_k".

Miscellaneous:

"coef_boot":

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

"monte_carlo":

Matrix containing the Monte Carlo draws of the model parameters, as used for the Monte Carlo confidence intervals of defined parameters (Preacher & Selig, 2012). Only relevant when these draws were requested. Aliases: "mc", "mc_coef", "coef_mc".

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

"delta":

The delta matrix (per group): the Jacobian of the model-implied summary statistics (the rows: means, (co)variances, thresholds, ...) with respect to the free model parameters (the columns). This is the matrix used in the delta method. (Note: this is the delta Jacobian, not the delta model matrix that is returned by "mm_delta".) In the case of multiple groups: a list of matrices.

"delta_rownames":

The row names of the delta matrix (see "delta"): the labels of the model-implied summary statistics. In the case of multiple groups: a list of character vectors.

"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 lavInspect(fit, "cov_lv"), the psi matrix (as returned by lavInspect(fit, "est"); it also contains the residual (co)variances of the observed endogenous variables), or lavInspect(fit, "theta") is not positive (semi-)definite.

"zero_cell_tables":

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

"iv":

Data.frame. One row per (transformed) equation, with the (model-implied) instrumental variables that were used for each equation. Columns are lhs, rhs, lhs.new, rhs.new, type, and instruments. Only available when estimator = "IV". Aliases: "ivs", "miiv", "miivs", "instr", "instruments". In the case of multiple groups: a list of data.frames.

"eqs":

List. The (internal) list of equations that was used for the (MI)IV-based estimation, including the instruments, the coefficients, and the Sargan test per equation. Only available when estimator = "IV".

"sargan":

Data.frame. The per-equation overidentification tests, for each overidentified equation. Columns are lhs, rhs, df, sargan.stat, sargan.pval, browne.stat, and browne.pval. The sargan.* columns are the classical Sargan test (assumes normality; the p-value is NA for categorical data, where it is not valid); the browne.* columns are a robust residual-based test computed with the distribution-free (ADF) ACOV for continuous data or the polychoric ACOV for categorical data. "hansen" is an alias. Only available when estimator = "IV". In the case of multiple groups: a list of data.frames.

"sam_struc_fit_object":

The (internal) step-2 structural model of a model fitted with sam using a local sam.method ("local", "fsr" or "cfsr"): a lavaan object, fitted to the estimated latent (co)variances (and means) of step 1. fitMeasures(), lavResiduals() and modindices() operate on this object when they are called with the sam object itself. "sam_struc" is an alias.

"version":

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

See Also

lavaan, estimator_iv, estimator_js

Examples

# 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")

lavaan documentation built on Oct. 8, 2026, 5:06 p.m.