probe3WayMC, can't get it to produce the simple intercepts

25 views
Skip to first unread message

Melvin Sim

unread,
Apr 29, 2020, 3:31:49 PM4/29/20
to lavaan
Hello everyone,

I fit the model below:
##Create product terms

stumain.df3$gxb1<-with(stumain.df3, STgrit1cent * STbelong1cent)
stumain.df3$gxb2<-with(stumain.df3, STgrit2cent * STbelong4cent)
stumain.df3$gxb3<-with(stumain.df3, STgrit3cent * STbelong6cent)

stumain.df3$gxs1<-with(stumain.df3, STgrit1cent * PAReduyearscent)
stumain.df3$gxs2<-with(stumain.df3, STgrit2cent * PARjobindexcent)
stumain.df3$gxs3<-with(stumain.df3, STgrit3cent * homeposcent)

stumain.df3$sxb1<-with(stumain.df3, PAReduyearscent * STbelong1cent)
stumain.df3$sxb2<-with(stumain.df3, PARjobindexcent * STbelong4cent)
stumain.df3$sxb3<-with(stumain.df3, homeposcent * STbelong6cent)

stumain.df3$gxbxs1<-with(stumain.df3, STgrit1cent * STbelong1cent * PAReduyearscent)
stumain.df3$gxbxs2<-with(stumain.df3, STgrit2cent * STbelong4cent * PARjobindexcent)
stumain.df3$gxbxs3<-with(stumain.df3, STgrit3cent * STbelong6cent * homeposcent)

##Threeway interaction model
st.ach7<-'
math =~ pv1m + pv2m + pv3m + pv4m + pv5m + pv6m + pv7m + pv8m + pv9m + pv10m
ses =~ PAReduyearscent + PARjobindexcent + homeposcent
grit =~ STgrit1cent + STgrit2cent + STgrit3cent + STgrit4cent
belong =~ STbelong1cent + STbelong2cent + STbelong3cent + STbelong4cent + STbelong5cent + STbelong6cent
##Interaction terms
gxs =~ gxs1 + gxs2 + gxs3
gxb =~ gxb1 + gxb2 + gxb3
sxb =~ sxb1 + sxb2 + sxb3
gxbxs =~ gxbxs1 + gxbxs2 + gxbxs3

##Covariance
grit ~~ cgxs*ses
grit ~~ cgxb*belong
ses ~~ csxb*belong

##Fix latent variable cov with interact at 0
grit ~~ NA*gxs
grit ~~ NA*gxb
grit ~~ NA*gxbxs
ses ~~ NA*gxs
ses ~~ NA*sxb
ses ~~ NA*gxbxs
belong ~~ NA*gxb
belong ~~ NA*sxb
belong ~~ NA*gxbxs
gxs ~~ NA*gxbxs
gxb ~~ NA*gxbxs
sxb ~~ NA*gxbxs

##Intercepts of int terms
gxs ~ cgxs*1
gxb ~ cgxb*1
sxb ~ csxb*1
gxbxs ~ cgxbxs*1

##Intercepts on Latent var
ses ~ NA*1
grit ~ NA*1
belong ~ NA*1

#Intercept of items fix to 0
pv1m ~ 0*1
pv2m ~ NA*1
pv3m ~ NA*1
pv4m ~ NA*1
pv5m ~ NA*1
pv6m ~ NA*1
pv7m ~ NA*1
pv8m ~ NA*1
pv9m ~ NA*1
pv10m ~ NA*1

PAReduyearscent ~ 0*1
PARjobindexcent ~ NA*1
homeposcent ~ NA*1

STgrit1cent ~ 0*1
STgrit2cent ~ NA*1
STgrit3cent ~ NA*1
STgrit4cent ~ NA*1

STbelong1cent ~ 0*1
STbelong2cent ~ NA*1
STbelong3cent ~ NA*1
STbelong4cent ~ NA*1
STbelong5cent ~ NA*1
STbelong6cent ~ NA*1

gxs1 ~ 0*1
gxs2 ~ NA*1
gxs3 ~ NA*1

gxb1 ~ 0*1
gxb2 ~ NA*1
gxb3 ~ NA*1

sxb1 ~ 0*1
sxb2 ~ NA*1
sxb3 ~ NA*1

gxbxs1 ~ 0*1
gxbxs2 ~ NA*1
gxbxs3 ~ NA*1

##Latent regressions
grit ~ ses
belong ~ ses
math ~ grit + ses + belong + gxs + gxb + sxb + gxbxs
'

st.ach7.fit<-sem(st.ach7, data=stumain.df3, meanstructure =T)
summary(st.ach7.fit, standardized = T, fit.measures = T)

st.ach7.probe<-probe3WayMC(st.ach7.fit, c("grit","ses","belong","gxs","gxb","sxb","gxbxs"), "math" ,c("ses","belong") ,
                           valProbe1 = c(-0.379*2,-0.379,0,0.379,0.379*2), valProbe2 = c(-0.7301,0,0.7301))

I am however unable to the probe3WayMC function to produce the simple intercepts of the model. Is there something wrong with my syntax? I am able to get a model that converges.

Melvin Sim

Alex Schoemann

unread,
Apr 30, 2020, 10:53:20 AM4/30/20
to lavaan
Hi Melvin,

I'd double check your output to make sure you're estimating all the latent means you plan to. It looks like the latent mean (really intercept here) for math isn't estimated in the syntax. That's likely leading to the issue you're seeing.

Alex

Melvin Sim

unread,
Apr 30, 2020, 12:25:11 PM4/30/20
to lavaan
Hi Alex,
Yes you were right indeed! Thank you so much for your help!

Melvin
Reply all
Reply to author
Forward
0 new messages