35.3 Vincoli sulle varianze/covarianze
Nel modello M3 consentiamo che anche le varianza e le covarianza differiscano tra gruppi, oltre alle medie.
mg_math_lavaan_fitM3 <- sem(mg_math_lavaan_model,
data = nlsy_math_wide,
meanstructure = TRUE,
estimator = "ML",
missing = "fiml",
group = "lb_wght", # to separate groups
group.equal = c(
"loadings", # for constraints
# "means", commented out so can differ
# "lv.variances",
# "lv.covariances",
"residuals"
)
)
Esaminiamo i risultati.
summary(mg_math_lavaan_fitM3, fit.measures = TRUE)
#> lavaan 0.6.15 ended normally after 57 iterations
#>
#> Estimator ML
#> Optimization method NLMINB
#> Number of model parameters 24
#> Number of equality constraints 13
#>
#> Number of observations per group: Used Total
#> 0 857 858
#> 1 75 75
#> Number of missing patterns per group:
#> 0 60
#> 1 25
#>
#> Model Test User Model:
#>
#> Test statistic 241.182
#> Degrees of freedom 59
#> P-value (Chi-square) 0.000
#> Test statistic for each group:
#> 0 191.157
#> 1 50.024
#>
#> Model Test Baseline Model:
#>
#> Test statistic 887.887
#> Degrees of freedom 42
#> P-value 0.000
#>
#> User Model versus Baseline Model:
#>
#> Comparative Fit Index (CFI) 0.785
#> Tucker-Lewis Index (TLI) 0.847
#>
#> Robust Comparative Fit Index (CFI) 1.000
#> Robust Tucker-Lewis Index (TLI) 0.320
#>
#> Loglikelihood and Information Criteria:
#>
#> Loglikelihood user model (H0) -7964.728
#> Loglikelihood unrestricted model (H1) -7844.138
#>
#> Akaike (AIC) 15951.457
#> Bayesian (BIC) 16004.668
#> Sample-size adjusted Bayesian (SABIC) 15969.732
#>
#> Root Mean Square Error of Approximation:
#>
#> RMSEA 0.081
#> 90 Percent confidence interval - lower 0.071
#> 90 Percent confidence interval - upper 0.092
#> P-value H_0: RMSEA <= 0.050 0.000
#> P-value H_0: RMSEA >= 0.080 0.598
#>
#> Robust RMSEA 0.000
#> 90 Percent confidence interval - lower 0.000
#> 90 Percent confidence interval - upper 0.000
#> P-value H_0: Robust RMSEA <= 0.050 1.000
#> P-value H_0: Robust RMSEA >= 0.080 0.000
#>
#> Standardized Root Mean Square Residual:
#>
#> SRMR 0.124
#>
#> Parameter Estimates:
#>
#> Standard errors Standard
#> Information Observed
#> Observed information based on Hessian
#>
#>
#> Group 1 [0]:
#>
#> Latent Variables:
#> Estimate Std.Err z-value P(>|z|)
#> eta_1 =~
#> math2 1.000
#> math3 1.000
#> math4 1.000
#> math5 1.000
#> math6 1.000
#> math7 1.000
#> math8 1.000
#> eta_2 =~
#> math2 0.000
#> math3 1.000
#> math4 2.000
#> math5 3.000
#> math6 4.000
#> math7 5.000
#> math8 6.000
#>
#> Covariances:
#> Estimate Std.Err z-value P(>|z|)
#> eta_1 ~~
#> eta_2 0.243 1.147 0.212 0.832
#>
#> Intercepts:
#> Estimate Std.Err z-value P(>|z|)
#> eta_1 35.485 0.365 97.271 0.000
#> eta_2 4.293 0.091 47.089 0.000
#> .math2 0.000
#> .math3 0.000
#> .math4 0.000
#> .math5 0.000
#> .math6 0.000
#> .math7 0.000
#> .math8 0.000
#>
#> Variances:
#> Estimate Std.Err z-value P(>|z|)
#> eta_1 61.062 5.692 10.727 0.000
#> eta_2 0.663 0.326 2.033 0.042
#> .math2 (thet) 36.276 1.870 19.402 0.000
#> .math3 (thet) 36.276 1.870 19.402 0.000
#> .math4 (thet) 36.276 1.870 19.402 0.000
#> .math5 (thet) 36.276 1.870 19.402 0.000
#> .math6 (thet) 36.276 1.870 19.402 0.000
#> .math7 (thet) 36.276 1.870 19.402 0.000
#> .math8 (thet) 36.276 1.870 19.402 0.000
#>
#>
#> Group 2 [1]:
#>
#> Latent Variables:
#> Estimate Std.Err z-value P(>|z|)
#> eta_1 =~
#> math2 1.000
#> math3 1.000
#> math4 1.000
#> math5 1.000
#> math6 1.000
#> math7 1.000
#> math8 1.000
#> eta_2 =~
#> math2 0.000
#> math3 1.000
#> math4 2.000
#> math5 3.000
#> math6 4.000
#> math7 5.000
#> math8 6.000
#>
#> Covariances:
#> Estimate Std.Err z-value P(>|z|)
#> eta_1 ~~
#> eta_2 -3.801 4.912 -0.774 0.439
#>
#> Intercepts:
#> Estimate Std.Err z-value P(>|z|)
#> eta_1 32.850 1.413 23.241 0.000
#> eta_2 4.881 0.341 14.332 0.000
#> .math2 0.000
#> .math3 0.000
#> .math4 0.000
#> .math5 0.000
#> .math6 0.000
#> .math7 0.000
#> .math8 0.000
#>
#> Variances:
#> Estimate Std.Err z-value P(>|z|)
#> eta_1 95.283 24.221 3.934 0.000
#> eta_2 1.297 1.315 0.986 0.324
#> .math2 (thet) 36.276 1.870 19.402 0.000
#> .math3 (thet) 36.276 1.870 19.402 0.000
#> .math4 (thet) 36.276 1.870 19.402 0.000
#> .math5 (thet) 36.276 1.870 19.402 0.000
#> .math6 (thet) 36.276 1.870 19.402 0.000
#> .math7 (thet) 36.276 1.870 19.402 0.000
#> .math8 (thet) 36.276 1.870 19.402 0.000
Confrontiamo il modello M2 con il modello M3.
anova(mg_math_lavaan_fitM2, mg_math_lavaan_fitM3)
#>
#> Chi-Squared Difference Test
#>
#> Df AIC BIC Chisq Chisq diff RMSEA Df diff Pr(>Chisq)
#> mg_math_lavaan_fitM3 59 15952 16005 241.18
#> mg_math_lavaan_fitM2 62 15948 15987 243.91 2.7283 0 3 0.4354
Non ci sono evidenze che una differenza nelle varianze e nelle covarianze tra gruppi migliori la bontà dell’adattamento del modello ai dati.