Estimate baseline model for modsem models
estimate_h0.RdEstimates a baseline model (H0) from a given model (H1). The baseline model is estimated by removing all interaction terms from the model.
Usage
estimate_h0(object, warn_no_interaction = TRUE, ...)
# S3 method for class 'modsem_da'
estimate_h0(object, warn_no_interaction = TRUE, ...)
# S3 method for class 'modsem_pi'
estimate_h0(object, warn_no_interaction = TRUE, reduced = TRUE, ...)Arguments
- object
- warn_no_interaction
Logical. If `TRUE`, a warning is issued if no interaction terms are found in the model.
- ...
Additional arguments passed to the `modsem_da` function, overriding the arguments in the original model.
- reduced
Should the baseline model be a reduced version of the model? If
TRUE, the latent product term and its (product) indicators are kept in the model, but the interaction coefficients are constrained to zero. IfFALSE, the interaction terms are removed completely from the model. Note that the models will no longer be nested, if the interaction terms are removed from the model completely.
Examples
# \dontrun{
m1 <- "
# Outer Model
X =~ x1 + x2 + x3
Y =~ y1 + y2 + y3
Z =~ z1 + z2 + z3
# Inner model
Y ~ X + Z + X:Z
"
# LMS approach
est_h1 <- modsem(m1, oneInt, "lms")
est_h0 <- estimate_h0(est_h1, calc.se=FALSE) # std.errors are not needed
compare_fit(est_h1 = est_h1, est_h0 = est_h0)
#> $D
#> [1] 676.5438
#>
#> $df
#> [1] 1
#>
#> $p
#> [1] 3.771603e-149
#>
#> $diff.loglik
#> [1] 338.2719
#>
# Double centering approach
est_h1 <- modsem(m1, oneInt, method = "dblcent")
est_h0 <- estimate_h0(est_h1, oneInt)
compare_fit(est_h1 = est_h1, est_h0 = est_h0)
#>
#> Chi-Squared Difference Test
#>
#> Df AIC BIC Chisq Chisq diff RMSEA Df diff Pr(>Chisq)
#> est_h1 111 53735 54071 122.92
#> est_h0 112 54393 54724 783.18 660.26 0.57413 1 < 2.2e-16 ***
#> ---
#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
# Constrained approach
est_h1 <- modsem(m1, oneInt, method = "ca")
est_h0 <- estimate_h0(est_h1, oneInt)
compare_fit(est_h1 = est_h1, est_h0 = est_h0)
#>
#> Chi-Squared Difference Test
#>
#> Df AIC BIC Chisq Chisq diff RMSEA Df diff Pr(>Chisq)
#> est_h1 56 48747 48937 60.401
#> est_h0 57 49404 49589 720.150 659.75 0.57391 1 < 2.2e-16 ***
#> ---
#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
# }