# Misspecification in Generalized Linear Mixed Models and Its Impact on the Statistical Wald Test
## 2 Materials and Methods
### Poisson and Negative Binomial Models with Random Intercept and Slope  
A simulation study was conducted to evaluate the impact of the incorrect specification of the distribution of random effects for the case of generalized linear mixed models with the Poisson response and a random intercept and slope. The following structure, taken from [29], was considered:  
\[\mathrm{y_{ij}}|\mathrm{b_{i}}\ \widetilde{\mathrm{ind}}.\ \mathrm{ Poisson}\ (\mu_{\bar{\mathrm{ij}}}),\] \[\mathrm{log}(\mu_{\bar{\mathrm{ij}}})=\beta_{0}+\mathrm{b_{0i}}+( \beta_{1}+\mathrm{b_{1i}})\mathrm{x_{1\bar{\mathrm{ij}}}}+\beta_{2}\mathrm{x _{2\bar{\mathrm{ij}}}}+\beta_{3}\mathrm{x_{3i}} \tag{7}\] \[\mathrm{b_{i}}\ \widetilde{\mathrm{ind}}.\ \mathrm{G_{T}}\]  
where \(\mathrm{i}=1,2,\ldots,\mathrm{m},\ \mathrm{j}=1,2,\ldots,\mathrm{n_{i}}\).  
Based on the structure proposed by [29], NB response variables were also simulated with the following structure:  
\[\mathrm{log}(\mu_{\bar{\mathrm{ij}}})=\beta_{0}+\mathrm{b_{0i}}+(\beta_{1}+ \mathrm{b_{1i}})\mathrm{x_{1\bar{\mathrm{ij}}}}+\beta_{2}\mathrm{x_{2\bar{ \mathrm{ij}}}}+\beta_{3}\mathrm{x_{3i}} \tag{8}\]  
with \(\mathrm{x_{1\bar{\mathrm{ij}}}}\), which has equally spaced values between \(-1\) and \(1\); \(\mathrm{x_{2\bar{\mathrm{ij}}}}\), a covariate within conglomerates with values \(\mathrm{x_{2\bar{i}}}=(-0.5,\ 1.0,\ 0,-1.0,\ 0.5)^{\mathrm{T}}\), and a binary covariate among conglomerates, \(\mathrm{x_{3i}}\), which was established to take the value of \(0\) for half of the conglomerates and \(1\) for the rest. The three covariates are mutually orthogonal [29]. In addition, four sample sizes, \(\mathrm{n_{i}}=5,\ 10,\ 15,\ 20\), were considered, as well as \(\mathrm{m}=100\) conglomerates.  
The random intercept and slope, both for the Poisson and for the \(\mathrm{NB}\ \mathrm{b_{i}}=(\mathrm{b_{0i}},\mathrm{b_{1i}})^{\mathrm{T}}\), were generated based on 4 different distributions \(\mathrm{G_{T}}\) with \(\mu_{\mathrm{b_{0i}}}=\mu_{\mathrm{b_{1i}}}=0\), 4 variance values, \(\sigma_{\mathrm{b_{0i}}}^{2}=\sigma_{\mathrm{b_{1i}}}^{2}=1,2,4,8\), and a correlation of 0.5 between the intercept and the random slope:  
1. \(\mathrm{b_{i}}\sim\)bivariate normal.
2. \(\mathrm{b_{i}}\sim\)bivariate t with 3 degrees of freedom.
3. \(\mathrm{b_{i}}\sim\)exponential.
4. \(\mathrm{b_{i}}\sim\)bivariate Tukey \(\mathrm{g-h}\), where parameter g controls the amount and direction of asymmetry, while parameter h controls the amount of elongation (kurtosis) of the bivariate Tukey distribution [30].  
Figure 2 shows the contours for the four distributions used to simulate the random intercept and slope.  
A total of 1000 repetitions were generated for each combination of \(\mathrm{n_{i}}\), \(\beta_{\mathrm{k}}\) with \(\mathrm{k}=1,2\), the true distribution of \(\mathrm{b_{i}}\), \(\sigma_{\mathrm{b_{0i}}}^{2}\) and \(\sigma_{\mathrm{b_{1i}}}^{2}\) with structures (7) and (8) adjusting the model with the function glmer for the Poisson case and glmer.nb for the NB case, both of which were incorporated into the R package lme4.  
As for generalized linear mixed models with a random intercept, the interest was focused on determining the ratio of times that an effect of the parameter of interest was detected; in this case, there are two: \(\beta_{1}\) and \(\beta_{2}\); i.e., where \(\mathrm{H_{0}}:\beta_{\mathrm{k}}=0\) was rejected with a significance level of 5%, with this ratio corresponding to a type I error if \(\beta_{\mathrm{k}}=0\) and for other values of the parameter, this ratio represents the power of the analysis test [22], with \(\mathrm{k}=1,2\). The values used for the parameters \(\beta_{1}\) and \(\beta_{2}\) are shown in Table 2. For the other parameters, the values of \(\beta_{0}=-2.5\) and \(\beta_{3}=1.0\) were used.