Standardize a fitted modsem_da
model
standardize_model.Rd
standardize_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.
Arguments
- model
A fitted object of class
modsem_da
. Passing any other object triggers an error.- monte.carlo
Logical. If
TRUE
, the function will use Monte Carlo simulation to obtain the standard errors of the standardized estimates. IfFALSE
, the delta method is used. Default isFALSE
.- mc.reps
Number of Monte Carlo replications. Default is 10,000. Ignored if
monte.carlo = FALSE
.- ...
Arguments passed on to other functions
Value
The same object (returned invisibly) with three slots overwritten
$parTable
Parameter table whose columns
est
andstd.error
now hold standardized estimates and their (delta-method) standard errors, as produced bystandardized_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.
See also
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.
Examples
# \dontrun{
# 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
#>
#> modsem (version 1.0.11):
#>
#> Estimator LMS
#> Optimization method EMA-NLMINB
#> Number of observations 2000
#> Number of iterations 46
#> Loglikelihood -14661.61
#> Akaike (AIC) 29385.22
#> Bayesian (BIC) 29558.85
#>
#> Numerical Integration:
#> Points of integration (per dim) 24
#> Dimensions 1
#> Total points of integration 24
#>
#> Fit Measures for Baseline Model (H0):
#> Loglikelihood -17831.87
#> Akaike (AIC) 35723.75
#> Bayesian (BIC) 35891.78
#> Chi-square 17.52
#> Degrees of Freedom (Chi-square) 24
#> P-value (Chi-square) 0.826
#> RMSEA 0.000
#>
#> Comparative Fit to H0 (LRT test):
#> Loglikelihood change 3170.26
#> Difference test (D) 6340.53
#> Degrees of freedom (D) 1
#> P-value (D) 0.000
#>
#> R-Squared Interaction Model (H1):
#> Y 0.599
#> R-Squared Baseline Model (H0):
#> Y 0.395
#> R-Squared Change (H1 - H0):
#> Y 0.204
#>
#> Parameter Estimates:
#> Coefficients unstandardized
#> Information observed
#> Standard errors standard
#>
#> Latent Variables:
#> Estimate Std.Error z.value P(>|z|)
#> X =~
#> x1 1.000
#> x2 0.803 0.013 63.91 0.000
#> x3 0.914 0.013 67.73 0.000
#> Z =~
#> z1 1.000
#> z2 0.810 0.012 65.09 0.000
#> z3 0.881 0.013 67.62 0.000
#> Y =~
#> y1 1.000
#> y2 0.798 0.007 107.55 0.000
#> y3 0.899 0.008 112.58 0.000
#>
#> Regressions:
#> Estimate Std.Error z.value P(>|z|)
#> Y ~
#> X 0.672 0.031 21.66 0.000
#> Z 0.570 0.030 18.75 0.000
#> X:Z 0.718 0.028 25.84 0.000
#>
#> Intercepts:
#> Estimate Std.Error z.value P(>|z|)
#> .x1 1.024 0.024 42.85 0.000
#> .x2 1.217 0.020 60.92 0.000
#> .x3 0.921 0.022 41.45 0.000
#> .z1 1.011 0.024 41.54 0.000
#> .z2 1.205 0.020 59.24 0.000
#> .z3 0.915 0.022 42.03 0.000
#> .y1 1.037 0.033 31.40 0.000
#> .y2 1.220 0.027 45.42 0.000
#> .y3 0.954 0.030 31.80 0.000
#>
#> Covariances:
#> Estimate Std.Error z.value P(>|z|)
#> X ~~
#> Z 0.200 0.024 8.24 0.000
#>
#> Variances:
#> Estimate Std.Error z.value P(>|z|)
#> .x1 0.158 0.009 18.17 0.000
#> .x2 0.162 0.007 23.16 0.000
#> .x3 0.164 0.008 20.76 0.000
#> .z1 0.167 0.009 18.50 0.000
#> .z2 0.160 0.007 22.68 0.000
#> .z3 0.158 0.008 20.78 0.000
#> .y1 0.160 0.009 18.01 0.000
#> .y2 0.154 0.007 22.69 0.000
#> .y3 0.164 0.008 20.68 0.000
#> X 0.981 0.036 27.04 0.000
#> Z 1.018 0.038 26.93 0.000
#> .Y 0.980 0.038 25.94 0.000
#>
summary(sfit) # standardized
#> Warning: NaNs produced
#>
#> modsem (version 1.0.11):
#>
#> Estimator LMS
#> Optimization method EMA-NLMINB
#> Number of observations 2000
#> Number of iterations 46
#> Loglikelihood -14661.61
#> Akaike (AIC) 29363.22
#> Bayesian (BIC) 29475.24
#>
#> Numerical Integration:
#> Points of integration (per dim) 24
#> Dimensions 1
#> Total points of integration 24
#>
#> Fit Measures for Baseline Model (H0):
#> Loglikelihood -17831.87
#> Akaike (AIC) 35723.75
#> Bayesian (BIC) 35891.78
#> Chi-square 17.52
#> Degrees of Freedom (Chi-square) 24
#> P-value (Chi-square) 0.826
#> RMSEA 0.000
#>
#> Comparative Fit to H0 (LRT test):
#> Loglikelihood change 3170.26
#> Difference test (D) 6340.53
#> Degrees of freedom (D) -10
#> P-value (D) NaN
#>
#> R-Squared Interaction Model (H1):
#> Y 0.599
#> R-Squared Baseline Model (H0):
#> Y 0.395
#> R-Squared Change (H1 - H0):
#> Y 0.204
#>
#> Parameter Estimates:
#> Coefficients standardized
#> Information observed
#> Standard errors standard
#>
#> Latent Variables:
#> Estimate Std.Error z.value P(>|z|)
#> X =~
#> x1 0.928 0.005 203.52 0.000
#> x2 0.892 0.006 156.22 0.000
#> x3 0.913 0.005 180.80 0.000
#> Z =~
#> z1 0.927 0.005 200.33 0.000
#> z2 0.898 0.006 162.75 0.000
#> z3 0.913 0.005 183.00 0.000
#> Y =~
#> y1 0.969 0.002 482.31 0.000
#> y2 0.954 0.003 372.99 0.000
#> y3 0.961 0.002 423.03 0.000
#>
#> Regressions:
#> Estimate Std.Error z.value P(>|z|)
#> Y ~
#> X 0.426 0.017 24.48 0.000
#> Z 0.368 0.018 20.51 0.000
#> X:Z 0.459 0.017 27.02 0.000
#>
#> Covariances:
#> Estimate Std.Error z.value P(>|z|)
#> X ~~
#> Z 0.200 0.023 8.88 0.000
#>
#> Variances:
#> Estimate Std.Error z.value P(>|z|)
#> .x1 0.139 0.008 16.40 0.000
#> .x2 0.204 0.010 20.00 0.000
#> .x3 0.167 0.009 18.15 0.000
#> .z1 0.141 0.009 16.42 0.000
#> .z2 0.193 0.010 19.45 0.000
#> .z3 0.167 0.009 18.33 0.000
#> .y1 0.061 0.004 15.76 0.000
#> .y2 0.090 0.005 18.50 0.000
#> .y3 0.076 0.004 17.51 0.000
#> X 1.000
#> Z 1.000
#> .Y 0.401 0.016 24.52 0.000
#>
# }