W. Arlidge
W. Arlidge

Reputation: 11

Extracting z values from hurdle model output, 'pscl' package in R

I am using the hurdle() function from the pscl package to run negative binomial hurdle models in R.

I would like to extract only the list of z values from the model output and assign those values to a vector. But I cannot figure out how to do this?

Here is the basic outline of my model:

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

real.mod 

For example, I have tried:

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

But this doesn't work.

Any guidance on how to do this would be greatly appreciated.

Upvotes: 0

Views: 149

Answers (1)

DaveArmstrong
DaveArmstrong

Reputation: 21937

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

Created on 2022-03-02 by the reprex package (v2.0.1)

Upvotes: 1

Related Questions