WeiYa's Work Yard

A dog, who fell into the ocean of statistics, tries to write down his ideas and notes to save himself.

Poisson Regression

Posted on August 01, 2017 0 Comments

Introduction

The Poisson distribution $P(\mu)$ is often used to model count data. If $Y$ is the number of occurrences, its probability distribution can be written as

where $\mu$ is the average number of occurrences. And we can obtain

Poisson Regression

Let $Y_1,\ldots, Y_N$ be independent random variables with $Y_i$ denoting the number of events observed from exposure $n_i$ for the $i$-th covariate pattern. We have

where $\theta_i$ is usually modeled by

Therefore, the generalized linear model is

The natural link function is the logarithmic function

where $log(n_i)$ called the offset, it is a known constant.

Measure the goodness of fit

Hypotheses about the parameter $\beta_j$ can be tested using the wald, score or likelihood ration statistics. Approximately, we have

The fitted values are given by

The pearson residuals are

where $o_i$ is the observed value of $Y_i$. The chi-squared goodness of fit statistics are related by

The deviance for a Poisson model can be written in the form

For most models, we have $\sum o_i=\sum e_i$, so

The deviance residuals are the components of $D$,

so that $D = \sum d_i^2$.

Using the Taylor series expansion,

Implement

The example which implement in C++ and R can be found on gsl_lm

You can see the code in my github repository gsl_lm/poisson.

References

An Introduction to Generalized Linear Models, Third Edition (Chapman & Hall/CRC Texts in Statistical Science)


Published in categories Regression