0

我正在使用包中的hurdle()函数pscl在 R 中运行负二项式障碍模型。

我想只从模型输出中提取 z 值列表并将这些值分配给一个向量。但我不知道该怎么做?

这是我的模型的基本轮廓:

real.mod <- summary(hurdle(y ~ x1 + x2 + x3 + x4  |  x1 + x2 + x3 + x4, data=mydata, dist = "negbin", zero.dist = "negbin", link = "logit"))

real.mod 

例如,我尝试过:

coef(summary(real.mod))[,3]

但这不起作用。

任何有关如何执行此操作的指导将不胜感激。

4

1 回答 1

0
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
data("bioChemists", package = "pscl")

fm_hp1 <- hurdle(art ~ ., data = bioChemists)
z <- fm_hp1$coefficients$zero
z
#> (Intercept)    femWomen  marMarried        kid5         phd        ment 
#>  0.23679601 -0.25115113  0.32623358 -0.28524872  0.02221940  0.08012135

reprex 包创建于 2022-03-02 (v2.0.1)

于 2022-03-02T18:56:09.227 回答