Pri*_*pia 6 statistics r object glm
我正在建模一个介导的零膨胀负二项式 (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
Run Code Online (Sandbox Code Playgroud)
我的其余代码:
#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)
Run Code Online (Sandbox Code Playgroud)
我已经检查了统计分析等的假设,特别奇怪的是,几天前确实运行了一个类似的模型,而不再运行了。我今天确实尝试安装了几个软件包,但遇到了非零退出状态。根据对 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
Run Code Online (Sandbox Code Playgroud)
有人有什么建议/见解吗?提前致谢!
编辑:运行非零膨胀负二项式模型时,我确实得到了正常输出。以下代码运行流畅:
summary(ex1nb <- glm.nb(Y1~ X1 + M1, data = mydata))
Run Code Online (Sandbox Code Playgroud)
所以我认为我的数据没问题?