6.7 Count data model

When dealing with a response variable of integer type, using a linear regression may violate the normality assumption, and all the classical statistic tests would fail to evaluate the model. However, as we do with logistic regression models, the generalized linear model GLM can be used instead, by specifying the suitable distribution.

The possible distributions for such data are the Poisson and the negative binomial distributions. The former is the best choice if the mean and the variance of the response variable are closer to each other. If they are not and we persist using this distribution, we may cause the rise of the overdispersion problem of the residuals. As a solution thus, we can use the latter distribution that does not have this restriction.

There is another alternative if neither the poisson distribution nor the negative binomial are suitable called the Quasi maximum likelihood. The advantage of this method is that uses only the relationships between the mean and the variance and does not require any prespecified distribution. Moreover, its estimators are approximately as efficient as the maximum likelihood estimators.

Since in practice the response variable may have a large number of zeros compared to the other values, we will discuss also two models designed to treat this type of data, The Hurdle model and the zero inflated model.

6.7.1 Poisson model

Using this distribution, the probability of the response variable is defined by:

\[\begin{equation} p(y_i=k|x_i)=\frac{exp(-\lambda_i)\lambda_i^k}{k!}\quad For \quad k=1,2,... \tag{6.68} \end{equation}\]

Where \(\lambda_i=E(y_i|x_i)=Var(y_i|x_i)\). This property of the Poisson distribution is called equi-dispersion.

As we see, this distribution has only this parameter (\(\lambda_i\)) to estimate using the regressors that we have in order to predict our discrete response variable. However, since it has to be positive, we will use the exponential of the linear regressions as follows:

\[\begin{equation} \lambda_i=exp(x_i\beta) \tag{6.69} \end{equation}\]

To estimate this model, we can call the maximum likelihood method. the log likelihood will be thus:

\[\begin{equation} l(\beta)=-\sum\limits_{i=1}^\limits{n}\Big[exp(x_i\beta)-y_ix_i\beta+log(y_i!)\Big] \tag{6.70} \end{equation}\]

To maximize this function, we should set the derivatives to zero and solve for \(\beta\) as follows:

\[\begin{align*} \frac{\partial l}{\partial\beta}=0 &\implies -\sum\limits_{i=1}^\limits{n}\Big(x_iexp(x_i\beta_{ML})-y_ix_i\Big)=0\\ &\implies \sum\limits_{i=1}^\limits{n}\Big(exp(x_i\beta_{ML})-y_i\Big)x_i=0 \end{align*}\]

Then, we obtain \(\beta\) using one fo the numeric methods.

6.7.2 goodness of fit

To validate the model we can use the LR test (called also deviance) or the person’s statistic.

The deviance is defined by:

\[\begin{equation*} LR=2(l_s-l_c) \end{equation*}\]

Where:

  • \(l_s=\sum\limits_{i=1}^\limits{n}\Big[y_ilny_i)-y_i\Big]\) is the maximum log-likelihood of the saturated model. That is \(y_i=\lambda_i\)
  • \(l_c=\sum\limits_{i=1}^\limits{n}\Big[y_iln(\widehat \lambda_i)-\widehat \lambda_i\Big]\) is the current (estimated) model.

Therefore, the deviance will be:

\[\begin{equation} LR=2\sum\limits_{i=1}^\limits{n}\Big[y_i\Big(\frac{y_i}{\widehat \lambda_i}\Big)-(y_i-\widehat \lambda_i)\Big] \tag{6.71} \end{equation}\]

The person’s static is defined by:

\[\begin{equation} \chi^2=2\sum\limits_{i=1}^\limits{n}\Bigg(\frac{(y_i-\widehat \lambda_i)^2}{\widehat \lambda_i}\Bigg) \tag{6.72} \end{equation}\]

6.7.3 Overdisperssion

The overdispersion arises when \(Var(y_i)>E(y_i)\). Since the model is based on the assumption of the equi-disperssion, we have to test this assumption before validation. A simple procedure have been suggested by (Cameron and Trivedi 1992) to test the following hypothesis:

\[\begin{cases} H0:Var(y_i)=E(y_i) \\ H1:Var(y_i)=E(y_i)+\alpha\mathrm g(E(y_i)) \end{cases}\]

Where, usually, the \(\mathrm g\) is a simple linear regression (or sometimes polynomial regression).

We have two tests, the first one is the simple \(t-test\) used to test the significance of the slop derived under the alternative hypothesis (\(H1\)).However , the second test is the most used one, which compare the current model (Poisson distribution) with an alternative distribution that does not have this restriction (\(Var(y_i)=E(y_i)\)) like the negative binomial by using the \(LM-test\) given by:

\[\begin{cases} LM=\frac{(e^te-n\overline y)}{2-\hat \lambda^t\hat \lambda} \end{cases}\]

This test follows the \(\chi^2_{(1)}\) with one degree of freedom. Notice that this test evolves only the restricted model (which is the Poisson model) so that we do not even need to estimate the negative binomial model.