Tutorials › Marginal Structural Models › Encoding Baseline Hazards in Pooled Logistic MSMs

Fitting MSMs for Survival Outcomes · Tutorial 190 of 501

Encoding Baseline Hazards in Pooled Logistic MSMs

See how interval indicators give a pooled logistic MSM a distinct baseline event hazard for every interval, and learn what its fitted intercepts do—and do not—mean.

Advanced 12 min read

What You'll Learn

  • Define the interval-specific baseline term in a pooled logistic MSM.
  • Encode separate interval intercepts using reference-cell or no-intercept indicator coding.
  • Interpret an interval intercept as a log odds at the model’s reference covariate values.
  • Derive the weighted intercept estimate when there are no treatment terms.
  • Check coding, identifiability, and risk-set data before interpreting fitted coefficients.
  • Distinguish an interval-specific intercept from a marginal or regime-specific risk.

Why Encode Time by Interval?

In discrete-time survival data, each person contributes one record for each interval in which they remain at risk. The outcome for a record indicates whether the event occurred in that interval. Pooling these records allows a logistic model to describe the conditional event probability across intervals. But pooling alone does not say how that probability may vary with time: the model needs an explicit representation of its baseline pattern.

A separate indicator for each interval gives each interval its own baseline log odds. This is the saturated categorical-time representation: it does not require the baseline to rise, fall, or follow a particular smooth curve. The key interpretive point is that these intercepts describe the baseline of the specified conditional model. They are not automatically marginal event risks in the population.

Definition: Let \(k=1,\ldots,K\) index discrete intervals, and let \(D_{ik}\) equal 1 if person \(i\) experiences the event in interval \(k\), and 0 otherwise. Let \(R_{ik}=1\) indicate that the person is at risk at the start of that interval. For a vector \(Z_{ik}\) of treatment or other included model terms, an interval-indicator pooled logistic model is $$ \operatorname{logit} P(D_{ik}=1\mid R_{ik}=1,Z_{ik}) =\sum_{j=1}^{K}\alpha_j I(k=j)+\beta^\mathsf{T}Z_{ik}. $$ Here \(I(k=j)\) equals 1 when the record is from interval \(j\), and 0 otherwise. The coefficient \(\alpha_j\) is the interval-\(j\) intercept when \(Z_{ik}=0\).

The model is fit to at-risk person-interval records; records after a person has had the event do not belong in the risk set. In a weighted MSM, the model’s estimating equations or weighted objective use the treatment weights associated with those records. The interval indicators specify the time component of the outcome model; they do not define the weights or change what a record represents.

Two Equivalent Ways to Code the Intercepts

There are two standard design-matrix choices. With an overall intercept, include \(K-1\) interval indicators and treat one interval as the reference. If interval 1 is the reference, write

$$ \operatorname{logit}P(D_{ik}=1\mid R_{ik}=1,Z_{ik}) =\alpha_1+\sum_{j=2}^{K}\delta_j I(k=j)+\beta^\mathsf{T}Z_{ik}. $$

The intercept \(\alpha_1\) is the interval-1 log odds at \(Z=0\), and \(\delta_j=\alpha_j-\alpha_1\) is the difference in log odds between interval \(j\) and interval 1, holding \(Z\) fixed. Alternatively, omit the overall intercept and include all \(K\) indicators; then the coefficient on indicator \(j\) is directly \(\alpha_j\). These are alternative parameterizations of the same linear predictor.

Worked Example: Translating Between Reference and Full Indicator Coding

Suppose there are three intervals and the interval-specific baseline log odds are \(-3\), \(-2\), and \(-1\), respectively. Let the treatment term be \(\beta A_{ik}\), with \(\beta=0.7\). The full-indicator model is

$$ \operatorname{logit}P(D_{ik}=1\mid R_{ik}=1,A_{ik}) =-3I(k=1)-2I(k=2)-I(k=3)+0.7A_{ik}. $$

At \(A_{ik}=0\), the interval-specific probabilities are obtained by applying the inverse logit \(p=\exp(\eta)/(1+\exp(\eta))\). In interval 1, \(p=\exp(-3)/(1+\exp(-3))\approx0.0474\). In interval 2, \(p=\exp(-2)/(1+\exp(-2))\approx0.1192\). In interval 3, \(p=\exp(-1)/(1+\exp(-1))\approx0.2689\).

Using interval 1 as the reference, the equivalent coefficients are an overall intercept \(-3\), an interval-2 contrast \(\delta_2=-2-(-3)=1\), and an interval-3 contrast \(\delta_3=-1-(-3)=2\). For example, in interval 2 the reference-coded baseline linear predictor is \(-3+1=-2\), matching the full-indicator coefficient. Both codings give the same predicted probabilities.

The treatment coefficient \(0.7\) gives a conditional odds ratio \(\exp(0.7)\approx2.014\) for a one-unit increase in \(A_{ik}\), assuming the model includes that term additively and has no treatment-by-interval interaction. The intercepts alone do not describe this treatment contrast.

What an Interval Intercept Means

At \(Z_{ik}=0\), the fitted probability in interval \(j\) is \(\operatorname{expit}(\alpha_j)=\exp(\alpha_j)/(1+\exp(\alpha_j))\), and the corresponding odds are \(\exp(\alpha_j)\). Thus an intercept is on the log-odds scale, not the probability scale. Its probability interpretation is conditional on the other model terms taking their zero or reference values.

If \(Z\) includes treatment history, the value \(Z=0\) may represent a specified reference treatment history, depending on how that history was coded. If zero is not a meaningful or observed covariate value, the intercept remains a parameter of the model but has no useful direct description as a real-world subgroup’s baseline probability. Centering or changing the reference coding can make an intercept easier to describe, but it does not change fitted predictions when the model is reparameterized consistently.

Further, \(\operatorname{expit}(\alpha_j)\) is not generally the population event probability in interval \(j\). That population quantity would average conditional probabilities over the relevant covariate distribution, and in a weighted MSM the target interpretation also depends on the weighting and estimand. The intercept is the model’s conditional baseline at the specified covariate reference, not that average.

Result: With one separate indicator coefficient per interval and no treatment-by-interval interactions, the model implies a common treatment odds ratio across intervals. For a one-unit increase in a scalar treatment term \(A\), the conditional odds ratio is \(\exp(\beta)\) in every interval, while the baseline odds may differ by interval through \(\alpha_j\).

To verify the result, in interval \(j\) the odds at treatment value \(A=a\) are \(\exp(\alpha_j+\beta a)\). At \(A=a+1\), they are \(\exp(\alpha_j+\beta(a+1))\). Their ratio is

$$ \frac{\exp(\alpha_j+\beta(a+1))}{\exp(\alpha_j+\beta a)} =\exp(\beta). $$

The interval-specific term cancels, so the contrast is constant over \(j\). This is a consequence of the specified linear predictor, not a guarantee that the true treatment effect is constant. The model’s lack of treatment-by-interval interactions is an assumption about its structure.

Deriving the Weighted Intercept Estimate

A simple special case shows how interval indicators operate in a weighted fit. Suppose the model has no treatment or other covariate terms, and let \(w_{ik}>0\) be the weight for each at-risk record. Consider the weighted Bernoulli log-likelihood contribution for interval \(j\), with interval probability \(p_j=\operatorname{expit}(\alpha_j)\):

$$ \ell_j(\alpha_j)= \sum_{i:R_{ij}=1} w_{ij} \left[D_{ij}\alpha_j-\log\{1+\exp(\alpha_j)\}\right]. $$

Differentiating with respect to \(\alpha_j\) gives

$$ \frac{\partial\ell_j}{\partial\alpha_j} =\sum_{i:R_{ij}=1} w_{ij}(D_{ij}-p_j). $$
Result: If the total weighted event contribution \(E_j=\sum_{i:R_{ij}=1}w_{ij}D_{ij}\) and weighted non-event contribution \(N_j=\sum_{i:R_{ij}=1}w_{ij}(1-D_{ij})\) are both positive, the unique maximizer for the interval-only weighted logistic model is \(\hat{\alpha}_j=\log(E_j/N_j)\).

Proof. Setting the score to zero gives \(E_j-p_j(E_j+N_j)=0\), so \(p_j=E_j/(E_j+N_j)\). Because \(E_j,N_j>0\), this probability lies strictly between 0 and 1, and its logit is \(\log\{p_j/(1-p_j)\}=\log(E_j/N_j)\). The second derivative of \(\ell_j\) is \(-p_j(1-p_j)\sum_{i:R_{ij}=1}w_{ij}<0\), so the objective is strictly concave in \(\alpha_j\). The stationary point is therefore the unique maximizer. \(\square\)

This expression is a weighted event-to-non-event odds ratio within the interval. It is not generally the fitted intercept in a model that also contains treatment or other covariates: then the interval score includes their fitted contributions, and the intercept is estimated jointly with their coefficients.

Worked Example: Calculating an Interval-Only Weighted Intercept

In one interval, suppose three at-risk records have event indicators \(1,0,0\) and weights \(2,1,3\), respectively. The total weighted event contribution is \(E=2(1)+1(0)+3(0)=2\). The total weighted non-event contribution is \(N=2(0)+1(1)+3(1)=4\). The fitted probability is \(2/(2+4)=1/3\), and the fitted intercept is

$$ \hat{\alpha}=\log(2/4)=\log(1/2)\approx-0.6931. $$

Checking on the probability scale, \(\operatorname{expit}(-0.6931)\approx0.3333\), as required. The unweighted event fraction would be \(1/3\) in this particular example as well, but that agreement is not general. If the event record instead had weight 5 while the non-event records retained weights 1 and 3, then \(E=5\), \(N=4\), and \(\hat{\alpha}=\log(5/4)\approx0.2231\), giving a weighted fitted probability \(5/9\approx0.5556\).

Identifiability, Diagnostics, and Common Mistakes

The indicator design must have full rank for the requested coefficients to be identified. Including an overall intercept and all \(K\) interval indicators creates exact collinearity, because the indicators sum to one for every record. Use either an overall intercept and \(K-1\) indicators, or no overall intercept and all \(K\) indicators. Also check that the analysis data have records in every interval whose coefficient is to be estimated. Even with an identifiable design matrix, an interval with no weighted events or no weighted non-events can yield an infinite interval-only estimate; the finite-estimate condition in the result above then fails.

A practical check is to tabulate at-risk record counts and events by interval, confirm that each record’s interval indicators match its time index, and verify the model matrix has the intended reference category and rank. Compare fitted interval-specific predictions at a fixed reference value of \(Z\) with the fitted linear predictors: the interval intercept should enter only the records assigned to its interval. Large changes in the treatment coefficient when the interval coding is corrected can signal that the original coding did not represent the intended model.

  • Including all interval indicators and an overall intercept. This causes exact collinearity. Omit the overall intercept or omit one indicator and use a reference interval.
  • Reading \(\alpha_j\) as a probability. It is a log odds. Apply the inverse-logit to obtain the conditional probability at \(Z=0\).
  • Calling the intercept a marginal risk. It is conditional on the covariate reference values in the fitted model; averaging over a target population is a different calculation.
  • Assuming separate intercepts allow every time pattern. They allow the baseline term to vary freely by interval, but an additive treatment term still imposes a common treatment log-odds contrast unless interactions are included.

Compared with a single common intercept, interval indicators avoid forcing the same baseline odds at all times. Compared with a chosen numeric time trend, they do not impose that the baseline changes linearly in the chosen time scale. This representation uses one baseline parameter per interval, so it also requires sufficient information to estimate those parameters. Which time structure is appropriate depends on the scientific model and available data; indicator coding itself does not establish that the model is correct.

Worked Example: Detecting a Coding Error

A three-interval model is intended to have an overall intercept and interval 1 as the reference. A design matrix instead contains a column of ones and indicators \(I(k=1), I(k=2), I(k=3)\). For every record,

$$ 1=I(k=1)+I(k=2)+I(k=3). $$

Thus the intercept column is an exact sum of the three indicator columns. There is no unique set of four corresponding coefficients: adding a constant to the intercept and subtracting that constant from each interval coefficient leaves the linear predictor unchanged. The fit cannot identify this parameterization as written.

For the stated reference coding, remove \(I(k=1)\), leaving the overall intercept and \(I(k=2), I(k=3)\). Alternatively, remove the overall intercept and retain all three indicators. Each corrected design has three baseline parameters and can represent the same three interval-specific baseline logits, provided each interval is represented in the data.

Check Your Understanding

Use the definitions and results above to answer each question. Brief solutions are included for checking.

  1. In a four-interval model with an overall intercept and interval 1 as reference, how many interval indicators are included, and what does the interval-3 indicator coefficient represent?
  2. For an interval-only weighted fit, the weighted event total is 6 and weighted non-event total is 9. Find the fitted intercept and probability.
  3. Why does an additive treatment term with no interval interaction imply the same treatment odds ratio in each interval?
  4. What is the problem with including an overall intercept and all \(K\) interval indicators?
  5. Is \(\operatorname{expit}(\hat{\alpha}_j)\) necessarily the marginal event probability in interval \(j\)? Explain briefly.

Solutions. (1) Include three indicators, for intervals 2, 3, and 4. The interval-3 coefficient is the difference between interval 3 and reference interval 1 log odds, conditional on the other model terms. (2) \(\hat{\alpha}=\log(6/9)=\log(2/3)\approx-0.4055\), and \(\hat{p}=6/(6+9)=0.4\). Indeed, \(\operatorname{expit}(-0.4055)\approx0.4\). (3) The odds at treatment values \(a+1\) and \(a\) have ratio \(\exp(\beta)\); the interval intercept cancels. (4) The columns are linearly dependent because the \(K\) indicators sum to the intercept column, so the coefficients are not uniquely identified. (5) No. It is the conditional probability at the model’s covariate reference values; the marginal probability involves averaging over covariates.

Clinical Biostats