Simulation of Poisson data with a endogenous regressor My simulation setup goes like this: 
I draw my dependend variable as $Y\sim \text{Poi}\left(\lambda\right)$
where $\lambda = \exp\left(\beta_0 + \beta_1x_1 + \beta_2z + u\right)$
and $z = \gamma_0 + \gamma_1x_1 + v$
$u\sim N(0,1)$, $v\sim N(0,1)$
The endogenous regressor $z$ within the $\lambda$-equation is now being created by letting $\text{Cov}(u,v)=p$ using a Cholesky-Decomposition approach.
The issue I'm currently facing seems to be silly but even if I set $p=0$ I'll get a biased estimate of $\beta_0$. This seems strange as $v,u$ are chosen such that they are zero on average. 
Why is there a bias within $\widehat{\beta}_0$?
 A: I think one issue that is occurring is that with a GLM, if you have random effects (such as $u$) that average out to 0, this does not mean that their effect on the average comes out to be zero. This is due to Jensen's inequality. 
To illustrate this very simply: consider $x_1 = -1, x_2 = 1$. Clearly, $\bar x = 0$. But $\bar{(e^{x})} \approx 1.5 ≠ 1.0 = e^{\bar x}$. 
This is a very common mistake that is made in interpreting fixed effects in a generalized mixed effects model. In the case of an identity link, the fixed effect can be interpreted as the population average. This is not the case for other link functions. 
In terms of accounting for the random effect $u$, this actually can be done with generalized mixed effects models. Consider the following fits in R:
library(lme4)
u <- rnorm(500)
#Random Effects
y <- rpois(500, lambda = exp(u + 1))
#Observed outcomes. Note that intercept = 1
id <- 1:500
#Only one observation per subject!
fit_glm <- glm(y ~ 1, family = poisson)
#Fitting a standard glm without accounting for random effect
fit_glmm <- glmer(y ~ (1|id), family = poisson)
#Fitting accounting for random effect
summary(fit_glm)
#Note that we clearly are not capturing true intercept (1).
#Again, due to Jensen's inequality
summary(fit_glmm)
#Now that we have accounted for these random effects, it seems that we have 
#an unbiased estimator for the intercept!

