I’m analyzing count data in R and I want to make two decisions: 1) what type of regression to use (Poisson, negative binomial, zero-inflated, etc), and 2) what predictors to include in the model. I’m unsure about the order of these decisions; however, intuitively it would make sense to me to first nail down which regression to use then move on to figuring out the exact parameters of the model.

I am thinking of the following sequence. Does this make sense? (I have some additional questions along the way.)

First, run a simple Poisson with the outcome variable and the IV of interest (one IV). Then use dispersiontest() from the AER library on this simple model to see if the data is overdispersed. If it is, move on to negative binomial and zero-inflated. But how do I decide between these two? Is it okay if I fit the same model for negative binomial, then for zero inflated, and use “pchisq(2 * (logLik(zero_inflated_model) - logLik(negative_binomial_model)), df = x, lower.tail = FALSE)” to get a p-value for the difference in deviances?

Bonus question for the zero-inflated part: how do I know what to put on the right side of the pipe in the model specification - zeroinfl(x ~ y | y, data = data, dist = "negbin"? Do I understand correctly that this part predicts the 0 vs. non-0 part of the model, and the left side predicts the whole non-0 part of the distribution? Is it okay to start with x ~ y | 1 for the negative binomial vs. zero-inflated decision?

Final question, about predictor selection: after nailing down the model to use, I would then start adding in additional predictors (control variables, stuff like that), and at each step use anova() for Poisson and negative binomial, and waldtest() for zero-inflated to see if that predictor leads to a significant decrease in deviance. Does this make sense? (And for zero-inflated, I would first keep the LEFT side constant, and figure out the RIGHT side – e.g., if my model had ABC as predictors, I would first only have 1 on the right, then A, then A+B, then A+B+C, then ABC, and use waldtest() to contrast each subsequent model?)

I apologize for the long question. Thanks in advance!

  • $\begingroup$ This really depends on what you're using the model for. For example, are you trying to build a predictive model, or an inferential model? Are hypothesis tests in your future? $\endgroup$ – Matthew Drury Jul 9 '18 at 5:17
  • 1
    $\begingroup$ I would like to use the model to test a hypothesis (y predicts x, but there are some additional variables that might confound the relationship). $\endgroup$ – MGy Jul 9 '18 at 8:04

Your Answer

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

Browse other questions tagged or ask your own question.