Inspect model information
modsem_inspect.Rd
function used to inspect fittet object. Similar to lavaan::lavInspect
argument what
decides what to inspect
modsem_inspect.modsem_da
Lets you
pull matrices, optimiser diagnostics, expected moments, or fit
measures from a modsem_da
object.
Usage
modsem_inspect(object, what = NULL, ...)
# S3 method for class 'modsem_da'
modsem_inspect(object, what = NULL, ...)
# S3 method for class 'modsem_pi'
modsem_inspect(object, what = NULL, ...)
Value
A named list with the extracted information. If a single piece of information is returned, it is returned as is; not as a named element in a list.
Details
For modsem_pi
objects, it is just a wrapper for lavaan::lavInspect
.
For modsem_da
objects an internal function is called, which takes different
keywords for the what
argument.
Below is a list of possible values for the what
argument,
organised in several sections. Keywords are case-sensitive.
Presets
"default"
Everything in Sample information, Optimiser diagnostics Parameter tables, Model matrices, and Expected-moment matrices except the raw
data
slot"coef"
Coefficients and variance-covariance matrix of both free and constrained parameters (same as
"coef.all"
)."coef.all"
Coefficients and variance-covariance matrix of both free and constrained parameters (same as
"coef"
)."coef.free"
Coefficients and variance-covariance matrix of the free parameters.
"all"
All items listed below, including
data
."matrices"
The model matrices.
"optim"
Only the items under Optimiser diagnostics
.
"fit"
A list with
fit.h0
,fit.h1
, comparative.fit
Sample information:
"N"
Number of analysed rows (integer).
Parameter estimates and standard errors:
"coefficients.free"
Free parameter values.
"coefficients.all"
Both free and constrained parameter values.
"vcov.free"
Variance–covariance of free coefficients only.
"vcov.all"
Variance–covariance of both free and constrained coefficients.
Optimiser diagnostics:
"coefficients.free"
Free parameter values.
"vcov.free"
Variance–covariance of free coefficients only.
"information"
Fisher information matrix.
"loglik"
Log-likelihood.
"iterations"
Optimiser iteration count.
"convergence"
TRUE
/FALSE
indicating whether the model converged.
Parameter tables:
"partable"
Parameter table with estimated parameters.
"partable.input"
Parsed model syntax.
Model matrices:
"lambda"
\(\Lambda\) – Factor loadings.
"tau"
\(\tau\) – Intercepts for indicators.
"theta"
\(\Theta\) – Residual (Co-)Variances for indicators.
"gamma.xi"
\(\Gamma_{\xi}\) – Structural coefficients between exogenous and endogenous variables.
"gamma.eta"
\(\Gamma_{\eta}\) – Structural coefficients between endogenous variables.
"omega.xi.xi"
\(\Omega_{\xi\xi}\) – Interaction effects between exogenous variables
"omega.eta.xi"
\(\Omega_{\eta\xi}\) – Interaction effects between exogenous and endogenous variables
"phi"
\(\Phi\) – (Co-)Variances among exogenous variables.
"psi"
\(\Psi\) – Residual (co-)variances among engoenous variables.
"alpha"
\(\alpha\) – Intercepts for endogenous variables
"beta0"
\(\beta_0\) – Intercepts for exogenous variables
Model-implied matrices:
"cov.ov"
Model-implied covariance of observed variables.
"cov.lv"
Model-implied covariance of latent variables.
"cov.all"
Joint covariance of observed + latent variables.
"cor.ov"
Correlation counterpart of
"cov.ov"
."cor.lv"
Correlation counterpart of
"cov.lv"
."cor.all"
Correlation counterpart of
"cov.all"
."mean.ov"
Expected means of observed variables.
"mean.lv"
Expected means of latent variables.
"mean.all"
Joint mean vector.
R-squared and standardized residual variances:
"r2.all"
R-squared values for both observed (i.e., indicators) and latent endogenous variables.
"r2.lv"
R-squared values for latent endogenous variables.
"r2.ov"
R-squared values for observed (i.e., indicators) variables.
"res.all"
Standardized residuals (i.e.,
1 - R^2
) for both observed (i.e., indicators) and latent endogenous variables."res.lv"
Standardized residuals (i.e.,
1 - R^2
) for latent endogenous variables."res.ov"
Standardized residuals (i.e.,
1 - R^2
) for observed variables (i.e., indicators).
Interaction-specific caveats:
If the model contains an uncentred latent interaction term it is centred internally before any
cov.*
,cor.*
, ormean.*
matrices are calculated.These matrices should not be used to compute fit-statistics (e.g., chi-square and RMSEA) if there is an interaction term in the model.
Examples
if (FALSE) { # \dontrun{
m1 <- "
# Outer Model
X =~ x1 + x2 + x3
Y =~ y1 + y2 + y3
Z =~ z1 + z2 + z3
# Inner model
Y ~ X + Z + X:Z
"
est <- modsem(m1, oneInt, "lms")
modsem_inspect(est) # everything except "data"
modsem_inspect(est, what = "optim")
modsem_inspect(est, what = "phi")
} # }