[R] predictions from hurdle model
erin
erinzylstra at gmail.com
Thu Aug 2 20:08:47 CEST 2012
I ran a negative binomial logit hurdle model and am now trying to plot the
effects of a continuous predictor variable (the only variable in my model)
on the count and zero component and the overall mean response. I'm confused
because for some values, the predicted overall mean is higher than the mean
of the non-zero counts (range of predicted overall means=2.2-11.0; range of
non-zero count means=2.8-4.6). Is this possible or did I do something
wrong? I did not expect these results because I thought the probability of
getting a zero response should reduce the overall mean below the non-zero
count mean.
I attached the relevant code and output below. Any thoughts or suggestions
would be much appreciated! I'm new to hurdle models and their
interpretation. Thank you,
Erin
> library(pscl)
> nbhurdle.prev<-hurdle(LLF.a~y.prev,data=full.cts,dist="negbin")
> summary(nbhurdle.prev)
Call:
hurdle(formula = LLF.a ~ y.prev, data = full.cts, dist = "negbin")
Pearson residuals:
Min 1Q Median 3Q Max
-0.6398 -0.3333 -0.3333 -0.1363 7.3145
Count model coefficients (truncated negbin with log link):
Estimate Std. Error z value Pr(>|z|)
(Intercept) 1.031508 0.470804 2.191 0.02846 *
y.prev 0.005042 0.001835 2.747 0.00601 **
Log(theta) -1.856429 0.561709 -3.305 0.00095 ***
Zero hurdle model coefficients (binomial with logit link):
Estimate Std. Error z value Pr(>|z|)
(Intercept) -0.915944 0.103853 -8.820 < 2e-16 ***
y.prev 0.048832 0.009079 5.379 7.51e-08 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Theta: count = 0.1562
Number of iterations in BFGS optimization: 20
Log-likelihood: -931.7 on 5 Df
> y.prev<-seq(0,100,by=1)
> newdata<-data.frame(y.prev)
> nonzero<-1-predict(nbhurdle.prev,newdata=newdata,type="prob")
> countmean<-predict(nbhurdle.prev,newdata=newdata,type="count")
> allmean<-predict(nbhurdle.prev,newdata=newdata,type="response")
> plot(y.prev,nonzero[,1],type="b")
> plot(y.prev,countmean,type="b")
> plot(y.prev, allmean, type = "b")
--
View this message in context: http://r.789695.n4.nabble.com/predictions-from-hurdle-model-tp4638924.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list