atahk / pscl

Political Science Computational Laboratory
65 stars 14 forks source link

Error in zeroinfl() object 'model_count' not found #11

Closed ThijsZwi closed 1 year ago

ThijsZwi commented 4 years ago

Hello!

A few days ago i was running a different ZINB model which ran perfectly fine. However, today i wrote a different model, same variables, but somehow it doesn't run anymore and gives a strange error. Proposed model:

ex1zinb <- zeroinfl(X1 ~ Y1 + M1 | Y1 + M1, data = mydata, dist="negbin", EM= TRUE)

Error: Error in zeroinfl(Y1 ~ X1 + M1 | X1 + : object 'model_count' not found

So i tried the ZINB model that ran a few days ago, but suddenly i encounter the same problem, even though it are the same variables and dataset, so the model does not convert anymore. I had some issues with installing other packages, so i reinstalled the packages involved in the whole script. Then i tried to run it solely with the pscl library loaded but it gave me the same error. If i look into the pscl zeroinfl source code there is also an object called model_count, therefore i am thinking it is somehow related to this package. Curious thing is that if i delete EM=TRUE, it does somehow run, but only providing estimate outcomes and nothing else.

Do you have any clue what i possibly did wrong or if should somehow re-install pscl in a different way?

Thanks in advance! Thijs

ThijsZwi commented 4 years ago

Problem solved:

I switched back to an earlier version of R that i was using (3.4) and the code and model ran perfectly fine. I updated yesterday to 3.6.3, so maybe that is the problem. Regardless, i will close this issue. Thanks for developing this package!

ThijsZwi commented 4 years ago

I updated to R version 4.0 and somehow this error keeps popping up. I have the newest version of pscl also installed. I updated since i saw that i was using PSCL 1.5.2. and a very simple zeroinfl() ran for ages without converging (even though it used to converge). Do you maybe have any idea what could be the issue?

ThijsZwi commented 4 years ago

At first i thought it was maybe due to the model itself, so i tried a different package for my zero inflation model (glmmTMB). This model did ran, so could it be that i have some issues with pscl itself?

magdalenauj commented 4 years ago

Hello, I've been having the same issue! New to the pscl, but would be extremely helpful to know if someone managed to work around this!

maticjancic commented 2 years ago

This error appears when you include "EM = TRUE" argument. By removing it the function works. Also, could not find the description of the argument in the function documentation, so it might be from the earlier version of the package/function.

zmeers commented 1 year ago

This issue has been solved in the most recent merge to the master branch, so I'll close the issue. @maticjancic EM = TRUE is passed to thezeroinfl.control() function which does document that argument. The zeroinfl function docs could be made clearer though by inheriting the function arguments, I agree.