I have a count dataset with mean=3.2, and a little bit Zero-inflated. enter image description here

X1      X2      X3  Y
Food3   Low     13  2
Food3   High    27  1
Food2   Low     13  1
Food1   Medium  27  1
Food1   High    20  8
Food3   Low     20  1
Food1   High    13  5
Food2   Medium  13  4
Food1   Low     13  0
Food2   High    20  6
Food1   Medium  13  2
Food1   Low     13  1
Food1   Low     13  1
Food3   Low     13  1
Food2   Medium  13  5
Food1   Medium  27  0
Food3   Low     13  2
Food1   Medium  20  3
Food3   Medium  13  7
Food1   Low     20  1
Food3   Medium  13  5

I fitted the GLM model with Poisson family:

model1 <- glm(formula=Y~X1+X2+X3+X1:X2+X1:X3+X2:X3, 
              family=poisson(link="log"), data=Df)

The summary(model1) output showed a little bit overdispersion, I also tried to fit glm.nb() negative binomial GLM.

enter image description here

But the problem for this model is, there are some negative predictions, both for Poisson GLM and negative binomial. How these could be from, and how should I fix this problem?

enter image description here

  • 5
    $\begingroup$ I guess you need to push those values through exp(). $\endgroup$
    – Nick Cox
    Mar 19 '18 at 10:15
  • $\begingroup$ @NickCox, thank you very much! Could you please give more detail information? I'm not sure how to do it. $\endgroup$
    – Jellz
    Mar 19 '18 at 14:59
  • 2
    $\begingroup$ I am not a routine R user but I would be amazed if there's not a way to get predictions on your original counted scale. If not I would bet wildly that exp() is an R function. Please note that how to do anything in R or any other software is off-topic here unless the question is at root statistical. $\endgroup$
    – Nick Cox
    Mar 19 '18 at 17:25
  • 1
    $\begingroup$ Thanks @NickCox, you are of course correct on all accounts! I have answered the question here because I felt that the root is indeed more a statistical question about GLMs than about the R implementation in particular. I have tried to reflect that in my answer. $\endgroup$ Mar 20 '18 at 11:21

The Poisson GLM fits a model $y_i \sim \text{Pois}(\mu_i)$ with $\log(\mu_i) = x_i^\top \beta$, i.e., a log links the expectation $\mu_i$ to the so-called "linear predictor" $x_i^\top \beta$, often denoted $\eta_i$ in the GLM literature. Hence, at least two types of predictions may be of interest based on the coefficient estimates $\hat \beta$: the predicted link $\hat \eta_i = x_i^\top \hat \beta$ and the predicted expectation $\hat \mu_i = \exp(\hat \eta_i) = \exp(x_i^\top \hat \beta)$. The latter are typically of more interest in applications while the former are often employed in (diagnostic) graphics because they are on a linear scale.

In R, both types of predictions are readily provided for glm objects as predict(model1, type = "link") (the default) and predict(model1, type = "response"), respectively. The former is employed in the graphical displays from plot(model1).

  • $\begingroup$ thank you very much. I think I understand the differences of these two situations now. If we only say the diagnose this model, would you say it is ok? Because I'm not quite sure, it looks not that perfect. But I don't think it need to be fitted by zero-inflated model? $\endgroup$
    – Jellz
    Mar 23 '18 at 11:52
  • 1
    $\begingroup$ There does not seem to be much evidence for zero-inflation. If you want to look at a dedicated display for this, you can use the rootogram() function from the countreg package on R-Forge (R-Forge.R-project.org/R/?group_id=522). If you want to do more formal testing or model selection you can fit a hurdle Poisson model and carry out a hurdletest() (in package countreg or, equivalently, pscl) or do AIC/BIC selection etc. $\endgroup$ Mar 23 '18 at 15:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.