[R] pscl package and hurdle model marginal effects

Achim Zeileis Achim.Zeileis at uibk.ac.at
Wed Jan 18 07:17:22 CET 2012


On Tue, 17 Jan 2012, twarzin wrote:

> This request is related to the following post from last year:
>
> https://stat.ethz.ch/pipermail/r-help/2011-June/279752.html

Not very closely. The post linked above was asking about getting predicted 
means vs. predicted probabilities. It is not related to marginal effects.

> After reading the thread, the idea is still not clear. I have fitted a 
> model using HURDLE from the PSCL package. I am trying to get marginal 
> effects / slopes by multiplying the coefficients by the mean of the 
> marginal effects (I think this is right).

It is not clear to me that this definition is right. It also seems to be 
recursive.

Also, I assume you mean marginal effects on the overall mean. 
(Alternatives would be: For the probability of crossing the hurdle, for 
the truncated count mean, for the untruncated count mean.)

> To my understanding, this will require a mean for the binary probability 
> model and a mean for the truncated Poisson count model. My guess is that 
> I would use
>
> mean(predict( MODELNAME, type = "XXX"))
>
> where MODELNAME is the hurdle model and XXX is either RESPONSE, COUNT, 
> or ZERO. Assuming the above is right (correct me if it isn't), my 
> questions are:
>
> 1. What XXX gives me the mean of the marginal effects for the binomial probability model?
> 2. What XXX gives me the mean of the marginal effects for the count model?

Neither of the above gives you _marginal_ effects. "response" gives you 
the predicted mean for each observation (sometimes also called effects). 
"prob" gives you probabilities for each possible outcome 0, 1, 2, ...
"count" gives you the predicted mean of the count component of the model 
and "zero" the ratio of probabilities for non-zero counts.

The latter is probably named somewhat confusingly. It was chosen to be as 
close as possible to the corresponding quantity from zeroinfl(). See also 
the the package vignette for more details, especially in the appendix.

> Judging from my results, I would guess the answer to question 1 is 
> COUNT, except max(predict(MODELNAME, type= "count")) returns 4.5 and I 
> expected it to be less than 1. I would also have expected COUNT to match 
> up with the truncated Poisson count model. What is the intuition here?
>
> Also, when I try XXX = PROB, I get the following error:
>
> Error in matrix(NA, nrow = length(mu), ncol = nUnique) :
>  too many elements specified

Maybe you have a lot of observations with an extremely large maximal 
observed response? If so, try setting the argument 'at' to a suitable 
value, e.g., at = 0:10 or so.

hth,
Z

> So maybe there are other problems.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list