Strictly Positive Satorra-Bentler Chi Square Test

99 views
Skip to first unread message

Kristine O'Laughlin

unread,
Nov 14, 2020, 12:49:16 AM11/14/20
to lavaan
Hello,

I'm attempting to compute the strictly positive Satorra-Bentler chi-square test to compare 2- and 3-factor models of executive function. The two models converge in lavaan, but when I attempt to run the test I get the following error message:

> lavTestLRT(m1, m0, method = 'satorra.bentler.2010')
Error in colSums(S) : 'x' must be an array of at least two dimensions

The code I am using in lavaan is below:

m0 = '
WM =~ NA*BSS3 + NA*FSS3 + NA*LTRS3 + NA*SPRS3 
AC =~ NA*SSUS3 + NA*SIMP3 + NA*TNT3 
IR =~ NA*STRP3 + NA*FLNK3 + NA*TKSW3 + NA*BOX3

# (Co)variances
WM ~~ a*IR
WM ~~ 1*AC
IR ~~ a*AC
WM ~~ 1*WM
AC ~~ 1*AC
IR ~~ 1*IR
BSS3 ~~ BSS3
FSS3 ~~ FSS3
LTRS3 ~~ LTRS3
SPRS3 ~~ SPRS3
SSUS3 ~~ SSUS3
SIMP3 ~~ SIMP3
TNT3 ~~ TNT3
FLNK3 ~~ FLNK3
STRP3 ~~ STRP3
TKSW3 ~~ TKSW3
BOX3 ~~ BOX3

# Intercepts
WM ~ 0*1
IR ~ 0*1
AC ~ 0*1
BSS3 ~ 1
FSS3 ~ 1
LTRS3 ~ 1
SPRS3 ~ 1
SSUS3 ~ 1
SIMP3 ~ 1
TNT3 ~ 1
FLNK3 ~ 1
STRP3 ~ 1
TKSW3 ~ 1
BOX3 ~ 1
'

m1 = '
WM =~ NA*BSS3 + NA*FSS3 + NA*LTRS3 + NA*SPRS3 
AC =~ NA*SSUS3 + NA*SIMP3 + NA*TNT3 
IR =~ NA*STRP3 + NA*FLNK3 + NA*TKSW3 + NA*BOX3

# (Co)variances
WM ~~ IR
WM ~~ AC
IR ~~ AC
WM ~~ 1*WM
AC ~~ 1*AC
IR ~~ 1*IR
BSS3 ~~ BSS3
FSS3 ~~ FSS3
LTRS3 ~~ LTRS3
SPRS3 ~~ SPRS3
SSUS3 ~~ SSUS3
SIMP3 ~~ SIMP3
TNT3 ~~ TNT3
FLNK3 ~~ FLNK3
STRP3 ~~ STRP3
TKSW3 ~~ TKSW3
BOX3 ~~ BOX3

# Intercepts
WM ~ 0*1
IR ~ 0*1
AC ~ 0*1
BSS3 ~ 1
FSS3 ~ 1
LTRS3 ~ 1
SPRS3 ~ 1
SSUS3 ~ 1
SIMP3 ~ 1
TNT3 ~ 1
FLNK3 ~ 1
STRP3 ~ 1
TKSW3 ~ 1
BOX3 ~ 1
'

m0 = cfa(m0, data = sub, estimator = 'MLR', missing = 'ML')
m1 = cfa(m1, data = sub, estimator = 'MLR', missing = 'ML')

summary(m0, standardized = T)
summary(m1, standardized = T)

lavTestLRT(m1, m0, method = 'satorra.bentler.2010')

I greatly appreciate any guidance on how I may resolve this issue.

Thank you,
Kristine 

Terrence Jorgensen

unread,
Nov 14, 2020, 4:27:43 PM11/14/20
to lavaan
Error in colSums(S) : 'x' must be an array of at least two dimensions

Never seen this error before, but I wonder whether it would still occur if you didn't use the same object names for your syntax and model:
 
m0 = cfa(m0, data = sub, estimator = 'MLR', missing = 'ML')
m1 = cfa(m1, data = sub, estimator = 'MLR', missing = 'ML')

Because the strictly-positive method requires re-fitting one model holding parameters constant at estimates from the other model, I think it is trying to re-use the call stored within the lavaan object.  So try storing the result under a different name than the syntax object (which might need to be used in the call again).

fit0 <- cfa(m0, ...)
fit1 <- cfa(m1, ...)

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

Kristine O'Laughlin

unread,
Nov 14, 2020, 5:05:30 PM11/14/20
to lavaan
Ahh, sloppy coding on my part :( I did try to rename the fitted objects (and then also the models, in case "m0" and "m1" are also used in the lavTestLRT function), but I am still getting the same error unfortunately.

Thank you for your help on this!
Kristine

Terrence Jorgensen

unread,
Nov 16, 2020, 9:43:23 AM11/16/20
to lavaan
Can you provide a minimal script and some data to reproduce the error?

Kristine O'Laughlin

unread,
Nov 18, 2020, 9:20:46 PM11/18/20
to lav...@googlegroups.com
I wasn't able to get permission to share a subset of the actual data (at least not quickly), so I went ahead and simulated some data according to properties of the real data. I am still getting the same error when I attempt to use method = 'satorra.bentler.2010' (method = 'satorra.bentler.2001' seems to run fine, however). The simulated data and minimal script are attached.

Also, I don't think it matters for troubleshooting this, but I wanted to note that the SB statistic computed in the normal way comes out negative when using the real data (which is why I'm attempting to compute the strictly positive statistic) but is positive when using the simulated data set.

Thank you again!
Kristine 


--
You received this message because you are subscribed to a topic in the Google Groups "lavaan" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/lavaan/r_RzfsJQRR8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to lavaan+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lavaan/27f3f127-a5c3-4cc9-94ae-816ca7b60575n%40googlegroups.com.
EF_FitSimData_2020-11-17.R
EF_SimData_2020-11-17.csv
Reply all
Reply to author
Forward
0 new messages