View source: R/standardize_model.R
standardize_model | R Documentation |
modsem_da
modelstandardize_model()
post-processes the output of
modsem_da()
(or of modsem())
when method = "lms"
/
method = "qml"
), replacing the unstandardized coefficient vector
($coefs
) and its variance–covariance matrix ($vcov
) with fully
standardized counterparts (including the measurement model).The procedure is purely
algebraic— no re-estimation is carried out —and is therefore fast and
deterministic.
standardize_model(model, monte.carlo = FALSE, mc.reps = 10000, ...)
model |
A fitted object of class |
monte.carlo |
Logical. If |
mc.reps |
Number of Monte Carlo replications. Default is 10,000.
Ignored if |
... |
Arguments passed on to other functions |
The same object (returned invisibly) with three slots overwritten
$parTable
Parameter table whose columns est
and std.error
now hold standardized estimates and their (delta-method)
standard errors, as produced by standardized_estimates()
.
$coefs
Named numeric vector of standardized coefficients.
Intercepts (operator ~1
) are removed, because a standardized
variable has mean 0 by definition.
$vcov
Variance–covariance matrix corresponding to the updated coefficient vector. Rows/columns for intercepts are dropped, and the sub-matrix associated with rescaled parameters is adjusted so that its diagonal equals the squared standardized standard errors.
The object keeps its class attributes, allowing seamless use by downstream
S3 methods such as summary()
, coef()
, or vcov()
.
Because the function merely transforms existing estimates, parameter constraints imposed through shared labels remain satisfied.
standardized_estimates()
Obtains the fully standardized parameter table used here.
modsem()
Fit model using LMS or QML approaches.
modsem_da()
Fit model using LMS or QML approaches.
## Not run:
# Latent interaction estimated with LMS and standardized afterwards
syntax <- "
X =~ x1 + x2 + x3
Y =~ y1 + y2 + y3
Z =~ z1 + z2 + z3
Y ~ X + Z + X:Z
"
fit <- modsem_da(syntax, data = oneInt, method = "lms")
sfit <- standardize_model(fit, monte.carlo = TRUE)
# Compare unstandardized vs. standardized summaries
summary(fit) # unstandardized
summary(sfit) # standardized
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.