Skip to main content
2 of 3
added 25 characters in body; edited title
user avatar
user avatar

Generate data samples from Poisson regression

I was wondering how you would generate data from a Poisson regression equation in R? I'm kind of confused how to approach the problem.

So if I assume we have two predictors $X_1$ and $X_2$ which are distributed $N(0,1)$. And the intercept is 0 and both of the coefficients equal 1. Then my estimate is simply:

$$\log(Y) = 0+ 1\cdot X_1 + 1\cdot X_2$$

But once I have calculated log(Y) - how do I generate poisson counts based on that? What is the rate parameter for the Poisson distribution?

If anyone could write a brief R script that generates Poisson regression samples that would be awesome!

Thanks!

Michael
  • 2.5k
  • 4
  • 26
  • 34