Tutorials › Generalized Linear Models › Time-Varying Exposure In Poisson Rate Models

Exposure and Rate Modeling · Tutorial 445 of 981

Time-Varying Exposure In Poisson Rate Models

Represent changing follow-up and covariates with interval-level Poisson records, then sum their fitted means to predict cumulative counts.

Intermediate 10 min read

What You'll Learn

  • Partition follow-up into nonoverlapping intervals with stable exposure and covariate values
  • Construct an interval-specific log-exposure offset and identify records with zero exposure
  • Derive the likelihood for a piecewise Poisson rate model
  • Calculate cumulative expected counts by summing interval-specific fitted means
  • Distinguish a summed expected count from an unweighted average of interval rates
  • Derive the distribution and variance of a total formed from independent interval counts

Why Follow-Up Must Sometimes Be Split

A single exposure total is sufficient for a constant rate only when the rate-relevant conditions remain fixed over the follow-up being summarized. If a person changes treatment, a population moves between calendar periods, or the underlying rate differs across seasons, one total exposure and one covariate value can conceal important changes. A useful representation is to divide follow-up into intervals during which exposure and modeled covariates are constant, and then model the count in each interval.

The interval is a modeling record, not necessarily a different person. For example, one person followed for two years might contribute one record for the first year and another for the second if treatment status changes at the year boundary. Each record carries its own exposure and covariate values. Its fitted mean is exposure multiplied by the rate predicted for that interval.

Definition: A time-varying exposure record is an interval-specific observation indexed by subject \(i\) and interval \(j\), with positive exposure \(t_{ij}\), count \(Y_{ij}\), and covariate vector \(x_{ij}\). Under the piecewise Poisson rate model, conditional on the recorded exposures and covariates, the counts are independent and $$ Y_{ij}\sim\operatorname{Poisson}(\mu_{ij}), \qquad \mu_{ij}=t_{ij}\lambda_{ij}, \qquad \log(\lambda_{ij})=x_{ij}^{\mathsf T}\beta. $$ Equivalently, the log mean has the offset form $$ \log(\mu_{ij})=\log(t_{ij})+x_{ij}^{\mathsf T}\beta. $$ Here \(t_{ij}\) is known exposure, \(\lambda_{ij}\) is the interval-specific rate, and \(\log(t_{ij})\) is an offset whose coefficient is fixed at one.

Intervals should be nonoverlapping pieces of follow-up, with each unit of exposure and each event assigned once. Split at a time when the modeled covariates change, or when the rate structure assigns a different rate to the next period. If the rate is assumed constant across several adjacent intervals, those intervals may instead share the same linear predictor; the records can still remain separate when their exposures or covariates differ.

The Poisson formulation treats exposures and covariates as fixed for the likelihood calculation, or conditions on their observed values. It is appropriate when the count process has the stated Poisson rate structure. In a continuous-time interpretation, a piecewise-constant intensity gives independent Poisson counts on disjoint intervals. The interval construction itself does not establish that the rate structure is suitable; it specifies how to represent changes that the model includes.

Building the Interval Model

For positive \(t_{ij}\), the offset is \(\log(t_{ij})\). If exposure is measured in person-years, for example, the offset uses the numerical person-years on that same scale. A change of exposure units requires the corresponding change in the rate scale, but not a new estimated coefficient for exposure.

The likelihood makes the role of the offset explicit. For independent records with positive exposures, the joint likelihood, apart from no omitted parameter-dependent terms, is

$$ L(\beta)=\prod_{i,j} \frac{\exp\{-t_{ij}\exp(x_{ij}^{\mathsf T}\beta)\} \left[t_{ij}\exp(x_{ij}^{\mathsf T}\beta)\right]^{Y_{ij}}}{Y_{ij}!}. $$

Taking logarithms gives

$$ \ell(\beta)= \sum_{i,j}\left[ Y_{ij}\{\log(t_{ij})+x_{ij}^{\mathsf T}\beta\} -t_{ij}\exp(x_{ij}^{\mathsf T}\beta) -\log(Y_{ij}!) \right]. $$

Thus the count in each record contributes information about the rate associated with that record's covariates, while its exposure scales the expected count. For an interval with zero exposure, \(\log(t_{ij})\) is undefined. Such a record cannot be entered with a log offset. If no one is at risk, it contributes no exposure and must have count zero; omit it from this likelihood. A positive event count paired with zero exposure signals a data or model-definition problem.

Worked Example: Changing Treatment During Follow-Up

A patient contributes 1.5 person-years untreated and then 0.5 person-years treated. The fitted rate model is \(\log(\lambda_{ij})=\beta_0+\beta_1 z_{ij}\), where \(z=1\) for treated follow-up and \(z=0\) otherwise. Suppose the fitted coefficients are \(\hat\beta_0=\log(0.04)\) and \(\hat\beta_1=\log(2)\). Find the interval offsets, fitted rates, and cumulative expected count.

For the untreated interval, \(z=0\), so its offset is \(\log(1.5)\) and its fitted rate is \(\exp\{\log(0.04)+0\}=0.04\) events per person-year. Its fitted mean is \(1.5(0.04)=0.06\).

For the treated interval, \(z=1\), so its offset is \(\log(0.5)\) and its fitted rate is \(\exp\{\log(0.04)+\log(2)\}=0.08\) events per person-year. Its fitted mean is \(0.5(0.08)=0.04\).

The cumulative expected count over both intervals is \(0.06+0.04=0.10\). The treatment change affects the rate for the treated time only; applying the treated rate to all two person-years would incorrectly give \(2(0.08)=0.16\).

Combining Interval Predictions

Suppose the interval-specific rates are \(\lambda_{ij}\), and the exposures are fixed. The expected total count is obtained by adding the interval means, not by averaging the rates without regard to exposure. Under the independent-count model, the same addition gives the mean parameter of the distribution of the total.

Theorem: Let \(Y_1,\ldots,Y_m\) be independent Poisson random variables with finite means \(\mu_k=t_k\lambda_k\), where each \(t_k\geq 0\) and \(\lambda_k\geq 0\) is fixed. Then \(Y_+=\sum_{k=1}^m Y_k\) is Poisson with mean \(\mu_+=\sum_{k=1}^m t_k\lambda_k\). Consequently, $$ E[Y_+]=\operatorname{Var}(Y_+)=\sum_{k=1}^m t_k\lambda_k. $$

Proof. For a Poisson random variable \(Y_k\) with mean \(\mu_k\), its probability generating function is \(G_k(s)=E[s^{Y_k}]=\exp\{\mu_k(s-1)\}\), for \(0\leq s\leq1\). Independence implies that the generating function of the sum is the product of the individual generating functions:

$$ G_{Y_+}(s)=\prod_{k=1}^mG_k(s) =\prod_{k=1}^m\exp\{\mu_k(s-1)\} =\exp\left\{\left(\sum_{k=1}^m\mu_k\right)(s-1)\right\}. $$

This is the probability generating function of a Poisson random variable with mean \(\sum_k\mu_k\), so \(Y_+\) has that distribution. A Poisson variable has expectation and variance equal to its mean; substituting \(\mu_k=t_k\lambda_k\) gives the stated formulas. \(\square\)

When the rates are predicted from a fitted model, the plug-in fitted mean for a collection of future intervals is therefore

$$ \widehat{\mu}_+=\sum_{k=1}^m t_k\widehat{\lambda}_k =\sum_{k=1}^m t_k\exp(x_k^{\mathsf T}\hat\beta). $$

This is a prediction of the expected count conditional on the exposures and covariates, using the fitted coefficient vector. If the rates are treated as fixed at their fitted values, the corresponding Poisson variance is also \(\widehat{\mu}_+\). That variance does not include uncertainty from estimating \(\beta\); uncertainty in estimated rates is a separate issue.

Worked Example: A Total Across Two Calendar Periods

A model predicts a rate of \(0.10\) events per person-year in period 1 and \(0.25\) in period 2. A study will contribute 12 person-years in period 1 and 8 person-years in period 2. Assume independent Poisson counts across the periods. Calculate the fitted expected total and the probability of exactly four events.

The fitted means are \(\hat\mu_1=12(0.10)=1.2\) and \(\hat\mu_2=8(0.25)=2.0\). Therefore, the cumulative fitted expected count is \(1.2+2.0=3.2\). The total count has a Poisson distribution with mean 3.2 by the theorem.

Hence $$ P(Y_+=4)=\exp(-3.2)\frac{3.2^4}{4!} =\exp(-3.2)\frac{104.8576}{24} \approx 0.1781. $$ The calculation uses the sum of the interval means, not the mean of the two rates. The latter, \(0.175\), is not an expected count and has no role in this probability.

The total expectation can also be written as total exposure multiplied by an exposure-weighted average rate, provided total exposure is positive:

$$ \sum_{k=1}^m t_k\lambda_k =\left(\sum_{k=1}^m t_k\right) \left(\frac{\sum_{k=1}^m t_k\lambda_k}{\sum_{k=1}^m t_k}\right). $$

The weighted average is useful as a summary, but it should not replace the interval-level calculation when the interval exposures or covariates change. The numerator retains the contribution of each rate over the time to which it applies.

Worked Example: Estimating Separate Period Rates

In an earlier study period, 4 events are observed over 40 person-years; in a later period, 3 events are observed over 10 person-years. Treat the period rates \(\lambda_1\) and \(\lambda_2\) as separate positive parameters, and assume independent Poisson counts. Find the likelihood estimates of the two rates and predict the expected count for 5 person-years in each period.

For period \(k\), with count \(y_k\), exposure \(t_k\), and rate \(\lambda_k>0\), the likelihood contribution is proportional to \(\exp(-t_k\lambda_k)(t_k\lambda_k)^{y_k}\). Its log-likelihood, dropping terms independent of \(\lambda_k\), is \(y_k\log(\lambda_k)-t_k\lambda_k\). When \(y_k>0\), differentiating gives \(y_k/\lambda_k-t_k=0\), so the maximizing rate is \(y_k/t_k\); the second derivative is \(-y_k/\lambda_k^2<0\), confirming a maximum.

Both observed counts are positive. Thus \(\hat\lambda_1=4/40=0.10\) events per person-year and \(\hat\lambda_2=3/10=0.30\) events per person-year. For 5 person-years in each period, the fitted means are \(5(0.10)=0.5\) and \(5(0.30)=1.5\). The cumulative expected count is \(0.5+1.5=2.0\). This prediction preserves the difference between periods instead of pooling their rates into one constant rate.

Practical Construction and a Common Pitfall

A reliable data construction follows the timing of risk, exposure, and covariates. For each subject or population unit, define the start and end of every interval, calculate the exposure accumulated within it, assign events to the interval in which they occurred, and record covariates at the values used by the model for that interval. Then form one count-and-exposure record per interval. If multiple subjects have the same covariate pattern and interval, they may be represented by an aggregated record with the summed count and summed exposure, provided the model assigns them the same rate and the count assumptions remain appropriate.

The offset is attached to each record's own exposure. It is not generally correct to add up a subject's exposure across different covariate states and then use that total with only one of those states. Nor should an exposure be entered as an ordinary estimated predictor when the intended model specifies proportional scaling of the mean with exposure: the offset fixes that coefficient at one.

  • Wrong reasoning: “The person contributed 2 person-years altogether, so I will use one row with offset \(\log(2)\) and the treatment status recorded at the end of follow-up.”
  • Correction: If treatment status changed, the two periods generally have different predictors. Use separate exposures and covariates, and add their fitted means. A single record is justified only if the rate model assigns the same rate throughout that combined exposure.
  • Another check: A fitted rate is a count per exposure unit; a fitted mean is a count. Multiply each interval's rate by that interval's exposure before summing.
Key takeaway: Represent each stable exposure-and-covariate period with its own Poisson record and log-exposure offset. Predict cumulative counts by summing \(t_{ij}\exp(x_{ij}^{\mathsf T}\hat\beta)\) over the relevant intervals.

Check Your Understanding

Try these questions using the interval-level model and calculations above.

  1. A subject contributes 3 person-years in one covariate state and 2 in another. What information must be retained to calculate the fitted cumulative expected count correctly?
  2. Why is \(\log(t_{ij})\) an offset rather than a coefficient estimated from the interval data in the stated model?
  3. If two independent interval counts have means 0.7 and 1.1, what is the distribution and expected value of their sum?
  4. What should be done with a record having zero exposure and zero events, and why can it not be entered using an ordinary log-exposure offset?
  5. Explain why an unweighted average of two interval rates is generally not the cumulative expected count.
Clinical Biostats