3 Basic Models for Structurally Different Raters

#### Loading of data set

load("chapter_3.rda")

MPlus data file

R data file

Models of Section 3.2.1

Basic model with correlated factors

R Code

model.corr.fakt.mod<-
'
# Loneliness-self factor
L_self =~ Slon1+Slon2+Slon3 

# Loneliness-parent factor
L_parent =~ Elon1+Elon2+Elon3 

# Loneliness-peer factor
L_peer =~ Plon1+Plon2+Plon3 

# Flourishing-self factor
F_self =~ Sflou1+Sflou2 

# Flourishing-parent factor
F_parent =~ Eflou1+Eflou2 

# Flourishing-peer factor
F_peer =~ Pflou1+Pflou2 
'
model.corr.fakt.fit<-sem(model.corr.fakt.mod,data=chapter_3.dat, meanstructure = TRUE, estimator= "MLR",missing= "fiml")
summary(model.corr.fakt.fit, standardized=TRUE, fit.measures = TRUE, rsquare=TRUE)

MPlus Code

Download

Basic model: Estimation of multiple correlation

R Code

model.corr.fakt.mult.r.mod<-
'
# Loneliness-self factor
L_self =~ Slon1+Slon2+Slon3 

# Loneliness-parent factor
L_parent =~ Elon1+Elon2+Elon3 

# Loneliness-peer factor
L_peer =~ Plon1+Plon2+Plon3 

# Flourishing-self factor
F_self =~ Sflou1+Sflou2 

# Flourishing-parent factor
F_parent =~ Eflou1+Eflou2 

# Flourishing-peer factor
F_peer =~ Pflou1+Pflou2

# Estimation of multiple correlation in
# latent regression models

L_self ~ L_parent+L_peer
F_self ~ F_parent+F_peer
L_self ~ F_self+F_parent+F_peer

F_self ~~ L_parent+L_peer
'
model.corr.fakt.mult.r.fit<-sem(model.corr.fakt.mult.r.mod,data=chapter_3.dat, meanstructure = TRUE, estimator= "MLR",missing= "fiml")
summary(model.corr.fakt.mult.r.fit, standardized=TRUE, fit.measures = TRUE, rsquare=TRUE)

MPlus Code

Download

Models of Section 3.3.1

Basic model with correlated factors and indicator-specific factors

R Code

model.corr.fakt.ind.mod<-
'
# Loneliness-self factor
L_self =~ Slon1+Slon2+Slon3 

# Loneliness-parent factor
L_parent =~ Elon1+Elon2+Elon3 

# Loneliness-peer factor
L_peer =~ Plon1+Plon2+Plon3 

# Flourishing-self factor
F_self =~ Sflou1+Sflou2 

# Flourishing-parent factor
F_parent =~ Eflou1+Eflou2 

# Flourishing-peer factor
F_peer =~ Pflou1+Pflou2

# Indicator-specific factor loneliness 2nd indicator
# Factor causes estimation problems

# L_2 =~ Slon2+Elon2+Plon2
# Factor causes estimation problems

# Indicator-specific factor loneliness 3nd indicator
# Factor causes estimation problems

# L_3 =~ Slon3+Elon3+Plon3

# Indicator-specific factor flourishing 2nd indicator

F_2 =~ Sflou2+Eflou2+Pflou2

# Uncorrelatedness: indicator-specific factors and trait-rater unit factors 
# for the same trait (obligatory)
# Factors causing estimation problems removed

# L_self+L_parent+L_peer ~~ 0*L_2

# L_self+L_parent+L_peer ~~ 0*L_3

F_self+ F_parent+F_peer ~~ 0*F_2

# Uncorrelatedness: indicator-specific factors and trait-rater unit factors 
# for different traits (here: necessary to get appropriate estimates)
# Factors causing estimation problems removed

L_self+L_parent+L_peer ~~ 0*F_2

# F_self+F_parent+F_peer ~~ 0*L_2

# F_self+F_parent+F_peer ~~ 0*L_3

# Uncorrelatedness: indicator-specific factors  
# (here: necessary to get appropriate estimates)
# Factors causing estimation problems removed

# L_2 ~~ 0*L_3

# L_2 ~~ 0*F_2

# L_3 ~~ 0*F_2
'
model.corr.fakt.ind.fit<-sem(model.corr.fakt.ind.mod,data=chapter_3.dat, meanstructure = TRUE, estimator= "MLR",missing= "fiml")
summary(model.corr.fakt.ind.fit, standardized=TRUE, fit.measures = TRUE, rsquare=TRUE)

MPlus Code

Download

Models of Section 3.4

Basic model with configural measurement invariance

R Code

model.corr.fakt.config.mod<-
'
# Loneliness-self factor
L_self =~ Slon1+Slon2+Slon3 

# Loneliness-parent factor
L_parent =~ Elon1+Elon2+Elon3 

# Loneliness-peer factor
L_peer =~ Plon1+Plon2+Plon3 

# Flourishing-self factor
F_self =~ Sflou1+Sflou2 

# Flourishing-parent factor
F_parent =~ Eflou1+Eflou2 

# Flourishing-peer factor
F_peer =~ Pflou1+Pflou2 
'
model.corr.fakt.config.fit<-sem(model.corr.fakt.config.mod,data=chapter_3.dat, meanstructure = TRUE, estimator= "MLR",missing= "fiml")
summary(model.corr.fakt.config.fit, standardized=TRUE, fit.measures = TRUE, rsquare=TRUE)

MPlus Code

Download

Basic model with weak measurement invariance

R Code

model.corr.fakt.weak.mod<-
'
# Loneliness-self factor
L_self =~ Slon1+lon2*Slon2+lon3*Slon3 

# Loneliness-parent factor
L_parent =~ Elon1+lon2*Elon2+lon3*Elon3 

# Loneliness-peer factor
L_peer =~ Plon1+lon2*Plon2+lon3*Plon3 

# Flourishing-self factor
F_self =~ Sflou1+flou2*Sflou2 

# Flourishing-parent factor
F_parent =~ Eflou1+flou2*Eflou2 

# Flourishing-peer factor
F_peer =~ Pflou1+flou2*Pflou2 
'
model.corr.fakt.weak.fit<-sem(model.corr.fakt.weak.mod,data=chapter_3.dat, meanstructure = TRUE, estimator= "MLR",missing= "fiml")
summary(model.corr.fakt.weak.fit, standardized=TRUE, fit.measures = TRUE, rsquare=TRUE)

MPlus Code

Download

Comparison: configural vs. weak measurment invariance

anova(model.corr.fakt.weak.fit,model.corr.fakt.config.fit)

Basic model with strong measurement invariance

R Code

model.corr.fakt.strong.mod<-
'
# Loneliness-self factor
L_self =~ Slon1+lon2*Slon2+lon3*Slon3 

# Loneliness-parent factor
L_parent =~ Elon1+lon2*Elon2+lon3*Elon3 

# Loneliness-peer factor
L_peer =~ Plon1+lon2*Plon2+lon3*Plon3 

# Flourishing-self factor
F_self =~ Sflou1+flou2*Sflou2 

# Flourishing-parent factor
F_parent =~ Eflou1+flou2*Eflou2 

# Flourishing-peer factor
F_peer =~ Pflou1+flou2*Pflou2 

# Intercepts set equal

Slon1~ilon1*1
Elon1~ilon1*1
Plon1~ilon1*1

Slon2~ilon2*1 
Elon2~ilon2*1 
Plon2~ilon2*1

Slon3~ilon3*1 
Elon3~ilon3*1 
Plon3~ilon3*1

Sflou1~iflou1*1 
Eflou1~iflou1*1
Pflou1~iflou1*1

Sflou2~iflou2*1
Eflou2~iflou2*1 
Pflou2~iflou2*1

# Factor Means the factor means of one method (here: self)
# have to be restricted to 0 (default)
# the factor means of all other methods can be estimated

L_parent~1
L_peer~1 
F_parent~1 
F_peer~1
'
model.corr.fakt.strong.fit<-sem(model.corr.fakt.strong.mod,data=chapter_3.dat, meanstructure = TRUE, estimator= "MLR",missing= "fiml")
summary(model.corr.fakt.strong.fit, standardized=TRUE, fit.measures = TRUE, rsquare=TRUE)

MPlus Code

Download

Comparison: weak vs. strong measurement invariance

anova(model.corr.fakt.strong.fit,model.corr.fakt.weak.fit)

Basic model with strict measurement invariance

R Code

model.corr.fakt.strict.mod<-
  '
# Loneliness-self factor
L_self =~ Slon1+lon2*Slon2+lon3*Slon3 

# Loneliness-parent factor
L_parent =~ Elon1+lon2*Elon2+lon3*Elon3 

# Loneliness-peer factor
L_peer =~ Plon1+lon2*Plon2+lon3*Plon3 

# Flourishing-self factor
F_self =~ Sflou1+flou2*Sflou2 

# Flourishing-parent factor
F_parent =~ Eflou1+flou2*Eflou2 

# Flourishing-peer factor
F_peer =~ Pflou1+flou2*Pflou2 

# Intercepts set equal

Slon1~ilon1*1
Elon1~ilon1*1
Plon1~ilon1*1

Slon2~ilon2*1 
Elon2~ilon2*1 
Plon2~ilon2*1

Slon3~ilon3*1 
Elon3~ilon3*1 
Plon3~ilon3*1

Sflou1~iflou1*1 
Eflou1~iflou1*1
Pflou1~iflou1*1

Sflou2~iflou2*1
Eflou2~iflou2*1 
Pflou2~iflou2*1

# Factor Means the factor means of one method (here: self)
# have to be restricted to 0 (default)
# the factor means of all other methods can be estimated

L_parent~1
L_peer~1 
F_parent~1 
F_peer~1

# Error variances

Slon1~~vlon1*Slon1
Elon1~~vlon1*Elon1
Plon1~~vlon1*Plon1 

Slon2~~vlon2*Slon2
Elon2~~vlon2*Elon2
Plon2~~vlon2*Plon2

Slon3~~vlon3*Slon3
Elon3~~vlon3*Elon3
Plon3~~vlon3*Plon3

Sflou1~~vflour1*Sflou1
Eflou1~~vflour1*Eflou1
Pflou1~~vflour1*Pflou1 

Sflou2~~vflour2*Sflou2
Eflou2~~vflour2*Eflou2
Pflou2~~vflour2*Pflou2

'
model.corr.fakt.strict.fit<-sem(model.corr.fakt.strict.mod,data=chapter_3.dat, meanstructure = TRUE, estimator= "MLR",missing= "fiml")
summary(model.corr.fakt.strict.fit, standardized=TRUE, fit.measures = TRUE, rsquare=TRUE)

MPlus Code

Download

Comparison: strong vs. strict measurement invariance

anova(model.corr.fakt.strict.fit,model.corr.fakt.strong.fit)

Basic model with strong measurement invariance and equal factor means

R Code

model.corr.fakt.strong.equal.mean.mod<-
'
# Loneliness-self factor
L_self =~ Slon1+lon2*Slon2+lon3*Slon3 

# Loneliness-parent factor
L_parent =~ Elon1+lon2*Elon2+lon3*Elon3 

# Loneliness-peer factor
L_peer =~ Plon1+lon2*Plon2+lon3*Plon3 

# Flourishing-self factor
F_self =~ Sflou1+flou2*Sflou2 

# Flourishing-parent factor
F_parent =~ Eflou1+flou2*Eflou2 

# Flourishing-peer factor
F_peer =~ Pflou1+flou2*Pflou2 

# Intercepts set equal

Slon1~ilon1*1
Elon1~ilon1*1
Plon1~ilon1*1

Slon2~ilon2*1 
Elon2~ilon2*1 
Plon2~ilon2*1

Slon3~ilon3*1 
Elon3~ilon3*1 
Plon3~ilon3*1

Sflou1~iflou1*1 
Eflou1~iflou1*1
Pflou1~iflou1*1

Sflou2~iflou2*1
Eflou2~iflou2*1 
Pflou2~iflou2*1

# Factor Means the factor means of one method (here: self)
# have to be restricted to 0 (default)
# the factor means of all other methods can be estimated

# Equal factor means
# default: All factor means are 0
# L_parent~1
# L_peer~1 
# F_parent~1 
# F_peer~1
'
model.corr.fakt.strong.equal.mean.fit<-sem(model.corr.fakt.strong.equal.mean.mod,data=chapter_3.dat, meanstructure = TRUE, estimator= "MLR",missing= "fiml")
summary(model.corr.fakt.strong.equal.mean.fit, standardized=TRUE, fit.measures = TRUE, rsquare=TRUE)

MPlus Code

Download

Comparison: strong measurement invariance with equal factor means vs. strong measurement invariance

anova(model.corr.fakt.strong.equal.mean.fit,model.corr.fakt.strong.fit)

Basic model with strong measurement invariance and equal factor variances

R Code

model.corr.fakt.strong.equal.var.mod<-
  '
# Loneliness-self factor
L_self =~ Slon1+lon2*Slon2+lon3*Slon3 

# Loneliness-parent factor
L_parent =~ Elon1+lon2*Elon2+lon3*Elon3 

# Loneliness-peer factor
L_peer =~ Plon1+lon2*Plon2+lon3*Plon3 

# Flourishing-self factor
F_self =~ Sflou1+flou2*Sflou2 

# Flourishing-parent factor
F_parent =~ Eflou1+flou2*Eflou2 

# Flourishing-peer factor
F_peer =~ Pflou1+flou2*Pflou2 

# Intercepts set equal

Slon1~ilon1*1
Elon1~ilon1*1
Plon1~ilon1*1

Slon2~ilon2*1 
Elon2~ilon2*1 
Plon2~ilon2*1

Slon3~ilon3*1 
Elon3~ilon3*1 
Plon3~ilon3*1

Sflou1~iflou1*1 
Eflou1~iflou1*1
Pflou1~iflou1*1

Sflou2~iflou2*1
Eflou2~iflou2*1 
Pflou2~iflou2*1

# Factor Means the factor means of one method (here: self)
# have to be restricted to 0 (default)
# the factor means of all other methods can be estimated

L_parent~1
L_peer~1 
F_parent~1 
F_peer~1

# equal factor variances

L_self~~fvarlon*L_self 
L_parent~~fvarlon*L_parent
L_peer~~fvarlon*L_peer 

F_self~~fvarflour*F_self 
F_parent~~fvarflour*F_parent
F_peer~~fvarflour*F_peer

'
model.corr.fakt.strong.equal.var.fit<-sem(model.corr.fakt.strong.equal.var.mod,data=chapter_3.dat, meanstructure = TRUE, estimator= "MLR",missing= "fiml")
summary(model.corr.fakt.strong.equal.var.fit, standardized=TRUE, fit.measures = TRUE, rsquare=TRUE)

MPlus Code

Download

Comparison: strong measurement invariance with equal factor variances and covarince vs. strong measurement invariance

anova(model.corr.fakt.strong.equal.var.fit,model.corr.fakt.strong.fit)

Basic model with strong measurement invariance: Agreement calculation

R Code

agreement.mod<-
  '
# Loneliness-self factor
L_self =~ Slon1+lon2*Slon2+lon3*Slon3 

# Loneliness-parent factor
L_parent =~ Elon1+lon2*Elon2+lon3*Elon3 

# Loneliness-peer factor
L_peer =~ Plon1+lon2*Plon2+lon3*Plon3 

# Flourishing-self factor
F_self =~ Sflou1+flou2*Sflou2 

# Flourishing-parent factor
F_parent =~ Eflou1+flou2*Eflou2 

# Flourishing-peer factor
F_peer =~ Pflou1+flou2*Pflou2 

# Intercepts set equal

Slon1~ilon1*1
Elon1~ilon1*1
Plon1~ilon1*1

Slon2~ilon2*1 
Elon2~ilon2*1 
Plon2~ilon2*1

Slon3~ilon3*1 
Elon3~ilon3*1 
Plon3~ilon3*1

Sflou1~iflou1*1 
Eflou1~iflou1*1
Pflou1~iflou1*1

Sflou2~iflou2*1
Eflou2~iflou2*1 
Pflou2~iflou2*1

# Factor Means the factor means of one method (here: self)
# have to be restricted to 0 (default)
# the factor means of all other methods can be estimated

# Estimation of Agreement (CCC coefficient)

  # Labeling of means, not necessary for self-report
  # because self-report means were set to 0
  L_parent~lpam*1
  L_peer~lpem*1
  F_parent~fpam*1
  F_peer~fpem*1;

  # Labeling of variances
  L_self ~~ lsv*L_self
  L_parent ~~ lpav*L_parent
  L_peer ~~ lpev*L_peer
  F_self ~~ fsv*F_self
  F_parent ~~ fpav*F_parent
  F_peer ~~ fpev*F_peer

  ! Labeling of covariances
  L_self ~~ lspac*L_parent
  L_self ~~ lspec*L_peer 
  L_parent ~~ lpapec*L_peer
  F_self ~~ fspac*F_parent 
  F_self ~~ fspec*F_peer 
  F_parent ~~ fpapec*F_peer 



# Calcuation of CCC
ccc_lspa := (2*lspac)/(lpam^2+lsv+lpav)
ccc_lspe := (2*lspec)/(lpem^2+lsv+lpev)
ccc_lpape := (2*lpapec)/((lpam-lpem)^2+lpav+lpev)
ccc_fspa := (2*fspac)/(fpam^2+fsv+fpav)
ccc_fspe := (2*fspec)/(fpem^2+fsv+fpev)
ccc_fpape := (2*fpapec)/((fpam-fpem)^2+fpav+fpev)
'
agreement.fit<-sem(agreement.mod,data=chapter_3.dat, meanstructure = TRUE, estimator= "ML",missing= "fiml", se="bootstrap", bootstrap=1000,)
summary(agreement.fit, standardized=TRUE, fit.measures = TRUE, rsquare=TRUE)
parameterEstimates(agreement.fit, boot.ci.type = "bca.simple")

MPlus Code

Download