gpt4 book ai didi

r - 零通胀 NB - 找不到对象 'model_count'

转载 作者:行者123 更新时间:2023-12-03 16:49:09 25 4
gpt4 key购买 nike

我正在建模一个介导的零膨胀负二项式 (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))

所以我认为我的数据没问题?

最佳答案

我也遇到了那个错误。我使用了 R 4.0,然后尝试了 R 3.6。没运气。

当我删除 EM = TRUE 参数时,我能够让错误消失。

我不确定这是否有帮助。

关于r - 零通胀 NB - 找不到对象 'model_count',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61363189/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com