Error when excluding a specific variable from a model

20 views
Skip to first unread message

Curtis Atkisson

unread,
Mar 6, 2025, 2:40:36 PMMar 6
to blavaan
This error is mystifying me. Use the attached data. Use this model

past.single.model <- 'hold =~ x1 + x2 + x3 + x4 + x5
'
fit like this

past.single <- bcfa(past.single.model, data = test, bcontrol = list(cores = 3),
                    ordered = c("x1", "x2", "x3", "x4", "x5"))

Everything fits and is great. I can then remove any variable from the model I want *except* x2. Whenever I remove x2, I get the following error:
Error in eval(mc, parent.frame()) :
  Exception: mismatch in number dimensions declared and found in context; processing stage=data initialization; variable name=Nordobs; dims declared=(1); dims found=() (in 'string', line 517, column 2 to column 33)

And sampling isn't done. Any clue what is going on here?

Thanks!
example-data-error.csv

Ed Merkle

unread,
Mar 6, 2025, 6:54:17 PMMar 6
to Curtis Atkisson, blavaan
Thanks for the report. This is the sort of error that happens when something that is usually a vector becomes a scalar for a particular model. blavaan should have caught this already, and I should be able to fix it pretty easily.

Ed
--
You received this message because you are subscribed to the Google Groups "blavaan" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blavaan+u...@googlegroups.com.

Ed Merkle

unread,
Mar 7, 2025, 2:35:15 PMMar 7
to blavaan
I believe that this problem is now fixed on github. It was an edge case related to missing data patterns: if you remove x2, then there is either all complete data or all incomplete data on the remaining variables. The "all incomplete data" rows are excluded, but blavaan was still treating it as a dataset with one missing data pattern.

Thanks for the report,
Ed
Reply all
Reply to author
Forward
0 new messages