plotProbe error (Latent moderation analysis and plot)

57 views
Skip to first unread message

Bo WANG

unread,
Jan 12, 2022, 7:36:10 PM1/12/22
to lavaan
Thanks in advance for any help!!!

I was conducting latent moderation analysis and want to plot the results with plotProbe function from the semTools package with the following code:

study2 <- spss.get("sample 2.sav",use.value.labels=TRUE)


moderationsample2 <- indProd(study2,var1 = c("x1","x2","x3","x4"),
                             var2 = c("m1","m2","m3","m4"), match = F,
                             meanC = T)

ModelSample2 <- '
XX =~ x1 + x2 + x3 
MM =~ m1 + m2 + m3
YY =~ y1 + y2 + y3 + y4 

INT =~ x1.m1 + x1.m2 + x1.m3 + x2.m1 + x2.m2 + x2.m3 + x3.m1 + x3.m2 + x3.m3 

XX ~~ 0*INT

MM ~~ 0*INT

YY ~ a*XX + b*MM + INT

x1 + m1 + y1 + x1.m1 ~ 0*1

XX + MM + YY + INT ~ NA*1

'

FitSample2 <- sem(ModelSample2, data = moderationsample2, std.lv = T, estimator = "MLR")

summary(FitSample2, fit = T, standardized = T, rsquare = T)

PlotSample2 <- probe2WayRC(FitSample2, nameX = c("XX", "MM", "INT"), nameY = "YY",
            modVar = "MM", valProbe = c(-1, 0, 1))

plotProbe(PlotSample2, xlim = c(-2, 2))


But it gave a warning message as follows after probe2WayRC function :

Warning messages:
1: In sqrt(varIntcept) : NaNs produced
2: In sqrt(varIntcept) : NaNs produced
3: In sqrt(varSlope) : NaNs produced
4: In sqrt(varSlope) : NaNs produced


So that the final graph looks like this:
7dc2b2df-eb53-44c4-af07-5f7bd5ca8efd.png


Terrence Jorgensen

unread,
Jan 25, 2022, 5:39:51 PM1/25/22
to lavaan
plotProbe(PlotSample2, xlim = c(-2, 2))

You are not fixing the latent mean to 0, so check the distribution of XX to make sure these values are not extrapolations.

lavInspect(FitSample2, "mean.ov")
lavInspect(FitSample2, "cov.ov") # sqrt(diag()) gives the SDs

Also, what does the PlotSample2 output look like?

Terrence D. Jorgensen
Assistant Professor, Methods and Statistics
Research Institute for Child Development and Education, the University of Amsterdam

Reply all
Reply to author
Forward
0 new messages