SachaEpskamp / qgraph

Developmental version of qgraph
GNU General Public License v2.0
68 stars 21 forks source link

"NA/NaN Hessian evaluation" error when calling cor_auto #78

Open SereDef opened 1 year ago

SereDef commented 1 year ago

Hi,

I get the following error when I try to compute a correlation matrix using cor_auto():

Error in nlminb(start = cache$theta, objective = minObjective, gradient = minGradient, : NA/NaN Hessian evaluation

I see this was an issue with earlier versions of lavaan (see this discussion). I am using 0.6-16. Note that the function works on certain subsets of data, but I cannot put my finger on why (note: I have 349 variables in the input df)

Any idea how I could get around this?

`> sessionInfo() R version 4.2.2 (2022-10-31) Platform: x86_64-apple-darwin17.0 (64-bit) Running under: macOS Monterey 12.6.3

Matrix products: default LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib

locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] lavaan_0.6-16 qgraph_1.9.5 `

SachaEpskamp commented 1 year ago

Hi! This is likely a problem with the underlying lavCor function in lavaan. How many observations do you have? 349 is a lot of variables for polychoric correlations...