10.4 Disgression: Another approach to model group differences
We could also model the group difference by including the group as an exogenous variable in our model. Group is thus treated as a predictor of the mean of the latent factor.
<- 'factor =~ V1+V2+V3+V4
model_effect
factor ~ effect*group
'
We again estimate the model as above.
<- cfa(model_effect, data_frame_cor25, meanstructure=T, effect.coding = T)
fit_model_cor25_effect <- cfa(model_effect, data_frame_cor50, meanstructure=T, effect.coding = T)
fit_model_cor50_effect <- cfa(model_effect, data_frame_cor80, meanstructure=T, effect.coding = T)
fit_model_cor80_effect <- cfa(model_effect, data_frame_cor99, meanstructure=T, effect.coding = T) fit_model_cor99_effect
summary(fit_model_cor25_effect, fit.measures = T, standardized = T)
summary(fit_model_cor50_effect, fit.measures = T, standardized = T)
summary(fit_model_cor80_effect, fit.measures = T, standardized = T)
summary(fit_model_cor99_effect, fit.measures = T, standardized = T)
The parameter estimate of the regression should be (close to) \(\beta = .2\), i.e., going from group 1 to group 2 results in a change of .2
of the latent mean.
#get parameter estimates for the model R1 (correlations .25)
<- parameterestimates(fit_model_cor25_effect)
estimates_regression_25
#give the unstandardized beta, i.e., the effect
$label == 'effect', 'est'] estimates_regression_25[estimates_regression_25
## [1] 0.19
#get parameter estimates for the model R2 (correlations .50)
<- parameterestimates(fit_model_cor50_effect)
estimates_regression_50
#give the unstandardized beta, i.e., the effect
$label == 'effect', 'est'] estimates_regression_50[estimates_regression_50
## [1] 0.19
#get parameter estimates for the model R3 (correlations .80)
<- parameterestimates(fit_model_cor80_effect)
estimates_regression_80
#give the unstandardized beta, i.e., the effect
$label == 'effect', 'est'] estimates_regression_80[estimates_regression_80
## [1] 0.22
#get parameter estimates for the model R4 (correlations .99)
<- parameterestimates(fit_model_cor99_effect)
estimates_regression_99
#give the unstandardized beta, i.e., the effect
$label == 'effect', 'est'] estimates_regression_99[estimates_regression_99
## [1] 0.18
# if you want the value for p, z or the standard error, use the respective column label
# e.g. -> estimates25[estimates25$label == 'effect', 'pvalue']