我正在建立一个中介的零膨胀负二项(ZINB)模型。我正在遵循O‘’Rourke& Vazquez (2019)的步骤--> https://www.sciencedirect.com/science/article/abs/pii/S0306460319301078
几天前,我运行了一个不同的ZINB模型,它运行得非常好。然而,今天我写了一个不同的模型,相同的变量,但不知何故它不再运行,并给出了一个奇怪的错误。当我尝试我之前的模型时,我突然得到了相同的错误,即:
Error in zeroinfl(Y1 ~ X1 + M1 | X1 + : object 'model_count' not found我的其余代码如下:
#loading required packages
library(psych)
library(foreign)
library(ggplot2)
library(MASS)
library(pscl)
library(nonnest2)
library(lmtest)
library(boot)
#Import data
mydata
#Fit a ZINB model
ex1zinb <- zeroinfl(X1 ~ Y1 + M1 | Y1 + M1, data = mydata, dist="negbin", EM= TRUE)我已经检查了统计分析等的假设,特别奇怪的是,几天前一个类似的模型确实运行了,但现在不再运行了。我今天确实尝试安装了几个包,但我遇到了非零退出状态。在一些关于stackoverflow的评论之后,我通过添加依赖关系= TRUE安装了一个包,但它运行卡住了。之后,问题就开始了。也许我的包出了什么问题?
加载库时,我收到以下消息:
> library(psych)
> library(foreign)
> library(ggplot2)
Need help? Try Stackoverflow: https://stackoverflow.com/tags/ggplot2
Attaching package: ‘ggplot2’
The following objects are masked from ‘package:psych’:
%+%, alpha
> library(MASS)
> library(pscl)
Classes and Methods for R developed in the
Political Science Computational Laboratory
Department of Political Science
Stanford University
Simon Jackman
hurdle and zeroinfl functions by Achim Zeileis
> library(nonnest2)
This is nonnest2 0.5-3.
nonnest2 has not been tested with all combinations of model classes.
> library(lmtest)
Loading required package: zoo
Attaching package: ‘zoo’
The following objects are masked from ‘package:base’:
as.Date, as.Date.numeric
> library(boot)
Attaching package: ‘boot’
The following object is masked from ‘package:psych’:
logit有谁有什么建议/见解吗?提前感谢!
编辑:当运行非零膨胀的负二项模型时,我确实得到了正常的输出。下面的代码运行流畅:
summary(ex1nb <- glm.nb(Y1~ X1 + M1, data = mydata))所以我觉得我的数据没问题?
发布于 2020-06-17 03:01:24
我也遇到了这个错误。我使用了R4.0,然后尝试了R3.6。不走运。
当我删除EM = TRUE参数时,我能够消除这个错误。
我不确定这是否有帮助。
https://stackoverflow.com/questions/61363189
复制相似问题