Poisson and Negative Binomial Regression

"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:

  1. Number of vehicles manufactured.
  2. Number of car accidents.
  3. 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

If you like us, please tell your friends.Share on LinkedInShare on Google+Share on RedditTweet about this on TwitterShare on Facebook