From the Event Model to Software Inputs
A joint model combines a longitudinal submodel with an event submodel, but the event data still need their own clear specification. For each subject, the software must know when that subject entered observation, when follow-up ended, and whether the endpoint occurred or was censored. It must also know which covariates enter the event hazard and how the baseline hazard is represented. A correctly fitted longitudinal trajectory cannot compensate for an event formula or risk set that does not match the intended analysis.
The event covariates in this tutorial are denoted by \(w_i\), with coefficient vector \(\gamma\). A joint model may also include a contribution linking the event process to the longitudinal process. We denote that contribution generically by \(q_i(t)\); choosing its form is a separate modeling decision. The focus here is how the event covariates, event records, risk set, and baseline hazard are represented.
For a static covariate with coefficient \(\gamma_j\), a one-unit increase multiplies the hazard by \(\exp(\gamma_j)\), holding the other modeled quantities fixed. This is a conditional hazard ratio, not a risk ratio and not a causal effect by itself. The baseline hazard determines how the hazard changes over time for the reference covariate values; the covariate terms multiply it.
Event Records and the Risk Set
For a single event and no delayed entry, an event table usually has one row per subject, with an observed follow-up time and an event indicator. The indicator is 1 if the event occurred at that time and 0 if observation ended through censoring. With delayed entry, the record also needs an entry time. A standard counting-process representation is \(\operatorname{Surv}(\text{entry},\text{exit},\text{event})\); without delayed entry, it is \(\operatorname{Surv}(\text{exit},\text{event})\). The notation may vary across software, so verify the response definition rather than relying on a variable name.
At time \(t\), the risk set \(R(t)\) consists of subjects who have entered observation by \(t\) and have not had an event or been censored before \(t\). With entry time \(L_i\) and exit time \(T_i\), a common convention is \(R(t)=\{i:L_i<t\leq T_i\}\). Exact endpoint conventions depend on the software's handling of tied times, so event and entry times should be encoded consistently with its documentation. A subject who has not yet entered must not contribute person-time to the risk set.
The event table is not simply the longitudinal table copied into a survival function. Longitudinal data often have several rows per subject, whereas a basic event record has one follow-up record per subject. Supplying repeated measurement rows as if they were independent event records can duplicate subjects in risk sets and distort the likelihood. Software that supports time-varying covariates may use start-stop records, but those records must represent nonoverlapping intervals correctly; they are not a substitute for selecting a joint-model interface that handles the intended longitudinal linkage.
Worked Example: Checking Who Is at Risk
Suppose four hypothetical subjects have the following observation records. Times are in months.
| Subject | Entry | Exit | Event indicator |
|---|---|---|---|
| A | 0 | 4 | 1 |
| B | 0 | 8 | 0 |
| C | 3 | 6 | 1 |
| D | 0 | 7 | 0 |
At month 5, subject A has already had the event and is no longer at risk. Subjects B and D remain under observation, and C has entered at month 3 and remains under observation. Thus \(R(5)=\{B,C,D\}\). At month 6, C has the event, and the risk set immediately before that event is also \(\{B,C,D\}\). A subject with entry after month 5 would not be included at month 5, even if that subject later experienced an event.
For illustration, suppose the fitted event-covariate contribution is \(\gamma x_i\), with \(\gamma=0.4\), and \(x_B=0,\ x_C=1,\ x_D=0\). The Cox partial-likelihood contribution for C's event at month 6, ignoring any tied events, is $$ \frac{\exp(0.4x_C)} {\sum_{j\in R(6)}\exp(0.4x_j)} = \frac{\exp(0.4)} {\exp(0)+\exp(0.4)+\exp(0)} = \frac{1.4918}{3.4918} \approx 0.4272. $$ This calculation uses C as the event subject and includes only subjects in the risk set. It is not a complete model fit; it illustrates why correct entry, exit, and event coding matter.
Choosing and Encoding the Baseline Hazard
Under the Cox proportional-hazards model, \(h_0(t)\) is left unspecified rather than assigned a particular smooth distribution. Estimation of the regression coefficients uses a partial likelihood based on the event times and their risk sets. This avoids choosing a parametric shape for the baseline hazard, but it does not mean the baseline hazard is irrelevant: software can estimate it after fitting, and absolute survival predictions require a baseline cumulative hazard estimate as well as the covariate effects. Tied event times require a specified handling method, commonly a Breslow or Efron approximation, or an exact method when available and appropriate.
A parametric baseline instead assigns a distributional form to the event-time process. For example, in a Weibull proportional-hazards parameterization with shape \(k>0\) and scale \(\lambda>0\), time measured in the same units as \(\lambda\), the baseline hazard is $$ h_0(t)=\frac{k}{\lambda}\left(\frac{t}{\lambda}\right)^{k-1}. $$ The baseline hazard has units of inverse time. This form is constant when \(k=1\), increases over time when \(k>1\), and decreases when \(0<k<1\). Choosing a parametric baseline gives a complete hazard shape, but a poor shape assumption can misrepresent event-time behavior. A package may offer other parametric forms, piecewise-constant hazards, or spline-based baselines; available choices and their parameterizations are interface-specific.
Worked Example: Computing a Weibull Hazard
Assume, hypothetically, a Weibull proportional-hazards baseline with shape \(k=1.4\) and scale \(\lambda=10\) months. At \(t=4\) months, the baseline hazard is $$ h_0(4)=\frac{1.4}{10}\left(\frac{4}{10}\right)^{1.4-1} =0.14(0.4)^{0.4} \approx 0.09704\ \text{per month}. $$ Suppose a binary event covariate has coefficient \(\gamma=\log(1.5)\), and the subject has covariate value \(w_i=1\), with the separate joint contribution set to zero for this calculation. The covariate multiplier is $$ \exp\{\gamma w_i\}=\exp\{\log(1.5)\}=1.500. $$ Therefore the subject-specific hazard at month 4 is $$ h_i(4)=0.097040278\ldots\times 1.500 \approx 0.1456\ \text{per month}. $$ This is the instantaneous event rate at that time under the assumed model, not the probability of an event during the fourth month. The calculation depends on the Weibull parameterization and on time being measured in months, so those details must agree with the software's specification.
Translating the Specification Into an Interface
Joint-model software differs in its formula names and argument structure. Some interfaces take an event-survival formula separately from the longitudinal model; others specify event formulas and baseline-hazard options in dedicated arguments. The following is schematic R-style notation, not a universal, directly executable call:
Read this as: define the event response using the entry time, exit time, and event indicator, and include age and treatment as event-model covariates. For a cohort without delayed entry, the response is typically represented with exit time and event indicator only. The baseline choice is then selected through the interface's documented option, such as a Cox proportional-hazards baseline or a named parametric baseline. The names of the formula argument, baseline option, and supported event-response forms vary by package and version; confirm them from that version's documentation instead of copying a call blindly.
The event formula should contain the intended event covariates, not the subject identifier, an outcome-derived label, or every longitudinal measurement as a separate row. If a covariate is constant per subject, verify that the value supplied to the event component is the same for all that subject's longitudinal records. If the model uses a joint longitudinal contribution, make sure the chosen interface explicitly supports that joint structure. The event formula alone does not create the longitudinal-event association.
Worked Example: Translating Covariates Into an Event Formula
Consider a hypothetical cohort with delayed entry. The planned event model includes age at entry (in years) and randomized treatment (0 for control, 1 for active treatment). The event table has one record per subject, with entry month, exit month, event status, age, and treatment. The intended event formula is schematically \(\operatorname{Surv}(\text{entry},\text{exit},\text{event})\sim\text{age}+\text{treatment}\), with the selected baseline option specified separately.
Suppose the estimated coefficients are \(\hat{\gamma}_{\text{age}}=0.03\) per year and \(\hat{\gamma}_{\text{treatment}}=-0.50\). Comparing two subjects who differ by 10 years in age and by treatment status (active versus control), the fitted covariate hazard ratio is $$ \exp\{0.03(10)-0.50(1)\} =\exp(-0.20) \approx 0.8187. $$ Under the fitted proportional-hazards terms, the active-treatment subject's hazard is about 0.819 times that of the comparison subject at the same time, conditional on the other model quantities. The numerical interpretation is conditional and does not establish a treatment effect without an appropriate design and causal assumptions. The formula, time units, and coding of treatment must be checked before giving this interpretation.
Justification: Why Cox Risk Sets Remove the Baseline
The role of the risk set in Cox estimation follows directly from the hazard form. For a single event at time \(t\), suppose subject \(i\) is the event subject and all subjects in \(R(t)\) are at risk just before \(t\). Under the proportional-hazards model, the relative hazard for subject \(i\) among those at risk is $$ \frac{h_i(t)}{\sum_{j\in R(t)}h_j(t)} = \frac{h_0(t)\exp\{\gamma^\mathsf{T}w_i+q_i(t)\}} {\sum_{j\in R(t)}h_0(t)\exp\{\gamma^\mathsf{T}w_j+q_j(t)\}}. $$ Because the same \(h_0(t)\) multiplies each risk-set member, it cancels: $$ \frac{\exp\{\gamma^\mathsf{T}w_i+q_i(t)\}} {\sum_{j\in R(t)}\exp\{\gamma^\mathsf{T}w_j+q_j(t)\}}. $$ Multiplying these contributions across event times gives the basic form of the Cox partial likelihood when there are no ties; tie-handling methods modify the contribution at tied times. This cancellation explains both the appeal and the limits of the Cox approach: regression coefficients can be estimated without specifying a baseline shape, but the risk sets must be right, and absolute hazard or survival estimates require additional baseline-hazard estimation.
Assumptions, Diagnostics, and Common Failure Modes
Before fitting, state the assumptions relevant to the chosen event model. Subjects are assumed independent of one another, conditional on the modeled structure. Censoring is assumed noninformative conditional on included information: broadly, after conditioning on the model variables, censoring should not carry unmodeled information about the event time. Proportional-hazards forms assume that a covariate's hazard ratio does not vary with time unless a time-varying effect is explicitly specified. A parametric baseline additionally assumes that its chosen hazard shape is adequate. Joint-model assumptions also apply to the longitudinal-event linkage, but they are not verified merely by selecting an event formula.
Check event coding by comparing the number of events in the input with the intended analysis data, and inspect minimum and maximum entry and exit times. Confirm that event times are positive and expressed in consistent units, that censored observations have event indicator 0, and that delayed-entry subjects enter only when observation begins. Inspect the event formula and baseline option in the fitted model object or printed summary; software output should agree with the planned specification. For Cox models, examine proportional-hazards diagnostics and the handling of tied times. For parametric baselines, inspect fit and residual diagnostics appropriate to the model, and compare plausible baseline forms when justified. These checks can identify mismatches; they do not prove that assumptions hold.
A frequent mistake is to treat the baseline option as a cosmetic software setting. It is part of the statistical model: a Cox baseline and a Weibull baseline do not make the same assumption about the hazard over time. Another common error is to interpret a software's default as the intended choice without checking its documentation. Defaults may differ across packages or versions, and an option with a similar name may use a different parameterization.
A further pitfall is to read the number of longitudinal rows as the number of event records. If each subject has six biomarker visits, that does not mean that subject contributes six independent event outcomes. Event records, interval records, and repeated-measurement records have different roles. Use an interface that represents the planned joint model and event structure directly, then check that each subject's event information is attached once in the intended manner.
| Choice | What is specified | Main implication |
|---|---|---|
| Cox baseline | No parametric shape for \(h_0(t)\) | Uses risk sets for coefficient estimation; baseline estimation is needed for absolute predictions. |
| Parametric baseline | A named hazard or survival-time distribution | Provides a full baseline shape but depends on its adequacy. |
| Piecewise or spline baseline | A flexible baseline representation, if supported | Allows more shape flexibility but requires choices such as intervals or smoothing. |
The practical comparison is not that one baseline is universally superior. Cox modeling reduces reliance on a chosen baseline distribution, while parametric modeling can be efficient and directly yields a complete time-to-event distribution when its form is reasonable. In a joint model, computational methods and supported structures may also restrict the available choices. Check both statistical assumptions and software capabilities before selecting an approach. No baseline choice repairs incorrect risk sets, unsupported delayed-entry handling, or a misclassified event indicator.
Check Your Understanding
Answer each question, then compare your reasoning with the solutions.
- A subject enters at month 2, is censored at month 9, and has event indicator 0. Is this subject in the risk set at month 1? At month 5?
- What is the hazard ratio for a one-unit increase in a covariate whose fitted coefficient is \(-0.25\)?
- For a Weibull baseline with \(k=1\), what is the baseline hazard over time?
- Why should a longitudinal table with several visits per subject not automatically be supplied as several event records?
Solutions. (1) No at month 1, because the subject has not entered observation; yes at month 5, because entry has occurred and censoring has not yet ended follow-up. (2) \(\exp(-0.25)\approx0.7788\), so the fitted hazard is about 0.779 times as large per one-unit increase, conditional on the other model terms. (3) Since \((t/\lambda)^{k-1}=1\) when \(k=1\), \(h_0(t)=1/\lambda\), a constant hazard. (4) Repeated visit rows are repeated measurements, not independent event outcomes; duplicating them as event records can place a subject into risk sets multiple times and alter the likelihood.