7 Models for a Combination of Structurally Different and Interchangeable Raters

#### Loading of data set

load("chapter_7_2_1.RData")                              
load("chapter_7_2_1_na.RData")
load("chapter_7_3_1.RData")
load("chapter_7_3_2.RData")

MPlus data file (chapter_7_2_1)

MPlus data file (chapter_7_3_1)

MPlus data file (chapter_7_3_2)

R data file (chapter_7_2_1)

R data file (chapter_7_2_1_na)

R data file (chapter_7_3_1)

R data file (chapter_7_3_2)

General Note: Lavaan uses a quasi-Newton method, while Mplus employs the EM algorithm for multilevel CFA/SEM models. In the case of missing data, lavaan can be slower and researchers may experience convergence issues, particularly with complex models, low or close to zero variance at the between level, and missing values. For more information, see https://lavaan.ugent.be/tutorial/multilevel.html.

For the examples in Section 7.2.1, we used missing = "listwise" to speed up estimation time and increase the likelihood of model convergence. In real application, multiple imputations should be used.

In the examples below, the (scaled) \(\chi^2\) statistic will differ due to the different methods lavaan and mplus uses to compute the H1 model (as well as due to the imputation) If the same model is fit on the same data set, mplus and lavaan will produce (almost) identical point estimates and standard errors.

Models of Section 7.2.1

Multilevel correlated first-order factors models for a traditional combination of raters configural measurement invariance

R Code

cor_first_order_ml_cfa_unid<- '
Level: 1
# Trait-specific rater (method) factors UR_j
# Loneliness (R_1)
UR_flone =~ 1*Flon1 + Flon2 + Flon3
# Flourishing (R_2)
UR_fflou =~ 1*Fflou1 + Fflou2

Level: 2
# General trait factors T_j
# Loneliness (T_1)
T_flone =~ 1*Flon1 + Flon2 + Flon3
# Flourishing (T_2)
T_flou =~ 1*Fflou1 + Fflou2

# Flourishing T_2
# Parent reports
P_flone =~ 1*Plon1 + Plon2 + Plon3
P_flou =~ Pflou1 + Pflou2

# Self-reports
S_flone =~ Slon1 + Slon2 + Slon3
S_flou =~ Sflou1 + Sflou2

# Level-2 residual variances fixed to zero
Flon1 ~~ 0*Flon1
Flon2 ~~ 0*Flon2
Flon3 ~~ 0*Flon3
Fflou1 ~~ 0*Fflou1
Fflou2 ~~ 0*Fflou2
'

fit_mod1 <- sem(cor_first_order_ml_cfa_unid, data = chapter_7_2_1, 
                estimator="mlr", cluster = "Target",
                baseline = FALSE, start = "simple",
                )

summary(fit_mod1, fit.measures =T, std=T, rsquare=T)

MPlus Code

Download

Multilevel correlated first-order factors models for a traditional combination of raters with indicator-specific residual factors and configural measurement invariance

R Code

cor_first_order_ml_cfa_is_conf <- '

Level: 1
# Trait-specific rater (method) factors UR_j
# Loneliness (R_1)
UR_flone =~ 1*Flon1 + Flon2 + Flon3

# Flourishing (R_2)
UR_fflou =~ 1*Fflou1 + Fflou2

Level: 2
# trait factors T_ij
# Loneliness (T_i1)
T_flone =~ 1*Flon1 + Flon2 + Flon3

# Parent
P_flone =~ 1*Plon1 + Plon2 + Plon3

# Self-reports
S_flone =~ 1*Slon1 + Slon2 + Slon3

# Flourishing (T_i2)
T_flou =~ 1*Fflou1 + Fflou2

# Parent
P_flou =~ Pflou1 + Pflou2

# Self-Report
S_flou =~ Sflou1 + Sflou2

# Define Indicator-Specific Factors
IS2_flone =~ 1*Plon2 + 1*Slon2 + 1*Flon2
IS3_flone =~ 1*Plon3 + 1*Slon3 + 1*Flon3
IS2_flou =~ 1*Pflou2 + 1*Sflou2 + 1*Fflou2

# Impermissible Correlation
T_flone ~~ 0*IS2_flone + 0*IS3_flone
P_flone ~~ 0*IS2_flone + 0*IS3_flone
S_flone ~~ 0*IS2_flone + 0*IS3_flone
T_flou ~~ 0*IS2_flou
P_flou ~~ 0*IS2_flou
S_flou ~~ 0*IS2_flou

# Level-2 residual variances fixed to zero
Flon1 ~~ 0*Flon1
Flon2 ~~ 0*Flon2
Flon3 ~~ 0*Flon3
Fflou1 ~~ 0*Fflou1
Fflou2 ~~ 0*Fflou2

'

fit_mod2_conf <- sem(cor_first_order_ml_cfa_is_conf, data = chapter_7_2_1, 
                estimator="mlr", cluster = "Target", 
                baseline = FALSE, start = "simple", 
                #verbose=T
                )

summary(fit_mod2_conf,  fit.measures =T, std=T, rsquare=T)

MPlus Code

Download

Multilevel correlated first-order factors models for a traditional combination of raters with indicator-specific residual factors and weak measurement invariance

R Code

cor_first_order_ml_cfa_is_weak <- '

Level: 1
# Trait-specific rater (method) factors UR_j
# Loneliness (R_1)
UR_flone =~ 1*Flon1 + Flon2 + Flon3

# Flourishing (R_2)
UR_fflou =~ 1*Fflou1 + Fflou2

Level: 2
# trait factors T_ij
# Loneliness (T_i1)
T_flone =~ 1*Flon1 + lon2*Flon2 + lon3*Flon3

# Parent
P_flone =~ 1*Plon1 + lon2*Plon2 + lon3*Plon3

# Self-reports
S_flone =~ 1*Slon1 + lon2*Slon2 + lon3*Slon3

# Flourishing (T_i2)
T_flou =~ 1*Fflou1 + flo2*Fflou2

# Parent
P_flou =~ 1*Pflou1 + flo2*Pflou2

# Self-Report
S_flou =~ 1*Sflou1 + flo2*Sflou2

# Define Indicator-Specific Factors
IS2_flone =~ 1*Plon2 + 1*Slon2 + 1*Flon2
IS3_flone =~ 1*Plon3 + 1*Slon3 + 1*Flon3
IS2_flou =~ 1*Pflou2 + 1*Sflou2 + 1*Fflou2

# Impermissible Correlation
T_flone ~~ 0*IS2_flone + 0*IS3_flone
P_flone ~~ 0*IS2_flone + 0*IS3_flone
S_flone ~~ 0*IS2_flone + 0*IS3_flone
T_flou ~~ 0*IS2_flou
P_flou ~~ 0*IS2_flou
S_flou ~~ 0*IS2_flou

# Level-2 residual variances fixed to zero
Flon1 ~~ 0*Flon1
Flon2 ~~ 0*Flon2
Flon3 ~~ 0*Flon3
Fflou1 ~~ 0*Fflou1
Fflou2 ~~ 0*Fflou2

'

fit_mod2_weak <- sem(cor_first_order_ml_cfa_is_weak, data = chapter_7_2_1, 
                     estimator="mlr", cluster = "Target", 
                     baseline = FALSE, start = "simple", 
                     #verbose=T
                     )

summary(fit_mod2_weak,  fit.measures =T, std=T, rsquare=T)

MPlus Code

Download

Multilevel correlated first-order factors models for a traditional combination of raters with indicator-specific residual factors and strong measurement invariance

R Code

cor_first_order_ml_cfa_is_strong<-'
Level: 1
# Trait-specific rater (method) factors UR_j
# Loneliness (R_1)
UR_flone =~ 1*Flon1 + Flon2 + Flon3

# Flourishing (R_2)
UR_fflou =~ 1*Fflou1 + Fflou2

Level: 2
# trait factors T_ij
# Loneliness (T_i1)
T_flone =~ 1*Flon1 + lon2*Flon2 + lon3*Flon3

# Parent
P_flone =~ 1*Plon1 + lon2*Plon2 + lon3*Plon3

# Self-reports
S_flone =~ 1*Slon1 + lon2*Slon2 + lon3*Slon3

# Flourishing (T_i2)
T_flou =~ 1*Fflou1 + flo2*Fflou2

# Parent
P_flou =~ 1*Pflou1 + flo2*Pflou2

# Self-Report
S_flou =~ 1*Sflou1 + flo2*Sflou2

# Define Indicator-Specific Factors
IS2_flone =~ 1*Plon2 + 1*Slon2 + 1*Flon2
IS3_flone =~ 1*Plon3 + 1*Slon3 + 1*Flon3
IS2_flou =~ 1*Pflou2 + 1*Sflou2 + 1*Fflou2

# Impermissible Correlation
T_flone ~~ 0*IS2_flone + 0*IS3_flone
P_flone ~~ 0*IS2_flone + 0*IS3_flone
S_flone ~~ 0*IS2_flone + 0*IS3_flone
T_flou ~~ 0*IS2_flou
P_flou ~~ 0*IS2_flou
S_flou ~~ 0*IS2_flou

# Level-2 residual variances fixed to zero
Flon1 ~~ 0*Flon1
Flon2 ~~ 0*Flon2
Flon3 ~~ 0*Flon3
Fflou1 ~~ 0*Fflou1
Fflou2 ~~ 0*Fflou2

Slon1 ~ alp1*1
Plon1 ~ alp1*1
Flon1 ~ alp1*1
Slon2 ~ alp2*1
Plon2 ~ alp2*1
Flon2 ~ alp2*1
Slon3 ~ alp3*1
Plon3 ~ alp3*1
Flon3 ~ alp3*1
Fflou1 ~ alp4*1
Pflou1 ~ alp4*1
Sflou1 ~ alp4*1
Fflou2 ~ alp5*1
Pflou2 ~ alp5*1
Sflou2 ~ alp5*1

T_flone ~ 1
P_flone ~ 1
P_flou ~ 1
S_flou ~ 1
'

fit_mod2_strong <- sem(cor_first_order_ml_cfa_is_strong, data = chapter_7_2_1, 
                       estimator="mlr", cluster = "Target", 
                       baseline = FALSE, start = "simple", 
                       #verbose=T
                       )

summary(fit_mod2_strong, fit.measures =T, std=T, rsquare=T)

MPlus Code

Download

Multilevel correlated first-order factors models for a traditional combination of raters with indicator-specific residual factors and strict measurement invariance

R Code

cor_first_order_ml_cfa_is_strict<-'
 Level: 1
# Trait-specific rater (method) factors UR_j
# Loneliness (R_1)
UR_flone =~ 1*Flon1 + Flon2 + Flon3

# Flourishing (R_2)
UR_fflou =~ 1*Fflou1 + Fflou2

Flon1 ~~ eps1*Flon1
Flon2 ~~ eps2*Flon2
Flon3 ~~ eps3*Flon3
Fflou1 ~~ eps4*Fflou1
Fflou2 ~~ eps5*Fflou2

Level: 2

# trait factors T_ij
# Loneliness (T_i1)
T_flone =~ 1*Flon1 + lon2*Flon2 + lon3*Flon3

# Parent
P_flone =~ 1*Plon1 + lon2*Plon2 + lon3*Plon3

# Self-reports
S_flone =~ 1*Slon1 + lon2*Slon2 + lon3*Slon3

# Flourishing (T_i2)
T_flou =~ 1*Fflou1 + flo2*Fflou2

# Parent
P_flou =~ 1*Pflou1 + flo2*Pflou2

# Self-Report
S_flou =~ 1*Sflou1 + flo2*Sflou2

# Define Indicator-Specific Factors
IS2_flone =~ 1*Plon2 + 1*Slon2 + 1*Flon2
IS3_flone =~ 1*Plon3 + 1*Slon3 + 1*Flon3
IS2_flou =~ 1*Pflou2 + 1*Sflou2 + 1*Fflou2

# Impermissible Correlation
T_flone ~~ 0*IS2_flone + 0*IS3_flone
P_flone ~~ 0*IS2_flone + 0*IS3_flone
S_flone ~~ 0*IS2_flone + 0*IS3_flone
T_flou ~~ 0*IS2_flou
P_flou ~~ 0*IS2_flou
S_flou ~~ 0*IS2_flou

# Level-2 residual variances fixed to zero
Flon1 ~~ 0*Flon1
Flon2 ~~ 0*Flon2
Flon3 ~~ 0*Flon3
Fflou1 ~~ 0*Fflou1
Fflou2 ~~ 0*Fflou2

# fix intercepts to zero
Slon1 ~ alp1*1
Plon1 ~ alp1*1
Flon1 ~ alp1*1
Slon2 ~ alp2*1
Plon2 ~ alp2*1
Flon2 ~ alp2*1
Slon3 ~ alp3*1
Plon3 ~ alp3*1
Flon3 ~ alp3*1
Fflou1 ~ alp4*1
Pflou1 ~ alp4*1
Sflou1 ~ alp4*1
Fflou2 ~ alp5*1
Pflou2 ~ alp5*1
Sflou2 ~ alp5*1

# Freely estimate the means of the trait-rater factors
# Because all intercepts are set equal across rater groups
# It is necessary to fix one latent mean of a trait-rater factor per trait to zero
# This is default in Mplus (here: S_flou and S_flone are set to zero)
T_flone ~ 1
P_flone ~ 1
P_flou ~ 1
S_flou ~ 1

# set error variances equal across rater group
Slon1 ~~ eps1*Slon1
Plon1 ~~ eps1*Plon1
Slon2 ~~ eps2*Slon2
Plon2 ~~ eps2*Plon2
Slon3 ~~ eps3*Slon3
Plon3 ~~ eps3*Plon3
Pflou1 ~~ eps4*Pflou1
Sflou1 ~~ eps4*Sflou1
Pflou2 ~~ eps5*Pflou2
Sflou2 ~~ eps5*Sflou2

'


fit_mod2_strict <- sem(cor_first_order_ml_cfa_is_strict, data = chapter_7_2_1, 
                       estimator="mlr", cluster = "Target", 
                       baseline = FALSE, start = "simple", 
                       #verbose=T
                       )

summary(fit_mod2_strict, fit.measures =T, std=T, rsquare=T)

MPlus Code

Download

Model comparison

anova(fit_mod2_conf, fit_mod2_weak, fit_mod2_strong, fit_mod2_strict)

Models of Section 7.2.1

ML-CTC(M-1) models for a traditional combination of raters

ML-CTC(M-1) model with configural measurement invariance

R Code

ML_CTCM_1_config <-'
Level: 1
# Trait-specific rater (method) factors UR_j
# Loneliness (R_1)
UR_flone =~ 1*Flon1 + Flon2 + Flon3
UR_flou  =~ 1*Fflou1 + Fflou2

Level: 2
# trait factors T_ij
# Loneliness (T_i1)
T_flone =~ 1*Slon1 + Slon2 + Slon3 + 
           Flon1 + Flon2 + Flon3 + 
           Plon1 + Plon2 + Plon3

# Rater-Specific Factors
P_flone =~ 1*Plon1 + Plon2 + Plon3

# Friend Report
CR_flone =~ 1*Flon1 + Flon2 + Flon3

# Flourishing (T_i2)
T_flou =~ 1*Sflou1 + Sflou2 + 
          Fflou1 + Fflou2 + 
          Pflou1 + Pflou2

# Rater-Specific Factors          
P_flou =~ 1*Pflou1 + Pflou2

# Friend Report
CR_flou =~ 1*Fflou1 + Fflou2

# Indicator-specific method factors
IS2_flone =~ 1*Plon2 + 1*Slon2 + 1*Flon2
IS3_flone =~ 1*Plon3 + 1*Slon3 + 1*Flon3
IS2_flou =~ 1*Pflou2 + 1*Sflou2 + 1*Fflou2

# impermissible correlations
T_flone ~~ 0*P_flone + 0*CR_flone
T_flou ~~ 0*P_flou + 0*CR_flou
T_flone ~~ 0*IS2_flone + 0*IS3_flone
P_flone ~~ 0*IS2_flone + 0*IS3_flone
CR_flone ~~ 0*IS2_flone + 0*IS3_flone
T_flou ~~ 0*IS2_flou
P_flou ~~ 0*IS2_flou
CR_flou ~~ 0*IS2_flou

# Level-2 residual variances fixed to zero
Flon1 ~~ 0*Flon1
Flon2 ~~ 0*Flon2
Flon3 ~~ 0*Flon3
Fflou1 ~~ 0*Fflou1
Fflou2 ~~ 0*Fflou2
' 

fit_config <- sem(ML_CTCM_1_config, data = chapter_7_2_1, 
                  estimator="mlr", cluster = "Target", 
                  baseline = FALSE, start = "simple", 
                  #verbose=T
                  )

summary(fit_config, fit.measures =T, std=T, rsquare=T)

MPlus Code

Download

ML-CTC(M-1) model with weak measurement invariance

R Code

ML_CTCM_1_weak <-'
Level: 1
# Trait-specific rater (method) factors UR_j
# Loneliness (UR_1)
UR_flone =~ 1*Flon1 + Flon2 + Flon3
UR_flou =~ 1*Fflou1 + Fflou2

Level: 2
# trait factors T_ij
# Loneliness (T_i1)
T_flone =~ 1*Slon1 + lon2*Slon2 + lon3*Slon3 + 
           gfl1*Flon1 + gfl2*Flon2 + gfl3*Flon3 +
           gpl1*Plon1 + gpl2*Plon2 + gpl3*Plon3
  
# Rater-Specific Factors
P_flone =~ 1*Plon1 + lon2*Plon2 + lon3*Plon3

# Friend Report
CR_flone =~ 1*Flon1 + lon2*Flon2 + lon3*Flon3

# Flourishing (T_i2)
T_flou =~ 1*Sflou1 + flo2*Sflou2 + 
          gff1*Fflou1 + gff2*Fflou2 + 
          gpf1*Pflou1 + gpf2*Pflou2

# Rater-Specific Factors
P_flou =~ 1*Pflou1 + flo2*Pflou2

# Friend Report
CR_flou =~ 1*Fflou1 + flo2*Fflou2

# Indicator-specific method factors
IS2_flone =~ 1*Plon2 + 1*Slon2 + 1*Flon2
IS3_flone =~ 1*Plon3 + 1*Slon3 + 1*Flon3
IS2_flou =~ 1*Pflou2 + 1*Sflou2 + 1*Fflou2

# impermissible correlations
T_flone ~~ 0*P_flone + 0*CR_flone
T_flou ~~ 0*P_flou + 0*CR_flou
T_flone ~~ 0*IS2_flone + 0*IS3_flone
P_flone ~~ 0*IS2_flone + 0*IS3_flone
CR_flone ~~ 0*IS2_flone + 0*IS3_flone
T_flou ~~ 0*IS2_flou
P_flou ~~ 0*IS2_flou
CR_flou ~~ 0*IS2_flou

# Level-2 residual variances fixed to zero
Flon1 ~~ 0*Flon1
Flon2 ~~ 0*Flon2
Flon3 ~~ 0*Flon3
Fflou1 ~~ 0*Fflou1
Fflou2 ~~ 0*Fflou2

# model constraints 
# only neccessary to make the fit invariant 
# against changes of the reference rater groups
gfl2 := gfl1*lon2
gfl3 := gfl1*lon3
gpl2 := gpl1*lon2
gpl3 := gpl1*lon3
gff2 := gff1*flo2
gpf2 := gpf1*flo2


'

fit_weak <- sem(ML_CTCM_1_weak, data = chapter_7_2_1, 
                estimator="mlr", cluster = "Target", 
                baseline = FALSE, start = "simple", 
                #verbose=T
                )

summary(fit_weak, fit.measures =T, std=T, rsquare=T)

MPlus Code

Download

ML-CTC(M-1) model with strong measurement invariance

R Code

ML_CTCM_1_strong <- '
Level: 1
# Trait-specific rater (method) factors UR_j
# Loneliness (UR_1)
UR_flone =~ 1*Flon1 + Flon2 + Flon3
UR_flou =~ 1*Fflou1 + Fflou2

Level: 2
# trait factors T_ij
# Loneliness (T_i1)
T_flone =~ 1*Slon1 + lon2*Slon2 + lon3*Slon3 + 
           gfl1*Flon1 + gfl2*Flon2 + gfl3*Flon3 +
           gpl1*Plon1 + gpl2*Plon2 + gpl3*Plon3
     
# Rater-Specific Factors
P_flone =~ 1*Plon1 + lon2*Plon2 + lon3*Plon3

# Friend Report
CR_flone =~ 1*Flon1 + lon2*Flon2 + lon3*Flon3

# Flourishing (T_i2)
T_flou =~ 1*Sflou1 + flo2*Sflou2 + 
          gff1*Fflou1 + gff2*Fflou2 + 
          gpf1*Pflou1 + gpf2*Pflou2

# Rater-Specific Factors
P_flou =~ 1*Pflou1 + flo2*Pflou2

# Friend Report
CR_flou =~ 1*Fflou1 + flo2*Fflou2

# Indicator-specific method factors
IS2_flone =~ 1*Plon2 + 1*Slon2 + 1*Flon2
IS3_flone =~ 1*Plon3 + 1*Slon3 + 1*Flon3
IS2_flou =~ 1*Pflou2 + 1*Sflou2 + 1*Fflou2

# impermissible correlations
T_flone ~~ 0*P_flone + 0*CR_flone
T_flou ~~ 0*P_flou + 0*CR_flou
T_flone ~~ 0*IS2_flone + 0*IS3_flone
P_flone ~~ 0*IS2_flone + 0*IS3_flone
CR_flone ~~ 0*IS2_flone + 0*IS3_flone
T_flou ~~ 0*IS2_flou
P_flou ~~ 0*IS2_flou
CR_flou ~~ 0*IS2_flou

# Level-2 residual variances fixed to zero
Flon1 ~~ 0*Flon1
Flon2 ~~ 0*Flon2
Flon3 ~~ 0*Flon3
Fflou1 ~~ 0*Fflou1
Fflou2 ~~ 0*Fflou2

# fix intercepts to zero
Slon1 ~ alp1*1
Plon1 ~ alp1*1
Flon1 ~ alp1*1
Slon2 ~ alp2*1
Plon2 ~ alp2*1
Flon2 ~ alp2*1
Slon3 ~ alp3*1
Plon3 ~ alp3*1
Flon3 ~ alp3*1
Fflou1 ~ alp4*1
Pflou1 ~ alp4*1
Sflou1 ~ alp4*1
Fflou2 ~ alp5*1
Pflou2 ~ alp5*1
Sflou2 ~ alp5*1

# Estimate means
# Because all intercepts are set equal across raters
# One needs to freely estimate the means of the rater factors
# See Chapter 4 (section 4.3) for details and explanation
P_flou ~ 1
CR_flou ~ 1
P_flone ~ 1
CR_flone ~ 1

##  model constraints 
# only neccessary to make the fit invariant 
# against changes of the reference rater groups
gfl2 := gfl1*lon2
gfl3 := gfl1*lon3
gpl2 := gpl1*lon2
gpl3 := gpl1*lon3
gff2 := gff1*flo2
gpf2 := gpf1*flo2
'

fit_strong <- sem(ML_CTCM_1_strong, data = chapter_7_2_1, 
                  estimator="mlr", cluster = "Target", 
                  baseline = FALSE, start = "simple", 
                  #verbose=T
                  )

summary(fit_strong, fit.measures =T, std=T, rsquare=T)

MPlus Code

Download

ML-CTC(M-1) model with strict measurement invariance

R Code

ML_CTCM_1_strict <- '
Level: 1
# Trait-specific rater (method) factors UR_j
# Loneliness (UR_1)
UR_flone =~ 1*Flon1 + lon_ur2*Flon2 + lon_ur3*Flon3
UR_flou =~ 1*Fflou1 + flo_ur2*Fflou2

# fix error variance equal across raters
Flon1 ~~ eps1*Flon1
Flon2 ~~ eps2*Flon2
Flon3 ~~ eps3*Flon3
Fflou1 ~~ eps4*Fflou1
Fflou2 ~~ eps5*Fflou2

UR_flone ~~ VarUR1*UR_flone
UR_flou ~~ VarUR2*UR_flou

Level: 2
# trait factors T_ij
# Loneliness (T_i1)
T_flone =~ 1*Slon1 + lon2*Slon2 + lon3*Slon3 + 
           gfl1*Flon1 + gfl2*Flon2 + gfl3*Flon3 +
           gpl1*Plon1 + gpl2*Plon2 + gpl3*Plon3
     
# Rater-Specific Factors
P_flone =~ 1*Plon1 + lon2*Plon2 + lon3*Plon3

# Friend Report
CR_flone =~ 1*Flon1 + lon2*Flon2 + lon3*Flon3

# Flourishing (T_i2)
T_flou =~ 1*Sflou1 + flo2*Sflou2 + 
          gff1*Fflou1 + gff2*Fflou2 + 
          gpf1*Pflou1 + gpf2*Pflou2

# Rater-Specific Factors
P_flou =~ 1*Pflou1 + flo2*Pflou2

# Friend Report
CR_flou =~ 1*Fflou1 + flo2*Fflou2

# Indicator-specific method factors
IS2_flone =~ 1*Plon2 + 1*Slon2 + 1*Flon2
IS3_flone =~ 1*Plon3 + 1*Slon3 + 1*Flon3
IS2_flou =~ 1*Pflou2 + 1*Sflou2 + 1*Fflou2

# impermissible correlations
T_flone ~~ 0*P_flone + 0*CR_flone
T_flou ~~ 0*P_flou + 0*CR_flou
T_flone ~~ 0*IS2_flone + 0*IS3_flone
P_flone ~~ 0*IS2_flone + 0*IS3_flone
CR_flone ~~ 0*IS2_flone + 0*IS3_flone
T_flou ~~ 0*IS2_flou
P_flou ~~ 0*IS2_flou
CR_flou ~~ 0*IS2_flou

# Level-2 residual variances fixed to zero
Flon1 ~~ 0*Flon1
Flon2 ~~ 0*Flon2
Flon3 ~~ 0*Flon3
Fflou1 ~~ 0*Fflou1
Fflou2 ~~ 0*Fflou2

# fix intercepts to zero
Slon1 ~ alp1*1
Plon1 ~ alp1*1
Flon1 ~ alp1*1
Slon2 ~ alp2*1
Plon2 ~ alp2*1
Flon2 ~ alp2*1
Slon3 ~ alp3*1
Plon3 ~ alp3*1
Flon3 ~ alp3*1
Fflou1 ~ alp4*1
Pflou1 ~ alp4*1
Sflou1 ~ alp4*1
Fflou2 ~ alp5*1
Pflou2 ~ alp5*1
Sflou2 ~ alp5*1

# Estimate means
# Because all intercepts are set equal across raters
# One needs to freely estimate the means of the rater factors
# See Chapter 4 (section 4.3) for details and explanation
P_flou ~ 1
CR_flou ~ 1
P_flone ~ 1
CR_flone ~ 1

# set error variances equal across rater group
Slon1 ~~ eps1*Slon1
Plon1 ~~ eps1*Plon1
Slon2 ~~ eps2*Slon2
Plon2 ~~ eps2*Plon2
Slon3 ~~ eps3*Slon3
Plon3 ~~ eps3*Plon3
Pflou1 ~~ eps4*Pflou1
Sflou1 ~~ eps4*Sflou1
Pflou2 ~~ eps5*Pflou2
Sflou2 ~~ eps5*Sflou2

# model constraints 
# only neccessary to make the fit invariant 
# against changes of the reference rater groups
gfl2 := gfl1*lon2
gfl3 := gfl1*lon3
gpl2 := gpl1*lon2
gpl3 := gpl1*lon3
gff2 := gff1*flo2
gpf2 := gpf1*flo2

### Variance Coefficients  

T_flone ~~ VarT1*T_flone
T_flou ~~  VarT2*T_flou
P_flone ~~ VarP1*P_flone
P_flou ~~ VarP2*P_flou
CR_flone ~~ VarCR1*CR_flone
CR_flou ~~ VarCR2*CR_flou
IS2_flone ~~ VarIS2*IS2_flone
IS3_flone ~~ VarIS3*IS3_flone
IS2_flou ~~ VarIS4*IS2_flou

# True-Score Variance
tau_Slon1 :=VarT1 
tau_Slon2 :=lon2^2*VarT1 + VarIS2
tau_Slon3 :=lon3^2*VarT1 + VarIS3
tau_Plon1 :=gpl1^2*VarT1 + VarP1
tau_Plon2 :=gpl2^2*VarT1 + lon2^2*VarP1+VarIS2
tau_Plon3 :=gpl3^2*VarT1 + lon3^2*VarP1+VarIS3
tau_Flon1 :=gfl1^2*VarT1 + VarCR1+VarUR1 
tau_Flon2 :=gfl2^2*VarT1 + lon2^2*VarCR1+lon_ur2^2*VarUR1 +VarIS2
tau_Flon3 :=gfl3^2*VarT1 + lon3^2*VarCR1+lon_ur3^2*VarUR1 +VarIS3

tau_Sflou1 :=VarT2
tau_Sflou2 :=flo2^2*VarT2+VarIS4
tau_Pflou1 :=gpf1^2*VarT2+VarP2
tau_Pflou2 :=gpf2^2*VarT2+flo2^2*VarP2+VarIS4
tau_Fflou1 :=gff1^2*VarT2+VarCR2+VarUR2
tau_Fflou2 :=gff2^2*VarT2+flo2^2*VarCR2+flo_ur2^2*VarUR2+VarIS4

# Reliabilität
Rel_Slon1 := tau_Slon1/(tau_Slon1+eps1)
Rel_Slon2 := tau_Slon2/(tau_Slon2+eps2)
Rel_Slon3 := tau_Slon3/(tau_Slon3+eps3)
Rel_Plon1 := tau_Plon1/(tau_Plon1+eps1)
Rel_Plon2 := tau_Plon2/(tau_Plon2+eps2)
Rel_Plon3 := tau_Plon3/(tau_Plon3+eps3)
Rel_Flon1 := tau_Flon1/(tau_Flon1+eps1)
Rel_Flon2 := tau_Flon2/(tau_Flon2+eps2)
Rel_Flon3 := tau_Flon3/(tau_Flon3+eps3)

Rel_Sflou1 := tau_Sflou1/(tau_Sflou1+eps4)
Rel_Sflou2 := tau_Sflou2/(tau_Sflou2+eps5)
Rel_Pflou1 := tau_Pflou1/(tau_Pflou1+eps4)
Rel_Pflou2 := tau_Pflou2/(tau_Pflou2+eps5)
Rel_Fflou1 := tau_Fflou1/(tau_Fflou1+eps4)
Rel_Fflou2 := tau_Fflou2/(tau_Fflou2+eps5)

# ICCs
level2_Flon1 := gfl1^2*VarT1 + VarCR1
level2_Flon2 := gfl2^2*VarT1 + lon2^2*VarCR1 +VarIS2
level2_Flon3 := gfl3^2*VarT1 + lon3^2*VarCR1 +VarIS3
level2_Fflou1 := gfl2^2*VarT2 + VarCR2
level2_Fflou2 := gfl3^2*VarT2 + flo2^2*VarCR2+VarIS4

ICC_Flon1 := level2_Flon1 / tau_Flon1
ICC_Flon1 := level2_Flon2 / tau_Flon2
ICC_Flon1 := level2_Flon3 / tau_Flon3
ICC_Fflou1 := level2_Fflou1 /tau_Fflou1
ICC_Fflou2 := level2_Fflou2 /tau_Fflou2

# Indicator-Specificity
IS_Flon2 := VarIS2/tau_Flon2
IS_Flon3 := VarIS3/tau_Flon3
IS_Fflou2 := VarIS4/tau_Fflou2

# Level 1 consistency
Con1_Flon1 := (gfl1^2*VarT1) /tau_Flon1
Con1_Flon2 := (gfl2^2*VarT1 +VarIS2) / tau_Flon2
Con1_Flon3 := (gfl3^2*VarT1 +VarIS3) / tau_Flon3
Con1_Fflou1 := (gff1^2*VarT2) /tau_Fflou1
Con1_Fflou2 := (gff2^2*VarT2 +VarIS4) /tau_Fflou2

# Unique Rater Specificity
UM_Flon1 :=  VarUR1 /tau_Flon1
UM_Flon2 :=  lon_ur2^2*VarUR1 / tau_Flon2
UM_Flon3 :=  lon_ur3^2*VarUR1 /tau_Flon3
UM_Fflou1 :=  VarUR2/tau_Fflou1
UM_Fflou2 :=flo_ur2^2*VarUR2 /tau_Fflou2

# Common Rater Specificity 
CM1_Flon1 :=  VarCR1/tau_Flon1
CM1_Flon2 :=  lon2^2*VarCR1/tau_Flon2
CM1_Flon3 :=  lon3^2*VarCR1/tau_Flon3
CM1_Fflou1 := VarCR2/tau_Fflou1
CM1_Fflou2 := flo2^2*VarCR2/tau_Fflou2

# Level 2 consistency
Con2_Plon1 :=(gpl1^2*VarT1 )/tau_Plon1
Con2_Plon2 :=(gpl2^2*VarT1 +VarIS2)/tau_Plon2
Con2_Plon3 :=(gpl3^2*VarT1 +VarIS3)/tau_Plon3
Con2_Flon1 :=(gfl1^2*VarT1 )/level2_Flon1
Con2_Flon2 :=(gfl2^2*VarT1 +VarIS2)/level2_Flon2
Con2_Flon3 :=(gfl3^2*VarT1 +VarIS3)/level2_Flon3

Con2_Pflou1 :=(gpf1^2*VarT2)/tau_Pflou1
Con2_Pflou2 :=(gpf2^2*VarT2+VarIS4)/tau_Pflou2
Con2_Fflou1 :=(gff1^2*VarT2)/level2_Fflou1
Con2_Fflou2 :=(gff2^2*VarT2+VarIS4)/level2_Fflou2

'

fit_strict <- sem(ML_CTCM_1_strict, data = chapter_7_2_1, 
                  estimator="mlr", cluster = "Target", 
                  baseline = FALSE, start = "simple", 
                  #verbose=T
                  )

summary(fit_strict, fit.measures =T, std=T, rsquare=T)

MPlus Code

Download

Model Comparison
anova(fit_config, fit_weak, fit_strong, fit_strict)

ML-CTC(M-1) model with the interchangeable raters as reference rater group

R Code

ML_CTCM_1_inter_rater_ref<-'
Level: 1
# Trait-specific rater (method) factors UR_j
# Loneliness (UR_1)
UR_flone =~ 1*Flon1 + Flon2 + Flon3
UR_flou =~ 1*Fflou1 + Fflou2

Level: 2
# trait factors T_ij
# Loneliness (T_i1)
T_flone =~ 1*Flon1 + lon2*Flon2 + lon3*Flon3 + 
           gfl1*Slon1 + gfl2*Slon2 + gfl3*Slon3 +
           gpl1*Plon1 + gpl2*Plon2 + gpl3*Plon3
     
# Rater-Specific Factors
P_flone =~ 1*Plon1 + lon2*Plon2 + lon3*Plon3

# Friend Report
CR_flone =~ 1*Slon1 + lon2*Slon2 + lon3*Slon3

# Flourishing (T_i2)
T_flou =~ 1*Fflou1 + flo2*Fflou2 + 
          gff1*Sflou1 + gff2*Sflou2 + 
          gpf1*Pflou1 + gpf2*Pflou2

# Rater-Specific Factors
P_flou =~ 1*Pflou1 + flo2*Pflou2

# Friend Report
CR_flou =~ 1*Sflou1 + flo2*Sflou2

# Indicator-specific method factors
IS2_flone =~ 1*Plon2 + 1*Slon2 + 1*Flon2
IS3_flone =~ 1*Plon3 + 1*Slon3 + 1*Flon3
IS2_flou =~ 1*Pflou2 + 1*Sflou2 + 1*Fflou2

# impermissible correlations
T_flone ~~ 0*P_flone + 0*CR_flone
T_flou ~~ 0*P_flou + 0*CR_flou
T_flone ~~ 0*IS2_flone + 0*IS3_flone
P_flone ~~ 0*IS2_flone + 0*IS3_flone
CR_flone ~~ 0*IS2_flone + 0*IS3_flone
T_flou ~~ 0*IS2_flou
P_flou ~~ 0*IS2_flou
CR_flou ~~ 0*IS2_flou

# Level-2 residual variances fixed to zero
Flon1 ~~ 0*Flon1
Flon2 ~~ 0*Flon2
Flon3 ~~ 0*Flon3
Fflou1 ~~ 0*Fflou1
Fflou2 ~~ 0*Fflou2

# fix intercepts to zero
Slon1 ~ alp1*1
Plon1 ~ alp1*1
Flon1 ~ alp1*1
Slon2 ~ alp2*1
Plon2 ~ alp2*1
Flon2 ~ alp2*1
Slon3 ~ alp3*1
Plon3 ~ alp3*1
Flon3 ~ alp3*1
Fflou1 ~ alp4*1
Pflou1 ~ alp4*1
Sflou1 ~ alp4*1
Fflou2 ~ alp5*1
Pflou2 ~ alp5*1
Sflou2 ~ alp5*1

# Estimate means
# Because all intercepts are set equal across raters
# One needs to freely estimate the means of the rater factors
# See Chapter 4 (section 4.3) for details and explanation
P_flou ~ 1
CR_flou ~ 1
P_flone ~ 1
CR_flone ~ 1

# model constraints 
# only neccessary to make the fit invariant 
# against changes of the reference rater groups
gfl2 := gfl1*lon2
gfl3 := gfl1*lon3
gpl2 := gpl1*lon2
gpl3 := gpl1*lon3
gff2 := gff1*flo2
gpf2 := gpf1*flo2
'

fit_inter_rater_ref <- sem(ML_CTCM_1_inter_rater_ref, 
                           data = chapter_7_2_1, 
                           estimator="mlr", cluster = "Target", 
                           baseline = FALSE, start = "simple", 
                           #verbose=T
                           )

summary(fit_inter_rater_ref, fit.measures =T, std=T, rsquare=T)

MPlus Code

Download

Models of Section 7.3.1

Multilevel CTC(M-1) Model for multiple sets interchangeable raters

# Y = observed (manifest) variable 
# t1, t2 = trait 1 or trait 2 
# i1, i2, i3 = indicator 1, indicator 2, indicator 3 
# m0 = reference rater m0, 
# m1 = 1st set of inter raters m1, 
# m2 = 2nd set of inter raters m2.
# Yt1i1m0, Yt1i2m0, Yt1i3m0, # Self-Report Trait1 
# Yt2i1m0, Yt2i2m0, Yt2i3m0, # Self-Report Trait2 
# Yt1i1m1, Yt1i2m1, Yt1i3m1, # 1st Set of Interchange Rater Trait 1 
# Yt2i1m1, Yt2i2m1, Yt2i3m1, # 2nd Set of Interchange Rater Trait 1 
# Yt1i1m2, Yt1i2m2, Yt1i3m2, # 1st Set of Interchange Rater Trait 1 
# Yt2i1m2, Yt2i2m2, Yt2i3m2, # 2nd Set of Interchange Rater Trait 1

R Code

ML_CTCM_1_Msets_inter <- '
Level: 1
  UR12 =~ 1*Yt1i1m1 + 1*Yt1i2m1 + 1*Yt1i3m1
  UR13 =~ 1*Yt1i1m2 + 1*Yt1i2m2 + 1*Yt1i3m2

  UR22 =~ 1*Yt2i1m1 + 1*Yt2i2m1 + 1*Yt2i3m1
  UR23 =~ 1*Yt2i1m2 + 1*Yt2i2m2 + 1*Yt2i3m2

  UR12 ~~ 0*UR13 + 0*UR23
  UR22 ~~ 0*UR13 + 0*UR23
  
  UR12 ~~ var_UR12*UR12
  UR13 ~~ var_UR13*UR13
  UR22 ~~ var_UR22*UR22
  UR23 ~~ var_UR23*UR23

  Yt1i1m1 ~~ eps*Yt1i1m1
  Yt1i2m1 ~~ eps*Yt1i2m1
  Yt1i3m1 ~~ eps*Yt1i3m1
  Yt1i1m2 ~~ eps*Yt1i1m2
  Yt1i2m2 ~~ eps*Yt1i2m2
  Yt1i3m2 ~~ eps*Yt1i3m2

  Yt2i1m1 ~~ eps*Yt2i1m1
  Yt2i2m1 ~~ eps*Yt2i2m1
  Yt2i3m1 ~~ eps*Yt2i3m1
  Yt2i1m2 ~~ eps*Yt2i1m2
  Yt2i2m2 ~~ eps*Yt2i2m2
  Yt2i3m2 ~~ eps*Yt2i3m2


Level: 2

  T11 =~ 1*Yt1i1m0 + 1*Yt1i2m0 + 1*Yt1i3m0 +
         lam21*Yt1i1m1 + lam21*Yt1i2m1 + lam21*Yt1i3m1 +
         lam31*Yt1i1m2 + lam31*Yt1i2m2 + lam31*Yt1i3m2
 
  CR12 =~ 1*Yt1i1m1 + 1*Yt1i2m1 + 1*Yt1i3m1
  CR13 =~ 1*Yt1i1m2 + 1*Yt1i2m2 + 1*Yt1i3m2

  T21 =~ 1*Yt2i1m0 + 1*Yt2i2m0 + 1*Yt2i3m0 +
         lam22*Yt2i1m1 + lam22*Yt2i2m1 + lam22*Yt2i3m1 +
         lam32*Yt2i1m2 + lam32*Yt2i2m2 + lam32*Yt2i3m2

  CR22 =~ 1*Yt2i1m1 + 1*Yt2i2m1 + 1*Yt2i3m1
  CR23 =~ 1*Yt2i1m2 + 1*Yt2i2m2 + 1*Yt2i3m2

  T11 ~~ 0*CR12 + 0*CR13 + 0*CR22 + 0*CR23
  T21 ~~ 0*CR12 + 0*CR13 + 0*CR22 + 0*CR23
  
  T11 ~~ var_T1*T11
  T21 ~~ var_T2*T21
  CR12 ~~ var_CR12*CR12
  CR13 ~~ var_CR13*CR13
  CR22 ~~ var_CR22*CR22
  CR23 ~~ var_CR23*CR23

  # fix error variance to zero
  Yt1i1m1 ~~ 0*Yt1i1m1
  Yt1i2m1 ~~ 0*Yt1i2m1
  Yt1i3m1 ~~ 0*Yt1i3m1
  Yt1i1m2 ~~ 0*Yt1i1m2
  Yt1i2m2 ~~ 0*Yt1i2m2
  Yt1i3m2 ~~ 0*Yt1i3m2

  Yt2i1m1 ~~ 0*Yt2i1m1
  Yt2i2m1 ~~ 0*Yt2i2m1
  Yt2i3m1 ~~ 0*Yt2i3m1
  Yt2i1m2 ~~ 0*Yt2i1m2
  Yt2i2m2 ~~ 0*Yt2i2m2
  Yt2i3m2 ~~ 0*Yt2i3m2

  Yt1i1m0 ~~ eps*Yt1i1m0
  Yt1i2m0 ~~ eps*Yt1i2m0
  Yt1i3m0 ~~ eps*Yt1i3m0
  Yt2i1m0 ~~ eps*Yt2i1m0
  Yt2i2m0 ~~ eps*Yt2i2m0
  Yt2i3m0 ~~ eps*Yt2i3m0
  
### Variance Coefficients  
# True-score Variance Trait 1
tauY10 := var_T1
tauY11 := lam21^2*var_T1 + var_CR12 + var_UR12 
tauY12 := lam31^2*var_T1 + var_CR13 + var_UR13 

# True-score Variance Trait 2
tauY20 := var_T2
tauY21 := lam22^2*var_T2 + var_CR22 + var_UR22
tauY22 := lam32^2*var_T2 + var_CR23 + var_UR23

## Reliability

RelY10 := tauY10 / (tauY10+eps)
RelY11 := tauY11 / (tauY11+eps)
RelY12 := tauY12 / (tauY12+eps)
RelY20 := tauY20 / (tauY20+eps)
RelY21 := tauY21 / (tauY21+eps)
RelY22 := tauY22 / (tauY22+eps)

## TRUE Unique Rater Specificity & ICCs

URSpe12 := var_UR12 / tauY11
URSpe13 := var_UR13 / tauY12
URSpe22 := var_UR22 / tauY21
URSpe23 := var_UR23 / tauY22

## ICCs

ICCY11 := 1 - URSpe12
ICCY12 := 1 - URSpe13
ICCY21 := 1 - URSpe22
ICCY22 := 1 - URSpe23

## Consistency Level 1

ConY11 := lam21^2*var_T1/tauY11
ConY12 := lam31^2*var_T1/tauY12
ConY21 := lam22^2*var_T2/tauY21
ConY22 := lam32^2*var_T2/tauY22

CRSpe12 := var_CR12/tauY11
CRSpe13 := var_CR13/tauY12
CRSpe22 := var_CR22/tauY21
CRSpe23 := var_CR23/tauY22
 
## Consistency Level 2

L2ConY11 := ConY11 + CRSpe12
L2ConY12 := ConY12 + CRSpe13
L2ConY21 := ConY21 + CRSpe22
L2ConY22 := ConY22 + CRSpe23
'

fit_ML_CTCM_1_Msets_inter <- sem(ML_CTCM_1_Msets_inter, 
                                 data = chapter_7_3_1, 
                                 estimator="mlr",
                                 cluster = "Target",
                                 missing = "ML", 
                                 baseline = FALSE, 
                                 start = "simple", 
                                 #verbose = TRUE
                                 )
summary(fit_ML_CTCM_1_Msets_inter)

MPlus Code

Download

Adjusted SRMR taken from R output above

p = 6 
p_nm1=3 
p_nm2=3 
SRMR.L1 = 0.012 
adj.SRMR.L1 = sqrt((p*(p+1))/(p*(p+1)-p_nm1*p_nm2)*SRMR.L1^2) 
adj.SRMR.L1 0.01353783

Models of Section 7.3.2

ML-CTC(M-1) Model for nested structurally different raters

R Code

ML_CTCM_1_nested_struc_raters <- "
Level: 1
# FACTOR STRUCTURE ON LEVEL ONE
# Trait 1
# Reference Trait Within
# Factor loading restrictions are
# Not neccessary in real applications
TW1 =~ 1*Y111 + 1*Y211 + 1*Y311 + 
       lamTW1*Y112 + lamTW1*Y212 + lamTW1*Y312
       
# Rater Factor Within
# Factor loading restrictions are
# Not neccessary in real applications
RW1 =~ 1*Y112 + 1*Y212 + 1*Y312

# Trait 2
# Reference Trait Within
# Factor loading restrictions are
# Not neccessary in real applications
TW2 =~ 1*Y121 + 1*Y221 + 1*Y321 + 
       lamTW2*Y122 + lamTW2*Y222 + lamTW2*Y322
       
# Rater Factor Within
# Factor loading restrictions are
# Not neccessary in real applications
RW2 =~ 1*Y122 + 1*Y222 + 1*Y322

# Factor Independencies
TW1 ~~ 0*RW1 + 0*RW2
# TW1 with RW2 would be permissible
TW2 ~~ 0*RW1 + 0*RW2

# TW2 with RW1 would be permissible
# Equal Measurement Variance
# Not neccessary & could also be relaxed
Y111 ~~ var_eps1*Y111
Y211 ~~ var_eps1*Y211
Y311 ~~ var_eps1*Y311
Y112 ~~ var_eps2*Y112
Y212 ~~ var_eps2*Y212
Y312 ~~ var_eps2*Y312
Y121 ~~ var_eps3*Y121
Y221 ~~ var_eps3*Y221
Y321 ~~ var_eps3*Y321
Y122 ~~ var_eps4*Y122
Y222 ~~ var_eps4*Y222
Y322 ~~ var_eps4*Y322

# Labeling the factor variances
# Only neccessary if variance coefficient
# are computed in model constraint command
TW1 ~~ varTW1*TW1
TW2 ~~ varTW2*TW2
RW1 ~~ varRW1*RW1
RW2 ~~ varRW2*RW2

Level: 2
# FACTOR STRUCTURE ON LEVEL TWO
# Trait 1
# Factor loading restrictions are
# Not neccessary in real applications
TB1 =~ 1*Y111 + 1*Y211 + 1*Y311 + 
       lamTB1*Y112 + lamTB1*Y212 + lamTB1*Y312
       
# Rater Factor Between
# Factor loading restrictions are
# Not neccessary in real applications
RB1 =~ 1*Y112 + 1*Y212 + 1*Y312

# Trait 2
# Factor loading restrictions are
# Not neccessary in real applications
TB2 =~ 1*Y121 + 1*Y221 + 1*Y321 + 
       lamTB2*Y122 + lamTB2*Y222 + lamTB2*Y322
       
# Rater Factor Between
# Factor loading restrictions are
# Not neccessary in real applications
RB2 =~ 1*Y122 + 1*Y222 + 1*Y322

#Factor Independencies
TB1 ~~ 0*RB1 + 0*RB2

# TB1 with RB2 would be permissible
TB2 ~~ 0*RB1 + 0*RB2

# TB2 with RB1 would be permissible
#ERROR VARIANCES ON LEVEL TWO
Y111 ~~ 0*Y111
Y211 ~~ 0*Y211
Y311 ~~ 0*Y311

Y112 ~~ 0*Y112
Y212 ~~ 0*Y212
Y312 ~~ 0*Y312

Y121 ~~ 0*Y121
Y221 ~~ 0*Y221
Y321 ~~ 0*Y321

Y122 ~~ 0*Y122
Y222 ~~ 0*Y222
Y322 ~~ 0*Y322

TB1 ~~ varTB1*TB1
TB2 ~~ varTB2*TB2
RB1 ~~ varRB1*RB1
RB2 ~~ varRB2*RB2

# Variance coefficients
  w_tau1 := varTW1 
  w_tau2 := lamTW1**2*varTW1 + varRW1 
  w_tau3 := varTW2 
  w_tau4 := lamTW2**2*varTW2 + varRW2 

  b_tau1 := varTB1 
  b_tau2 := lamTB1**2*varTB1 + varRB1 
  b_tau3 := varTB2 
  b_tau4 := lamTB2**2*varTB2 + varRB2 

# Level-1 consistency  
  w_con1 := varTW1 /w_tau1
  w_con2 := (lamTW1**2*varTW1)/ w_tau2
  w_con3 := varTW2/ w_tau3
  w_con4 := (lamTW2**2*varTW2)/ w_tau4

# Level-1 rater specificity  
  w_rsp1 := 1-w_con1
  w_rsp2 := 1-w_con2
  w_rsp3 := 1-w_con3
  w_rsp4 := 1-w_con4

# Level-2 consistency  
  b_con1 := varTB1 /b_tau1
  b_con2 := (lamTB1**2*varTB1)/ b_tau2
  b_con3 := varTB2/ b_tau3
  b_con4 := lamTB2**2*varTB2/ b_tau4

# Level-2 rater specificity 
  b_rsp1 := 1-b_con1
  b_rsp2 := 1-b_con2
  b_rsp3 := 1-b_con3
  b_rsp4 := 1-b_con4

# ICCs
  icc1 := b_tau1 /( b_tau1+ w_tau1)
  icc2 := b_tau2 /( b_tau2+ w_tau2)
  icc3 := b_tau3 /( b_tau3+ w_tau3)
  icc4 := b_tau4 /( b_tau4+ w_tau4)

# Reliabilities
  rel1 := ( b_tau1+ w_tau1) /( b_tau1+ w_tau1 + var_eps1) 
  rel2 := ( b_tau2+ w_tau2) /( b_tau2+ w_tau2 + var_eps2)
  rel3 := ( b_tau3+ w_tau3) /( b_tau3+ w_tau3 + var_eps3)
  rel4 := ( b_tau4+ w_tau4) /( b_tau4+ w_tau4 + var_eps4)
"


fit_nested_raters <- sem(ML_CTCM_1_nested_struc_raters, 
                         data = chapter_7_3_2, 
                         estimator="mlr",
                         cluster = "cluster",
                         baseline = FALSE,
                         start = "simple", 
                         #verbose = TRUE
                         )

summary(fit_nested_raters, fit.measures =T, std=T, rsquare=T)

MPlus Code

Download