Could you add an option to stop lavaan2mirt from estimating a covariance matrix when one is not specified in the lavaan model?
It seems like an odd default and it caused problems for me, exemplified by this cryptic error:
> lavaan2mirt(data, lavaan_model, poly.itemtype="graded", est.mirt=TRUE)
Error in chol.default(gp$gcov) :
the leading minor of order 1 is not positive definite
I added the %>% gsub("_", "", .) to both the model and the dataset because I get Error in TAM::lavaanify.IRT(lavmodel, data = dat) : Please do not use _ in variable names in tamaan() function! without it.
Now that I look at it, it also seems odd that ML3 for example is [3,] "ML3" "16,17,18,19", when it is ML3 =~ dss_1 + dss_2 + dss_8 + dss_9 in lavaan form. The dataset has them ordered from col 1 to 20, so I would expect it to be [3,] "ML3" "1,2,8,9". Wouldn't it be easier to just the variable names since mirt.model accepts this? Then itemnames= could be passed as an argument too.
If it's any use, I generated the above lavaan model using psych::efa_to_cfa()
Thanks for the great and otherwise very useful package!
Could you add an option to stop
lavaan2mirt
from estimating a covariance matrix when one is not specified in the lavaan model?It seems like an odd default and it caused problems for me, exemplified by this cryptic error:
where lavaan_model is simply
The
$mirt.syntax
withest.mirt=FALSE
isI added the
%>% gsub("_", "", .)
to both the model and the dataset because I getError in TAM::lavaanify.IRT(lavmodel, data = dat) : Please do not use _ in variable names in tamaan() function!
without it.Now that I look at it, it also seems odd that ML3 for example is
[3,] "ML3" "16,17,18,19"
, when it isML3 =~ dss_1 + dss_2 + dss_8 + dss_9
in lavaan form. The dataset has them ordered from col 1 to 20, so I would expect it to be[3,] "ML3" "1,2,8,9"
. Wouldn't it be easier to just the variable names since mirt.model accepts this? Thenitemnames=
could be passed as an argument too.If it's any use, I generated the above lavaan model using
psych::efa_to_cfa()
Thanks for the great and otherwise very useful package!