In delivering a class on interactions with factors, I am using the data from the Mplus manual example 5.13, 500 simulated multinormal observations on 4 factors with an interaction between factors 1 and 2. There are 3 indicators for each of factors 1 - 4, but I thought to shorten the syntax by omitting factor 4. I used a matching approach in creating product indicators for the interaction factor, f1xf2. I used semTools::indProd() with double mean centering, and the simulated data also involves a near-0 correlation between f1xf2 and the factors f1 and f2.
To illustrate a test of nested models, I specified one model where the regression parameter for the interaction factor is free ("model1base") and another where it is fixed to 0 ("model0"), and then used lavtestLRT() to compare results. And that is where I got an interesting message:
> lavTestLRT(model0.out,model1base.out)
Scaled Chi-Squared Difference Test (method = “satorra.bentler.2001”)
lavaan NOTE:
The “Chisq” column contains standard test statistics, not the
robust test that should be reported per model. A robust difference
test is a function of two standard (not robust) statistics.
Df AIC BIC Chisq Chisq diff Df diff Pr(>Chisq)
model1base.out 14 14282 14374 8.0963
model0.out 15 14302 14391 30.5278 1
Warning message:
In lav_test_diff_SatorraBentler2001(mods[[m]], mods[[m + 1]]) :
lavaan WARNING: scaling factor is negative
Here are the results reported for each model separately:
Model Test User Model:
Standard Robust
Test Statistic 8.096 6.349
Degrees of freedom 14 14
P-value (Chi-square) 0.884 0.957
Scaling correction factor 1.275
Yuan-Bentler correction (Mplus variant)
Model Test User Model:
Standard Robust
Test Statistic 30.528 25.865
Degrees of freedom 15 15
P-value (Chi-square) 0.010 0.039
Scaling correction factor 1.180
Yuan-Bentler correction (Mplus variant)
I don't know exactly what to make of the warning. I don't think that I should post the Mplus data, but my syntax is below.
--Ed Rigdon
file<-file.choose()
data<-read.csv(file)
str(data)
## Use indProd function to create product indicators
library(semTools)
# Use matching
dataplus.match<-indProd(data=data,var1=c(1:3),var2=c(4:6),match=T,doubleMC = T,
namesProd = c("y13","y14","y15)"))
str(dataplus.match)
## Basic interaction model with factors
model1base <-'
f1 =~ y1 + y2 + y3
f2 =~ y4 + y5 + y6
f3 =~ y7 + y8 + y9
f1xf2 =~ y13 + y14 + y15
f3 ~ f1 + f2 + f1xf2
'
library(lavaan)
# Estimate using MLR because of nonnormality
model1base.out<-sem(model=model1base,data=dataplus.match,estimator="MLR")
summary(model1base.out)
## Interaction model with interaction fixed to 0
model0 <-'
f1 =~ y1 + y2 + y3
f2 =~ y4 + y5 + y6
f3 =~ y7 + y8 + y9
f1xf2 =~ y13 + y14 + y15
f3 ~ f1 + f2 + 0*f1xf2
'
# Estimate nested no-interaction model and conduct chi-square test
model0.out<-sem(model=model0,data=dataplus.match,estimator="MLR")
summary(model0.out)
lavTestLRT(model0.out,model1base.out)