problem with ordered factors: Error in Delta.group[, x.el.idx[[mm]]] <- DELTA

31 views
Skip to first unread message

Manolo Cabran

unread,
Nov 24, 2019, 5:44:52 AM11/24/19
to lavaan
Hi all, 
re-posting as a new topic. 

PS.
The suggestion on dummyfying ordered categorical has already been brought to my attention by Terrence D. Jorgensen, whom I thank.

hi, I am having a similar problem with ordinal data. lavaan version: 0.6-5

this is the error message i get:

> cc_fit_r <- lavaan::cfa(cc_model_r, data = cc, ordered = c("gend", "disab", "orph", "sol", "edu"), conditional.x = FALSE, std.lv = FALSE)
Error in Delta.group[, x.el.idx[[mm]]] <- DELTA :
  number of items to replace
is not a multiple of replacement length
In addition: Warning messages:
1: In th[th.idx > 0L] <- TAU[, 1L] :
  number of items to replace
is not a multiple of replacement length
2: In WLS.obs - WLS.est :
  longer
object length is not a multiple of shorter object length
3: In diff * diff * WLS.VD :
  longer
object length is not a multiple of shorter object length
4: In th[th.idx > 0L] <- TAU[, 1L] :
  number of items to replace
is not a multiple of replacement length


And this is my model:


cc_model_r <- '
cc =~ a*edu + b*sol # 2 reflective items to identify the formative construct
cc <~ c*age + d*gend + e*disab + f*orph # formative construct
'


Data can be retrieved here.

I suspected the issue might be related to NAs. A crosstab revealed that there are 12 NAS between edu and sol and 85 NAs between sol and gend. I tried re-fitting the model using the argument missing = "pairwise", but unsuccessfully.

Regards

Manolo

Terrence Jorgensen

unread,
Nov 25, 2019, 6:11:31 AM11/25/19
to lavaan
The suggestion on dummyfying ordered categorical has already been brought to my attention 
 
That is not what your syntax below does.  Have you tried using dummy codes for your predictors yet, to avoid this issue?

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