alishinski / lavaanPlot

R package for plotting lavaan path models with DiagrammeR
http://alexlishinski.com/lavaanPlot/
38 stars 4 forks source link

Error when constraining parameters #30

Closed jorgesinval closed 2 years ago

jorgesinval commented 3 years ago
HS.model3 <- ' visual  =~ x1 + x2 + x3
               textual =~ x4 + x5 + x6
                     higher =~ a*visual + a*textual'

fit6 <- cfa(HS.model3, data = HolzingerSwineford1939, std.lv=T)
summary(object = fit6, std=T)

lavaanPlot(model = fit6,stand=T)

Produces:

Error in `$<-.data.frame`(`*tmp*`, "lhs", value = c("visual", "visual",  : 
  replacement has 18 rows, data has 17
fusiformfacearea commented 3 years ago

I am having this problem as well, setting stand = TRUE causes this error about the replacement having the wrong number of rows

alishinski commented 2 years ago

It seems that using std.lv = T adds an extra row to the ParTable chunk of the lavaan model object. I don't know why it does this, but it makes it not give the same answer. I would suggest that you try omitting the stand=T if you're going to use std.lv = T and see if that gives you what you want. If you're not putting coefs on the plot it should definitely work at the very least.