Why Count Rates Vary Between Subjects
Two subjects with the same measured covariates and exposure can still have different expected event counts. Some may have a persistently higher underlying rate; others may respond differently as a covariate changes. A count mixed-effects model represents these patterns through subject-specific random effects. Because the model uses a log link, those effects act multiplicatively on rates, and averaging over them requires care.
Let \(Y_{ij}\) be the count for subject \(i\) on observation \(j\), and let \(E_{ij}>0\) be the known exposure, measured in units such as patient-weeks. Let \(z_{ij}\) be a covariate, preferably centered so that zero has a useful interpretation. A Poisson model with a random intercept and random slope is
Here \(b_i=(b_{0i},b_{1i})^\mathsf{T}\) is the pair of random effects for subject \(i\). The exposure enters as an offset \(\log(E_{ij})\), so the rate per exposure unit is \(\mu_{ij}/E_{ij}\). A random-intercept-only model sets \(b_{1i}=0\). The usual assumptions for this model are that, conditional on the subject's random effects and covariates, the counts are Poisson with the stated means; observations are conditionally independent given those effects; and the random effects follow a specified distribution, commonly a bivariate normal distribution with mean zero.
The covariance matrix \(D\) must be positive semidefinite. The zero-mean convention makes \(\beta_0\) and \(\beta_1\) the fixed effects for a subject whose random effects are both zero; it does not imply that all subjects have those effects. The model also assumes the chosen normal distribution adequately describes the distribution of subject effects for the intended analysis.
Interpreting Random Intercepts and Slopes
At \(z=0\), the subject-specific rate is \(\exp(\beta_0+b_{0i})\) per exposure unit. Thus a one-unit increase in \(b_{0i}\) multiplies this rate by \(e\), while a difference of \(d\) in random intercepts corresponds to a rate ratio of \(\exp(d)\) at every covariate value when slopes are the same. Centering \(z\) determines where the intercept comparison applies.
For subject \(i\), a one-unit increase in \(z\) changes the log rate by \(\beta_1+b_{1i}\). The subject-specific rate ratio for that increase is \(\exp(\beta_1+b_{1i})\). Consequently, a positive random slope means a larger covariate-associated increase (or smaller decrease) on the log-rate scale than the fixed slope alone indicates. The interpretation depends on the covariate's units: if \(z\) is dose in milligrams, the slope is per milligram unless dose was rescaled.
Subject-specific expected counts follow directly from the rate and exposure. At a specified \(z\) and exposure \(E\), the conditional mean is \(E r_i(z)\). This is a prediction conditional on the subject's random effects. For a new subject, those effects are not known; a population prediction instead averages over their distribution.
Worked Example: A Subject-Specific Rate With a Random Intercept
Suppose a hypothetical Poisson model has a reference rate of \(0.40\) events per patient-week and a subject's estimated random intercept is \(b_{0i}=0.4231\). There is no random slope in this example. Find the subject's conditional rate and expected count over two patient-weeks.
The log-rate shift is \(0.4231\), so the subject-specific rate is
For exposure \(E=2\) patient-weeks, the conditional expected count is
The rate is about \(1.527\) times the reference rate, since \(\exp(0.4231)\approx1.5267\). The expected count is not required to be an integer: it is the model mean, not a realized count.
Random Slopes and Individual Predictions
With a random slope, the rate ratio comparing two covariate values depends on their difference. For values \(z_a\) and \(z_b\), the subject-specific rate ratio is \(\exp\{(\beta_1+b_{1i})(z_b-z_a)\}\). The random intercept cancels from this contrast, while the random slope remains. This is one reason random slopes matter when subjects have meaningfully different covariate responses.
Worked Example: Predictions at Two Covariate Values
Consider a hypothetical model with reference rate \(0.50\) events per patient-week, fixed slope \(\beta_1=0.20\) per covariate unit, and a particular subject's effects \(b_{0i}=0.10\) and \(b_{1i}=0.15\) per covariate unit. Calculate the rates at \(z=-1\) and \(z=1\), then calculate the expected count at \(z=1\) for exposure of \(2\) patient-weeks.
The reference rate corresponds to fixed intercept \(\log(0.50)\). At \(z=-1\), the combined covariate slope is \(0.20+0.15=0.35\), giving
At \(z=1\), the log-rate shift from the reference is \(0.10+0.35=0.45\), so
The rate ratio between \(z=1\) and \(z=-1\) is \(\exp\{0.35(1-(-1))\}=\exp(0.70)\approx2.014\), consistent with \(0.7842/0.3894\approx2.014\). For two patient-weeks at \(z=1\), the conditional expected count is \(2(0.7842)=1.568\) events. These are conditional predictions for the specified hypothetical subject effects.
Integrating Over Random Effects
A population-average mean is not generally obtained by setting the random effects to zero. It is obtained by averaging the conditional mean over their distribution. Write \(a(z)=(1,z)^\mathsf{T}\). The random contribution to the log rate is \(a(z)^\mathsf{T}b_i\), which is normally distributed with mean zero and variance \(v(z)=a(z)^\mathsf{T}D a(z)\). For a mean-zero normal variable \(U\) with variance \(v\), its moment-generating function gives \(E[\exp(U)]=\exp(v/2)\). Applying that identity yields the population-average rate and expected count.
The result follows by integrating the conditional rate with respect to the random-effects distribution:
The final equality uses the normal exponential moment identity, with variance \(a(z)^\mathsf{T}Da(z)\). This derivation also explains why the population-average rate exceeds the rate for a subject with \(b_i=0\) at the same covariate value whenever \(v(z)>0\). The exponential function is convex, so averaging exponentiated random effects does not equal exponentiating their average.
Worked Example: Population Mean With Correlated Random Effects
Suppose a hypothetical model has a reference rate of \(0.50\) events per patient-week and fixed slope \(\beta_1=0.20\) per unit of \(z\). Let \(\sigma_0^2=0.09\), \(\sigma_1^2=0.04\), and \(\sigma_{01}=-0.03\). Find the population-average rate at \(z=1\) and compare it with the rate for \(b_i=0\).
The random-effects covariance matrix is valid: its determinant is \(0.09(0.04)-(-0.03)^2=0.0027>0\), and its diagonal variances are positive. At \(z=1\), the random contribution has variance
The rate for a subject with both random effects equal to zero is \(0.50\exp(0.20)\approx0.6107\) events per patient-week. Integrating over random effects gives
The population-average rate is higher because the normal variation is exponentiated. The negative intercept-slope covariance reduces the variance at \(z=1\) relative to what it would be with zero covariance. It is the variance of the combined random contribution at the chosen \(z\), not either variance alone, that enters the population mean.
Population-Average Comparisons and Model Checks
If the model has only a random intercept, then \(v(z)=\sigma_0^2\) is constant. Integration multiplies every conditional rate by the same factor \(\exp(\sigma_0^2/2)\); therefore, the rate ratio across two covariate values remains \(\exp\{\beta_1(z_b-z_a)\}\). With random slopes, \(v(z)\) changes with \(z\). The population-average rate ratio is then
Thus, the fixed slope alone describes the conditional log-rate change for a subject with zero random effects, not necessarily the log rate ratio between population-average rates. Inference and communication should state which scale and which population are being described.
Useful checks include comparing observed and simulated subject-level count patterns, examining whether residual patterns remain across covariate values or exposure, and checking whether estimated random-effect variances are near zero or the covariance estimate is unstable. Subject-level predictions should also be assessed for implausible rates. A near-zero slope variance may indicate little support for a random slope, but can also arise from limited observations per subject or weak covariate variation. A variance estimate at a boundary or a highly uncertain covariance is a warning about identifiability, not automatic evidence that the model is correct or incorrect.
Random-effects predictions for observed subjects are commonly estimated using their data and the fitted population distribution. Such estimates are conditional predictions and are typically shrunk toward zero when subject-specific data are sparse. They are not known true effects, and treating them as error-free can understate uncertainty. For a new subject without counts, use the population-average prediction when the target is the mean across subjects; a zero-random-effect prediction is instead a typical-subject conditional prediction.
A random-intercept-only model is simpler and captures persistent rate heterogeneity but assumes common covariate response. A random-intercept-and-slope model allows response heterogeneity, at the cost of additional parameters and stronger data requirements. A model without random effects is simpler still, but it does not represent within-subject dependence or between-subject rate variation in this way. These are different modeling assumptions, not interchangeable computational options. Random effects can also induce extra marginal variation: for one observation with conditional mean \(\lambda_i\), the law of total variance gives \(\operatorname{Var}(Y)=E(\lambda_i)+\operatorname{Var}(\lambda_i)\). This tutorial does not identify that variation with any particular alternative count distribution; the assumed random-effects structure remains a modeling choice that should be checked against the data.
Common Pitfalls and Limitations
- Adding a random effect directly to the rate. The model adds it to the log rate; the rate is multiplied by its exponential. For example, an intercept effect of \(0.2\) multiplies the rate by \(\exp(0.2)\), not by \(1.2\).
- Calling the zero-effect rate the population mean. It is the conditional rate at \(b_i=0\). The population mean includes the variance adjustment from integrating over the random-effects distribution.
- Ignoring covariance in a random-slope model. The term \(2z\sigma_{01}\) affects the variance of the combined random contribution and hence the marginal mean.
- Interpreting a random slope without its covariate units. A slope per one milligram differs numerically from a slope per one hundred milligrams; specify the scale and centering of \(z\).
The lognormal integration formula depends on normally distributed random effects and the stated log-linear predictor. If those assumptions are poor, the formula may not describe the intended population mean. Random slopes also require enough subjects and within-subject covariate variation to estimate their variability; a complex structure can be weakly identified. Exposure must be correctly measured and enter as a proportional offset for the stated rate interpretation to hold.
Check Your Understanding
Try each question, then compare your reasoning with the solutions.
- A random intercept is \(0.30\). By what factor does it multiply the rate at a fixed covariate value?
- In a random-slope model, what is the subject-specific rate ratio for increasing \(z\) by two units?
- At \(z=0\), a random-intercept-only model has reference rate \(0.20\) events per hour and intercept variance \(0.16\). What is its population-average rate?
- Why can the population-average rate ratio differ from the conditional rate ratio when random slopes are present?
- A subject has conditional rate \(0.70\) events per day and exposure of three days. What is the conditional expected count?
Solutions. (1) The factor is \(\exp(0.30)\approx1.350\). (2) It is \(\exp\{2(\beta_1+b_{1i})\}\), with units understood as a two-unit increase in \(z\). (3) The rate is \(0.20\exp(0.16/2)=0.20\exp(0.08)\approx0.2167\) events per hour. (4) Random slopes make the variance of the random contribution depend on \(z\); integration adds the term \(\tfrac12[v(z_b)-v(z_a)]\) to the log population-average rate ratio. (5) The expected count is \(3(0.70)=2.10\) events.