0

I am a beginner and trying to make a structural equation modeling via penalized likelihood. I wrote the just same code as the paper by Dr. Huang, but when I ran the code in Rstudio, I received errors. The code is available online (https://www.jstatsoft.org/article/view/v093i07 Line109-118).

I appreciate any help you can give me in solving this issue.

Pasted the scripts and errors below:

library("lslx")
library("lavaan")

model_fa <- "
  visual =~ x1 + x2 + x3
  textual =~ x4 + x5 + x6
  speed =~ x7 + x8 + x9
  pen() * visual =~ x4 + x5 + x6 + x7 + x8 + x9
  pen() * textual =~ x1 + x2 + x3 + x7 + x8 + x9
  pen() * speed =~ x1 + x2 + x3 + x4 + x5 + x6
  visual  ~~ 1 * visual
  textual ~~ 1 * textual
  speed   ~~ 1 * speed"

lav.out<-cfa(HolzingerSwineford1939,model=model_fa,missing="listwise")

Error in if (op == "=~" && lhs.names[l] == names(out)[j]) { : missing value where TRUE/FALSE needed In addition: Warning message: In is.na(mod) : is.na() applied to non-(list or vector) of type 'language'

Yuuri
  • 1
  • 1
  • Can you make your post [reproducible](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example)? Where does `HolzingerSwineford1939` come from? – jrcalabrese Feb 23 '23 at 13:48

0 Answers0