10 Advanced Topics in Multitrait-Multirater Analysis
#### Loading lavaan
# install newest lavaan and blavaan versions from github
# remotes::install_github('yrosseel/lavaan', INSTALL_opts = '--no-multiarch')
# remotes::install_github('ecmerkle/blavaan', INSTALL_opts = '--no-multiarch')
library(lavaan)
Models of Section 10.1.2
Model 1: Graded Response Multilevel CTC(M-1) model for loneliness and extraversion (see Table 10.1)
R Code
model_1 <-'
# loneliness
T_lon =~ 1*Slon03 + 1*Slon05 + 1*Slon07 +
lam2*Flon03A + lam2*Flon05A + lam2*Flon07A+
lam2*Flon03B + lam2*Flon05B + lam2*Flon07B+
lam1*Plon03 + lam1*Plon05 + lam1*Plon07
R_lon =~ 1*Plon03 + 1*Plon05 + 1*Plon07
CR_lon =~ 1*Flon03A + 1*Flon05A + 1*Flon07A+
1*Flon03B + 1*Flon05B + 1*Flon07B
UR_lon1 =~ 1*Flon03A + 1*Flon05A + 1*Flon07A
UR_lon2 =~ 1*Flon03B + 1*Flon05B + 1*Flon07B
# extraversion
T_ext =~ 1*Sext01 + 1*Sext06 +
lam4*Fext01A + lam4*Fext06A +
lam4*Fext01B + lam4*Fext06B +
lam3*Pext01 + lam3*Pext06
R_ext =~ 1*Pext01 + 1*Pext06
CR_ext =~ 1*Fext01A + 1*Fext06A+
1*Fext01B + 1*Fext06B
UR_ext1 =~ 1*Fext01A + 1*Fext06A
UR_ext2 =~ 1*Fext01B + 1*Fext06B
T_ext+ T_lon + CR_lon+ CR_ext + R_lon + R_ext ~~ 0*UR_lon1 + 0*UR_lon2
T_lon+ T_ext + CR_lon+ CR_ext + R_lon + R_ext ~~ 0*UR_ext1 + 0*UR_ext2
T_lon +T_ext~~ 0*CR_ext + 0*CR_lon +0*R_lon + 0*R_ext
UR_lon1 ~~ 0*UR_lon2 +0*UR_ext2
UR_ext1 ~~ 0*UR_ext2 +0*UR_lon2
UR_lon1 ~~ VarR_1*UR_lon1
UR_lon2 ~~ VarR_1*UR_lon2
UR_ext1 ~~ VarR_2*UR_ext1
UR_ext2 ~~ VarR_2*UR_ext2
UR_lon1 ~~ Cov*UR_ext1
UR_lon2 ~~ Cov*UR_ext2
Flon03A | kap1*t1 + kap2*t2
Flon03B | kap1*t1 + kap2*t2
Flon05A | kap3*t1 + kap4*t2
Flon05B | kap3*t1 + kap4*t2
Flon07A | kap5*t1 + kap6*t2
Flon07B | kap5*t1 + kap6*t2
Fext01A | alp1*t1 + alp2*t2 + alp3*t3 + alp4*t4
Fext01B | alp1*t1 + alp2*t2 + alp3*t3 + alp4*t4
Fext06A | alp5*t1 + alp6*t2 + alp7*t3 + alp8*t4
Fext06B | alp5*t1 + alp6*t2 + alp7*t3 + alp8*t4
'
## WLSMV estimation (lavaan uses DWLS Estimation)
fit_model_1 <-sem(model_1, data=chapter_10_wide,
ordered=c('Slon03', 'Slon05', 'Slon07',
'Plon03', 'Plon05', 'Plon07',
'Flon03A','Flon05A','Flon07A',
'Flon03B','Flon05B','Flon07B',
'Sext01', 'Sext06',
'Pext01','Pext06',
'Fext01A','Fext06A',
'Fext01B','Fext06B'),
parameterization='theta',
estimator="wlsmv",
mimic="mplus",
missing="pairwise")
summary(fit_model_1)
lavInspect(fit_model_1, "cov.lv")
CR_lon factor has a negative variance. This indicates that the convergent validity between self-report and common peer rating is extremly high (or perfect) and that the common rater effect is (or close to) zero. Note: missing data was not handled beforehand (e.g. multiple imputation).
MPlus Code
Models of Section 10.2.2
Model 3: Residual approach for explaining the loneliness trait factor
R Code
model_3 <-'
# Loneliness
Trait =~ Slon03 + Slon05+Slon07 +Plon03 + Plon05 + Plon07
Rater =~ Plon03 + Plon05 + Plon07
Trait ~~ 0*Rater
#Explanatory Variable
Ext =~ Pext01 + Pext06
# Residual Approach
Ext ~ Rater
delta =~ 1*Ext
Ext ~~ 0*Ext
delta ~~ 0*Rater
Trait ~ delta
'
## WLSMV estimation (lavaan uses DWLS Estimation)
fit_3 <-sem(model_3, data=chapter_10_wide,
ordered=c('Slon03','Slon05','Slon07',
'Plon03','Plon05','Plon07',
'Pext01','Pext06'),
parameterization='theta',
estimator="wlsmv",
mimic="mplus",
missing ="pairwise")
summary(fit_3, fit.measures=T, standardized=T, rsquare=T)
MPlus Code
Model 4: Residual approach für explaining the loneliness rater factor
R Code
model_4 <-'
# Loneliness
Trait =~ Slon03 + Slon05+Slon07 +Plon03 + Plon05 + Plon07
Rater =~ Plon03 + Plon05 + Plon07
Trait ~~ 0*Rater
#Explanatory Variable
Ext =~ Pext01 + Pext06
# Residual Approach
Ext ~ Trait
delta =~ 1*Ext
Ext ~~ 0*Ext
delta ~~ 0*Trait
Rater ~ delta
'
## WLSMV estimation (lavaan uses DWLS Estimation)
fit_4 <-sem(model_4, data=chapter_10_wide,
ordered=c('Slon03','Slon05','Slon07',
'Plon03','Plon05','Plon07',
'Pext01','Pext06'),
parameterization='theta',
estimator="wlsmv",
mimic="mplus",
missing ="pairwise")
summary(fit_4, fit.measures=T, standardized=T, rsquare=T)
MPlus Code
Model 5: Two construct bifactor approach for loneliness and extraversion serving as the explanatory variable
R Code
model_5 <-'
T_lone =~ 1*Flon03A + 1*Flon05A + 1*Flon07A+
1*Flon03B + 1*Flon05B + 1*Flon07B
T_ext =~ 1*Fext01A + 1*Fext06A +
1*Fext01B + 1*Fext06B
UR_Lone1 =~ 1*Flon03A + l_UR_lon2*Flon05A + l_UR_lon3*Flon07A
UR_Lone2 =~ 1*Flon03B + l_UR_lon2*Flon05B + l_UR_lon3*Flon07B
UR_ext1 =~ 1*Fext01A + l_UR_ext2*Fext06A
UR_ext2 =~ 1*Fext01B + l_UR_ext2*Fext06B
T_lone + T_ext ~~ 0*UR_Lone1 + 0*UR_Lone2 +0*UR_ext1 + 0*UR_ext2
UR_Lone1 ~~ 0*UR_Lone2 + 0*UR_ext2
UR_ext1 ~~ 0*UR_Lone2 + 0*UR_ext2
UR_Lone1 ~~ varUR_Lone*UR_Lone1
UR_Lone2 ~~ varUR_Lone*UR_Lone2
UR_ext1 ~~ varUR_Flou*UR_ext1
UR_ext2 ~~ varUR_Flou*UR_ext2
UR_Lone1 ~ betaS1*UR_ext1
UR_Lone2 ~ betaS1*UR_ext2
T_lone ~ T_ext
Flon03A | kap1*t1 + kap2*t2
Flon03B | kap1*t1 + kap2*t2
Flon05A | kap3*t1 + kap4*t2
Flon05B | kap3*t1 + kap4*t2
Flon07A | kap5*t1 + kap6*t2
Flon07B | kap5*t1 + kap6*t2
Fext01A | alp1*t1 + alp2*t2 + alp3*t3 + alp4*t4
Fext01B | alp1*t1 + alp2*t2 + alp3*t3 + alp4*t4
Fext06A | alp5*t1 + alp6*t2 + alp7*t3 + alp8*t4
Fext06B | alp5*t1 + alp6*t2 + alp7*t3 + alp8*t4
'
fit_5 <-sem(model_5, data=chapter_10_wide,
ordered=c('Flon03A','Flon05A','Flon07A',
'Flon03B','Flon05B','Flon07B',
'Fext01A','Fext06A',
'Fext01B','Fext06B'),
parameterization='theta',
estimator="wlsmv",
mimic="mplus",
missing ="pairwise")
summary(fit_5, fit.measures=T, standardized=T, rsquare=T)
MPlus Code
Models of Section 10.3
Model 7: Model identification in CTC(M-1) or reduced models
R Code
model_7 <-'
# Loneliness
T_lon =~ Slon03 + Slon05+Slon07 +Plon03 + Plon05 + Plon07
R_lon =~ Plon03 + Plon05 + Plon07
! Explanatory Variable
T_ext =~ Sext01 + Sext06 + Pext01 + Pext06
R_ext =~ Pext01 + Pext06
T_lon + T_ext~~ 0*R_lon + 0*R_ext
T_lon ~ T_ext
R_lon ~ R_ext
'
## WLSMV estimation (lavaan uses DWLS Estimation)
fit_7 <-sem(model_7, data=chapter_10_wide,
ordered=c('Slon03','Slon05','Slon07',
'Plon03','Plon05','Plon07',
'Sext01','Sext06',
'Pext01','Pext06'),
parameterization='theta',
estimator="wlsmv",
mimic="mplus",
missing ="pairwise")
summary(fit_7, fit.measures=T, standardized=T, rsquare=T)
MPlus Code
Model 9: ML-CTC(M-1) model identification
R Code
model_9 <-'
T_lon =~ Slon03 + Slon05 + Slon07
T_ext =~ 1*Sext01 + 1*Sext06 +
lamT*Fext01A + lamT*Fext06A+
lamT*Fext01B + lamT*Fext06B
CR_ext =~ 1*Fext01A + 1*Fext06A+
1*Fext01B + 1*Fext06B
UR_ext1 =~ 1*Fext01A + 1*Fext06A
UR_ext2 =~ 1*Fext01B + 1*Fext06B
Fext01A | alp1*t1 + alp2*t2 + alp3*t3 + alp4*t4
Fext01B | alp1*t1 + alp2*t2 + alp3*t3 + alp4*t4
Fext06A | alp5*t1 + alp6*t2 + alp7*t3 + alp8*t4
Fext06B | alp5*t1 + alp6*t2 + alp7*t3 + alp8*t4
UR_ext1 ~~ VarR_2*UR_ext1
UR_ext2 ~~ VarR_2*UR_ext2
T_lon+ T_ext + CR_ext ~~ 0*UR_ext1 + 0*UR_ext2
T_ext ~~ 0*CR_ext
UR_ext1 ~~ 0*UR_ext2
T_lon ~ T_ext+CR_ext
'
## WLSMV estimation (lavaan uses DWLS Estimation)
fit_9 <-sem(model_9, data=chapter_10_wide,
ordered=c('Slon03','Slon05','Slon07',
'Sext01','Sext06',
'Fext01A','Fext06A',
'Fext01B','Fext06B'),
parameterization='theta',
estimator="wlsmv",
mimic="mplus",
missing ="pairwise")
summary(fit_9, fit.measures=T, standardized=T, rsquare=T)
MPlus Code