Error in TEST[[2]] : subscript out of bounds

438 views
Skip to first unread message

maryam

unread,
Apr 9, 2019, 6:27:43 AM4/9/19
to lavaan
Hi,

I'm using a code in lavaan that I used yesterday also; yesterday it worked fine without error; today it gives the error "subscript out of bound"; I was wondering if I'm doing something wrong that I don't know or is there a bug/issue?

My code:

library(lavaan)

data<- read.csv("wmlex22.csv", header=TRUE)

lex.model<- 'group1=~ mattr + mtld + vocd + ndwerz + ndwesz + msttr + hdd + logttr + rttr + uber + maas + lv + nv + vv1 + vv2 + cvv1 + adjv + ld
     group2=~ ls1 + ls2 + vs2 + cvs1'

fit<- sem(lex.model, data, sample.nobs=210, estimator = "MLM")

summary(fit, ci = TRUE, fit.measures=TRUE, standardized = TRUE)

lavaan 0.6-3 ended normally after 376 iterations

  Optimization method                           NLMINB
  Number of free parameters                         45

  Number of observations                           210

  Estimator                                         ML
  Model Fit Test Statistic                    4030.704
  Degrees of freedom                               208
  P-value (Chi-square)                           0.000
Error in TEST[[2]] : subscript out of bounds

PD

unread,
Apr 9, 2019, 6:37:11 AM4/9/19
to lavaan
Try renaming your 'data' object to something else (maybe mydata) then depending on whether or not you are reading in a variance-covariance matrix or raw data try:


fit<- sem(lex.model, sample.cov = mydata, sample.nobs=210, estimator = "MLM")
fit<- sem(lex.model, data = mydata, estimator = "MLM")

maryam

unread,
Apr 9, 2019, 6:43:26 AM4/9/19
to lavaan
Hi PD,

I changed the name, it doesn't work. It still gives the same error and doesn't produce the rest of values/estimates just as above message! I even closed the R Studio and restarted it again, that also doesn't work! Any suggestion?

Terrence Jorgensen

unread,
Apr 10, 2019, 8:41:52 AM4/10/19
to lavaan
data<- read.csv("wmlex22.csv", header=TRUE)

posting the data would be necessary to reproduce the error, unless you can provide code for simulated data that produces the same error.

Any suggestion?

See if the error still occurs in the development version:

install.packages("lavaan", repos = "http://www.da.ugent.be", type = "source")

Terrence D. Jorgensen
Assistant Professor, Methods and Statistics
Research Institute for Child Development and Education, the University of Amsterdam
http://www.uva.nl/profile/t.d.jorgensen

Reply all
Reply to author
Forward
0 new messages