# Fit poisson regression

I have a data set $Y$, $Y$ is assumed to follow a poisson distribution with mean = $\lambda$ .

However, each element $y_i$ in $Y$ is accompanied with a covariate $x_i$. So here I want to use poisson regression to model this dataset. The link function is assumed to be log($\lambda(i)$)=$\beta_0$+$\beta_1x_i$.

I then want to use glm(Y~X,family='poisson') to fit the model and get $\beta_0$ and $\beta_1$.

After get $\beta_0$ and $\beta_1$, can I calculate the probability mass function given new $y$ and $x$.

I want to know if all of my above thought make sense?

• Besides the fact that a conditional Poisson distribution (conditional on x) does not imply a marginal Poisson distribution, this would seem to be exactly the idea of Poisson regression, yes. – Nick Sabbe May 10 '13 at 15:51

If the probability model for $$Y$$ is this:

$$P(Y_i=y) = \exp(\lambda_i) {\lambda_i}^y / y!$$

and $$i$$-th observations rate parameter is in fact given by:

$$\log(\lambda_i) = \beta_0 + \beta_1 x_i$$

(with no model misspecification per others' comments here)

Then the answer is yes you can calculate the PMF for a new $$Y$$ observation with a given $$X$$.

So if $$X_i=x$$, $$P(Y_i=y) = \exp(\exp(\beta_0 + \beta_1 x)) \exp(\beta_0 + \beta_1 x)^y / y!$$

If, however, the new $$X$$ observation is not known, then the marginal $$Y$$ distribution is a complex mixture of Poisson RVs.

Besides the fact that a conditional Poisson distribution (conditional on $$x$$) does not imply a marginal Poisson distribution, this would seem to be exactly the idea of Poisson regression, yes. – Nick Sabbe