Tutorials › Competing Risks and Multi-State Models › Penalized Regression With Many Transition Covariates

Regression for Multi-State Data · Tutorial 375 of 699

Penalized Regression With Many Transition Covariates

Learn to specify ridge and lasso penalties for transition regression and understand why penalty scaling changes the balance between shared and transition-specific effects.

Advanced 12 min read

What You'll Learn

  • Write ridge and lasso objectives using separate likelihood contributions for each transition.
  • Distinguish a coefficient shared across transitions from transition-specific coefficients and deviations.
  • Explain why repeating a shared coefficient's penalty across transitions changes its shrinkage.
  • Relate penalty strength to predictor scaling and to whether the likelihood is summed or averaged.
  • Derive ridge shrinkage and lasso thresholding in a simple quadratic example.
  • Identify practical checks for penalty specification, tuning, and interpretation.

Why Penalize Transition Regression?

A multi-state model may assign a separate regression coefficient to each transition. This flexibility can be useful when a covariate has different associations with different transition hazards, but it also increases the number of parameters. When there are many covariates, some transition-specific estimates may be unstable or difficult to interpret. Ridge and lasso penalties constrain the fitted coefficients by adding a penalty to the likelihood objective.

The penalty does not repair a wrongly specified transition model, create information where there are few events, or establish a causal effect. Its role is to trade some fit to the observed data for coefficient shrinkage. The analyst must specify which coefficients are shared, which may differ by transition, how predictors are scaled, and how the likelihood and penalty are normalized.

Transition-Specific Likelihood and Penalty

Let \(r=1,\ldots,K\) index the transitions in the model, and let \(j=1,\ldots,p\) index covariates. For a proportional-hazards transition model, one possible specification is

$$ \lambda_r(t\mid X_i(t))=\lambda_{0r}(t)\exp\{X_i(t)^\top\beta_r\}, $$

where \(\lambda_r\) is the hazard for transition \(r\), \(\lambda_{0r}\) is its baseline hazard, and \(\beta_r=(\beta_{r1},\ldots,\beta_{rp})^\top\). The covariate vector \(X_i(t)\) can reflect time-varying covariates when these are part of the model. Each transition has its own risk sets and event contributions. Write \(\ell_r(\beta_r)\) for its log partial likelihood, or more generally for its contribution to the chosen log-likelihood. The combined log-likelihood is \(\sum_{r=1}^K\ell_r(\beta_r)\).

The usual likelihood interpretation presumes an appropriate model for the transition hazards and risk sets, correctly recorded covariates and transitions, and independent subjects under the sampling design. For a partial-likelihood analysis, the censoring and observation process must also support the partial-likelihood argument. The penalty definitions below specify an optimization procedure; they do not make these modeling conditions true.

Definition: With \(\beta_{rj}\) denoting the coefficient of covariate \(j\) for transition \(r\), ridge regression minimizes the negative log-likelihood plus a squared-coefficient penalty. Lasso regression minimizes the negative log-likelihood plus an absolute-value penalty. With nonnegative penalty parameters \(\lambda_2\) and \(\lambda_1\), respectively, one common convention is
$$ -\sum_{r=1}^K\ell_r(\beta_r) +\frac{\lambda_2}{2}\sum_{r=1}^K\sum_{j=1}^p w_{rj}\beta_{rj}^2 \qquad\text{(ridge),} $$
$$ -\sum_{r=1}^K\ell_r(\beta_r) +\lambda_1\sum_{r=1}^K\sum_{j=1}^p w_{rj}|\beta_{rj}| \qquad\text{(lasso).} $$

The \(w_{rj}\) are prespecified nonnegative penalty weights, often used to account for predictor scaling or to leave selected terms unpenalized. The factor \(1/2\) in the ridge definition is a convention that simplifies derivatives; it is not an additional statistical assumption. Usually baseline-hazard parameters are not included in these coefficient penalties. A zero penalty parameter gives the unpenalized objective. For positive penalties, ridge generally shrinks estimates toward zero without setting them exactly to zero; lasso can set some estimates exactly to zero.

What the Penalties Do: A Quadratic Illustration

A short calculation makes the difference between the penalties explicit. Suppose, for one standardized coefficient \(b\), the negative log-likelihood near its unpenalized estimate \(z\) is approximated by \(\tfrac12(b-z)^2\). This is a one-parameter quadratic illustration, not a claim that a transition likelihood is exactly quadratic. With ridge, differentiating the penalized objective gives

$$ \frac{d}{db}\left\{\frac12(b-z)^2+\frac{\lambda_2}{2}b^2\right\} =(b-z)+\lambda_2b=0, \qquad \widehat b_{\mathrm{ridge}}=\frac{z}{1+\lambda_2}. $$

The estimate is moved continuously toward zero. For lasso, minimize \(\tfrac12(b-z)^2+\lambda_1|b|\). If the solution is positive, its derivative is \(b-z+\lambda_1\), giving \(b=z-\lambda_1\), which is valid when \(z>\lambda_1\). If it is negative, the derivative is \(b-z-\lambda_1\), giving \(b=z+\lambda_1\), valid when \(z<-\lambda_1\). When \(|z|\leq\lambda_1\), the minimum is at zero. Together these cases give the soft-thresholding rule

$$ \widehat b_{\mathrm{lasso}} =\operatorname{sign}(z)\max(|z|-\lambda_1,0). $$

In a multi-parameter transition model, the likelihood curvature and correlations among covariates affect the joint estimates, so these one-coefficient formulas are not generally the fitted solution. They explain the distinct tendencies: ridge distributes shrinkage across coefficients, whereas lasso can remove individual coefficients from the fitted model.

Worked Example: Ridge Shrinkage and Lasso Thresholding

Suppose a hypothetical standardized coefficient has unpenalized estimate \(z=1.20\), and its local quadratic objective is \(\tfrac12(b-1.20)^2\). Compare ridge and lasso with penalty parameter \(0.50\), using the conventions above.

Ridge. Substituting into the ridge formula gives

$$ \widehat b_{\mathrm{ridge}}=\frac{1.20}{1+0.50} =\frac{1.20}{1.50}=0.800. $$

Lasso. Since \(|1.20|>0.50\), the estimate is not thresholded to zero:

$$ \widehat b_{\mathrm{lasso}} =\operatorname{sign}(1.20)\max(1.20-0.50,0) =0.700. $$

For a second hypothetical coefficient with \(z=-0.40\), ridge gives \(-0.40/1.50=-0.267\), while lasso gives \(\operatorname{sign}(-0.40)\max(0.40-0.50,0)=0\). The zero is a consequence of lasso thresholding in this illustration; it does not show that the corresponding covariate has no association in the population.

Shared Effects and Transition-Specific Deviations

The penalty must reflect the model's parameterization. A coefficient constrained to be the same for every transition is one shared parameter, even though it contributes to every transition's likelihood. In contrast, if each transition has its own coefficient, there are \(K\) parameters for that covariate. Penalizing each of those parameters is not equivalent to penalizing one shared coefficient.

One explicit way to model both components is to write

$$ \beta_{rj}=\gamma_j+\delta_{rj}, \qquad \sum_{r=1}^K\delta_{rj}=0. $$

Here \(\gamma_j\) is the unweighted average coefficient across transitions, and \(\delta_{rj}\) is transition \(r\)'s deviation from that average. The constraint is needed: without it, increasing \(\gamma_j\) and subtracting the same amount from every \(\delta_{rj}\) leaves all \(\beta_{rj}\) unchanged. This decomposition is a model choice, not merely a computational trick.

Separate penalties on the shared and deviation terms allow different amounts of shrinkage. For example, a ridge objective can include

$$ -\sum_{r=1}^K\ell_r(\gamma+\delta_r) +\frac{\lambda_\gamma}{2}\sum_{j=1}^p v_j\gamma_j^2 +\frac{\lambda_\delta}{2}\sum_{r=1}^K\sum_{j=1}^p u_{rj}\delta_{rj}^2, \qquad \sum_{r=1}^K\delta_{rj}=0. $$

The analogous lasso objective replaces the squared terms by absolute values and uses the corresponding lasso tuning parameters. A penalty on \(\gamma_j\) acts once on the shared parameter; the deviation penalty acts on each transition's departure from sharing. The parameterization and penalties should be stated together, because applying a penalty to the \(\beta_{rj}\) values instead would impose a different shrinkage structure.

Worked Example: Counting the Penalty for a Shared Effect

Suppose a hypothetical model has three transitions and one standardized covariate. Compare a shared coefficient \(\beta=0.60\) with three transition-specific coefficients \((0.60,0.60,0.60)\), using \(\lambda_2=0.40\) and unit weights. This calculation compares penalty contributions only; it does not compare fitted likelihoods.

For one shared ridge coefficient, the penalty is

$$ \frac{0.40}{2}(0.60)^2 =0.20(0.36)=0.0720. $$

If the same numerical coefficient is instead represented by three separately estimated transition coefficients, each is penalized. The total penalty is

$$ \frac{0.40}{2}\left\{(0.60)^2+(0.60)^2+(0.60)^2\right\} =0.20(1.08)=0.216. $$

Thus, with the same numerical tuning parameter, repeating the coefficient across three transition-specific terms gives three times the ridge penalty of one shared term. Under lasso, the corresponding penalties are \(0.40|0.60|=0.240\) for one shared term and \(0.40(3|0.60|)=0.720\) for three separate terms. If a software implementation adds the same shared-coefficient penalty once per transition, it is imposing the latter scaling rather than a single penalty on one shared parameter.

Deviation penalties also require a scaling choice. For deviations \((0.30,-0.10,-0.20)\), which sum to zero, the ridge penalty with \(\lambda_\delta=0.40\) is

$$ \frac{0.40}{2}\{0.30^2+(-0.10)^2+(-0.20)^2\} =0.20(0.14)=0.0280. $$

Using the average squared deviation instead would divide this contribution by three. Neither convention is universally correct; it changes the effective strength of shrinkage and must be matched to the tuning procedure.

Scaling, Tuning, and Practical Checks

Penalty strength depends on scale. If one covariate is measured in millimetres and another in metres, their unscaled coefficients can differ greatly even when the underlying effects are comparable. A squared or absolute-value penalty acts on the coefficient scale, so a change in measurement units changes the penalty unless the covariate is standardized or its penalty weight is adjusted. For a shared effect, use a scaling convention that preserves the intended meaning of comparing that covariate across transitions; separate transition-specific standardizations can make the coefficients refer to different covariate units.

The numerical value of \(\lambda\) also depends on whether the negative log-likelihood is summed or averaged. Let \(L_{\mathrm{sum}}\) be the negative log-likelihood and let \(P\) be a penalty. If there are \(M\) likelihood contributions in the chosen normalization, then

$$ L_{\mathrm{sum}}+\lambda_{\mathrm{sum}}P \quad\text{and}\quad \frac{L_{\mathrm{sum}}}{M}+\lambda_{\mathrm{avg}}P $$

have the same minimizer when \(\lambda_{\mathrm{sum}}=M\lambda_{\mathrm{avg}}\). Dividing the first objective by \(M\) shows why:

$$ \frac{L_{\mathrm{sum}}+\lambda_{\mathrm{sum}}P}{M} =\frac{L_{\mathrm{sum}}}{M}+\frac{\lambda_{\mathrm{sum}}}{M}P. $$

Consequently, penalty values are not portable across software or analyses unless the objective normalization, weights, and coefficient parameterization agree. Tune the penalty using a criterion aligned with the goal, such as held-out predictive performance, and compare candidate penalties under the same normalization. When observations contribute to multiple transitions, validation splits should keep all records from a subject together so that information from the same subject does not appear in both training and validation data.

1
Specify the transition parameters.
Write which coefficients are shared and which are transition-specific. If using shared-plus-deviation terms, state the identifying constraint.
2
Set the penalty scale.
Record predictor scaling, penalty weights, whether shared terms are penalized once, and whether transition penalties are summed or averaged.
3
Check the fitted path.
Inspect estimates across a range of tuning parameters, confirm that ridge coefficients shrink and lasso zeros occur as expected, and check that optimization converges.
4
Assess stability and purpose.
Check sensitivity to scaling, tuning choices, and plausible model specifications. Treat selected variables as model-dependent, not as proven effects.

Warning signs include coefficients changing dramatically after a unit conversion, a shared term being penalized once per transition unintentionally, or very different results after replacing a summed likelihood with its average without adjusting \(\lambda\). A flat or unstable tuning curve can also indicate that the data do not clearly distinguish candidate penalty strengths. Convergence alone does not establish that the model, risk sets, or penalty coding is appropriate.

How Penalization Compares with Alternatives

ApproachCoefficient behaviorImportant distinction
Unpenalized transition regressionEstimates all specified coefficients without shrinkage.Does not impose the deliberate bias introduced by a penalty, but may yield unstable estimates when many terms are fitted.
RidgeShrinks coefficients continuously toward zero; typically retains all terms.Useful when many effects may contribute, but does not provide exact variable exclusion.
LassoShrinks and can set individual coefficients exactly to zero.Selection depends on scaling and tuning; a selected zero is not a hypothesis test or proof of no effect.
Shared-coefficient modelUses one coefficient across the transitions to which it applies.Reduces the number of distinct coefficients by imposing equality, rather than shrinking transition-specific coefficients toward zero.

These approaches answer different modeling questions. Ridge and lasso regularize the specified coefficients; they do not automatically determine which effects should be shared. Conversely, imposing a common coefficient is a structural restriction, not a generic substitute for a penalty. Inference for penalized estimates also requires care: ordinary unpenalized standard errors and tests do not automatically account for shrinkage and data-driven tuning. Penalized coefficients are most directly interpreted as regularized model estimates, with uncertainty and validation handled using methods appropriate to the analysis goal.

Common Mistake and Limitations

Common pitfall: “The covariate appears in three transition likelihoods, so its shared coefficient should be penalized three times.” That reasoning confuses repeated likelihood contributions with repeated parameters. If the coefficient is one shared parameter, a penalty on that parameter is ordinarily written once. Replicating its penalty multiplies the penalty contribution and therefore changes the fitted objective. State the parameterization and penalty explicitly, then verify how the software implements them.

Penalties are sensitive to coding choices, including predictor scales, dummy-variable construction, weights, and likelihood normalization. Lasso's individual-term sparsity can be awkward when several encoded coefficients jointly represent a categorical covariate; ridge avoids exact exclusion but still depends on scaling. Neither method guarantees stable estimates when transition information is limited, and penalization cannot overcome nonidentifiability or a misspecified transition structure. These limitations motivate careful diagnostics and sensitivity checks rather than interpreting the penalty as an automatic solution.

Check Your Understanding

Try each question, then check the solutions below.

  1. For three transition-specific coefficients, what ridge penalty contribution results when all are \(0.50\), with unit weights and \(\lambda_2=0.20\)?
  2. In a one-coefficient quadratic illustration, the unpenalized estimate is \(z=-0.30\) and the lasso tuning parameter is \(0.40\). What is the lasso estimate?
  3. If an objective uses the average of \(M=100\) likelihood contributions, what averaged-objective tuning parameter corresponds to \(\lambda_{\mathrm{sum}}=3.0\) in the summed objective?
  4. Why does a shared coefficient need an identifying constraint when written as a common effect plus transition deviations?

Solutions. (1) The penalty is \(\frac{0.20}{2}\{3(0.50)^2\}=0.10(0.75)=0.0750\). (2) Since \(|-0.30|<0.40\), soft thresholding gives \(\operatorname{sign}(-0.30)\max(0.30-0.40,0)=0\). (3) The equivalent averaged-objective value is \(\lambda_{\mathrm{avg}}=\lambda_{\mathrm{sum}}/M=3.0/100=0.0300\). (4) Without a constraint, adding a constant to the common effect and subtracting it from every deviation leaves each transition coefficient unchanged, so the decomposition is not unique.

Clinical Biostats