我正在尝试使用
glmmTMB
包和模型的 family = "compois"
构建康威麦克斯韦泊松模型。该模型工作正常,但我无法从模型中找到任何表示 Conway-Maxwell 的 Lambda
和 Nu
参数的输出,这阻碍了我运行 Conway-Maxwell 随机数生成器进行模拟
一些简单的代码来说明这一点
install.packages("COMPoissonReg")
install.packages("glmmTMB")
library(COMPoissonReg)
library(glmmTMB)
#Create artificial COM poisson count data as response variable
data <- data.frame(Response = rcmp(5000, lambda = 3, nu = 2))
#Create artificial poisson count data as explanatory variable
data$Covariate <- rpois(5000, lambda = 1)*data$Response
#Run ConwayMaxwellPois glmmTMB regression model
Mod <- glmmTMB(Response ~ Covariate,
family = "compois",
data = data)
summary(Mod)
#Check Models structure
str(Mod)
#Predict mu
predict(Mod, type = "response")
#Predict dispersion parameters
predict(Mod, type = "disp")
predict(Mod, type = "response")
返回实际平均值,而不是lambda,predict(Mod, type = "disp")
返回小十进制值,我认为这些值不是Nu(我从一些来源读到实际的Nu是1/predict(Mod, type = "disp")
,但我不确定这是否属实)。