In R we can simulate Poisson random numbers using rpois(n, lambda).
Recall, we have
Then
We are using to emphasize observations
If we already know and from our glm(...) call from earlier, we can produce .
lambda_vector <- exp(3.55 - 0.00166 * d)
n <- nrow(cigbutts)
simcounts <- rpois(n, lambda = lambda_vector)