"Poisson regression models count variables that assumes poisson distribution. When the count variable is over dispersed, having to much variation, Negative Binomial regression is more suitable."
A count variable is something that can take only non-negative integer values. Some examples of count variables could be:
- Number of vehicles manufactured.
- Number of car accidents.
- Number of patents granted.
How to Implement Poisson Regression?
Poisson regression can be implemented in a similar manner as other glms using the MASS package, by adjusting the family argument to ‘poisson’.
library (MASS)
poissonModel <- glm(countResponse ~ pred1 + pred2, family="poisson", data=inputData) # poisson Model
summary (poissonModel) # model summary
predict(poissonModel, newdata, type="response") # predict on new data
How to Implement Negative Binomial Regression?
library (MASS)
negBinomModel <- glm.nb(countResponse ~ pred1 + pred2, data = inputData)) # negative Binomial model
summary (negBinomModel) # Model summary
predict (negBinomModel, newdata, type="response") # predict on new data




