What a Fine–Gray Fit Estimates
A Fine–Gray model relates covariates to the cumulative incidence function (CIF) for one event type in the presence of competing events. It is useful when the scientific question concerns the probability of experiencing a particular event by a given time, while recognizing that other event types can prevent that event from occurring. This tutorial focuses on fitting the model with R’s cmprsk::crr function and obtaining coefficient estimates and standard errors.
Let \(T\) be the time to the first event, \(J\) the event type, and \(k\) the event type of interest. The CIF for cause \(k\), conditional on covariates \(z\), is \(F_k(t\mid z)=P(T\leq t,J=k\mid z)\). Unlike a cause-specific Cox model, the Fine–Gray model is built directly around this CIF through the cause-\(k\) subdistribution hazard.
The conceptual risk set for this hazard differs from an ordinary Cox risk set: people who experience a competing event are retained in the subdistribution risk set, with weighting to account for censoring. Consequently, crr is not simply a Cox regression with competing events coded as censored. Its estimation procedure uses censoring adjustments, and the resulting coefficient is interpreted on the subdistribution hazard scale.
Data and Model Assumptions
For each person, prepare a follow-up time, a status code, and a row of covariates. The follow-up time is the time to the first event or censoring. The status code must distinguish the event of interest, each competing event, and censoring. In the call to crr, the arguments failcode and cencode identify the target event and the censoring code; every other non-censoring status represents a competing event.
These assumptions are substantive, not guaranteed by successful code execution. In particular, an estimate from a model with a time-varying covariate effect is a potentially misleading summary if interpreted as a constant SHR. The next tutorial addresses residuals and time interactions; here, the priority is to specify and fit the intended model correctly.
The crr function takes a covariate matrix rather than an R formula. Construct the matrix explicitly, check factor reference categories, and remove the intercept. Rows in the time, status, and covariate inputs must refer to the same people in the same order. Handle missingness consistently before fitting; do not allow the three inputs to silently represent different subsets.
Worked Example: Coding the Target Event and Covariates
Suppose a hypothetical cohort follows 240 patients from treatment initiation. Status is coded 0 for censoring, 1 for disease progression, and 2 for death before progression. The target is progression. Recorded covariates are treatment group, with “standard” as the reference, and age in years. The event counts are 82 progressions, 58 deaths, and 100 censored observations; these sum to 240.
The target event is code 1, and code 0 is censoring. Death, code 2, is therefore treated as a competing event, not as censoring. The R setup is:
X <- model.matrix(~ treatment + age, data = dat)[, -1, drop = FALSE]
fit <- cmprsk::crr(ftime = dat$time, fstatus = dat$status, cov1 = X, failcode = 1, cencode = 0)
With standard treatment as the reference category, the treatment column in X compares the other treatment group with standard. Removing the first model-matrix column removes the intercept; crr estimates a baseline subdistribution hazard rather than an intercept coefficient. Before fitting, verify that dat$time, dat$status, and the rows of X all have length 240 and the same ordering. These coding choices match the stated question: progression is the event of interest, while death prevents later progression and is a competing event.
Fitting and Reading the Output
A minimal call has the structure cmprsk::crr(ftime, fstatus, cov1, failcode, cencode). The returned object includes coefficient estimates in fit$coef and an estimated coefficient covariance matrix in fit$var. The estimated standard error for coefficient \(j\) is the square root of the corresponding diagonal element of that matrix:
A large-sample Wald statistic for testing \(H_0:\beta_j=0\) is \(z=\hat\beta_j/\widehat{SE}(\hat\beta_j)\). A two-sided p-value is calculated from the standard normal distribution as \(2P(Z\geq |z|)\), where \(Z\sim N(0,1)\). A corresponding approximate 95% confidence interval on the coefficient scale is \(\hat\beta_j\pm1.96\widehat{SE}(\hat\beta_j)\); exponentiating its endpoints gives a confidence interval for the SHR. These are large-sample Wald calculations, so they can be unreliable with sparse events or imprecise estimates.
The crr output also contains other components, including residual-related quantities. This fitting tutorial uses the coefficient and covariance components to obtain estimates and standard errors; it does not treat successful convergence as evidence that model assumptions hold.
Worked Example: Calculating an SHR and Its Confidence Interval
In a hypothetical fitted model for progression, suppose the coefficient for a treatment indicator is \(\hat\beta=-0.410\), and the corresponding diagonal entry of fit$var is \(0.0196\). The standard error is:
The estimated SHR is:
The approximate 95% interval on the coefficient scale is \(-0.410\pm1.96(0.140)\). Since \(1.96(0.140)=0.2744\), the endpoints are \(-0.6844\) and \(-0.1356\). Exponentiating gives:
The Wald statistic is \(-0.410/0.140=-2.929\), giving a two-sided p-value of approximately 0.0034. Under the model, this is evidence against a zero treatment coefficient. The estimated SHR of 0.664 means the treatment group has an estimated subdistribution hazard of progression 0.664 times that of the reference group, conditional on the other covariates. It does not mean that its progression probability is 0.664 times as large at every time.
Coefficient Scale, Units, and Coding Choices
A coefficient is tied to the units and coding of its covariate. A one-year age effect may be inconvenient to communicate, while a ten-year contrast may be more useful. If age has coefficient \(\hat\beta_{\text{age}}\), the model-implied SHR for a ten-year increase is \(\exp(10\hat\beta_{\text{age}})\), with other covariates held fixed. Its confidence interval is obtained by exponentiating \(10\) times the coefficient-scale interval endpoints. State the contrast and units rather than reporting a bare exponentiated coefficient.
For a factor, the interpretation depends on its reference category and contrast coding. Check the levels and columns in the design matrix before fitting. A mislabeled reference group does not change the underlying fit, but it changes how each coefficient must be described. Similarly, switching the target cause by changing failcode changes the model’s estimand; it is not a cosmetic change to the same analysis.
Worked Example: Interpreting a Ten-Year Age Contrast
Consider a separate hypothetical fit in which age is measured in years and has estimate \(\hat\beta_{\text{age}}=0.0180\) with standard error \(0.0060\). The SHR for a one-year increase is \(\exp(0.0180)=1.018\), approximately a 1.8% increase in subdistribution hazard per year under the model.
For a ten-year increase, multiply the coefficient and its standard error by 10. The contrast estimate is \(10(0.0180)=0.180\), with standard error \(10(0.0060)=0.0600\). Thus:
The model estimates a 1.197-fold subdistribution hazard for a ten-year age increase, adjusted for other included covariates. The interval is on the SHR scale and describes uncertainty in that contrast. It does not directly give a ratio of ten-year cumulative incidences.
Why an SHR Is Not a Risk Ratio
The distinction follows directly from the model. Define the cumulative subdistribution hazard \(H_k^*(t\mid z)=\int_0^t\lambda_k^*(u\mid z)\,du\). Since \(\lambda_k^*=-d\log(1-F_k)/dt\), integration gives \(1-F_k(t\mid z)=\exp\{-H_k^*(t\mid z)\}\). Under the proportional model, \(H_k^*(t\mid z)=H_{k0}^*(t)\exp(\beta^\mathsf{T}z)\), so:
The coefficient multiplies the cumulative subdistribution hazard, but the CIF is a nonlinear transformation that also depends on time and the baseline hazard. Therefore, even if the SHR is constant over time, the ratio of CIFs generally is not. This derivation also explains why a positive coefficient corresponds to a larger modeled CIF at a fixed time, all else equal, while the magnitude of the risk difference depends on time and baseline risk.
A cause-specific Cox model instead models the instantaneous event rate among people still free of every event type. It can be appropriate for questions about that cause-specific rate, but it is not a direct substitute for a Fine–Gray fit when the target is the subdistribution hazard linked to the CIF. Neither coefficient should be described as a causal effect without additional design and causal assumptions.
Diagnostics and Common Failure Modes
Before interpreting output, check that the observed status values are exactly the intended codes, that failcode identifies the desired event, and that cencode identifies censoring. A wrong code can produce a numerically valid fit to the wrong event. Inspect the design matrix for an intercept, duplicated columns, unexpected missing values, and factor levels with no observations. Confirm that every column has a clear interpretation and that the reference groups are as intended.
Warnings, non-finite estimates, or very large standard errors can indicate sparse event information, collinearity, or a coding problem. A fit may also be numerically successful despite poor proportional subdistribution hazards or an unsuitable covariate form. Assess the proportionality assumption and residual behavior rather than assuming that software output validates the model. When censoring varies systematically across groups, consider whether censoring strata are needed and whether the specified cengroup structure is scientifically defensible.
- Wrong: “I coded competing events as censored, so the target event is handled correctly.” Correction: Supply their distinct event codes; with the selected failcode, they are treated as competing events by crr.
- Wrong: “The SHR is a risk ratio.” Correction: It is a ratio of subdistribution hazards; calculate or predict CIFs separately to discuss absolute risk.
- Wrong: “The function returned coefficients, so proportionality holds.” Correction: Estimation output does not establish model adequacy; use appropriate diagnostics.
- Wrong: “A coefficient for treatment means the treatment caused the difference.” Correction: It describes an adjusted model association unless a causal design and assumptions justify causal interpretation.
Check Your Understanding
Answer each question, then compare your reasoning with the solutions.
- A status variable uses 0 for censoring, 1 for relapse, and 2 for death. If relapse is the target in crr, what values should be used for failcode and cencode, and how is death treated?
- A coefficient estimate is \(-0.20\) with standard error \(0.10\). Calculate the SHR and approximate 95% confidence interval.
- Why should a covariate matrix passed to crr normally omit an intercept?
- True or false: an SHR of 1.4 means the CIF is 40% higher at every follow-up time. Explain.
- Name two checks to make if a fit gives an unexpectedly large standard error.
Solutions. (1) Use failcode = 1 and cencode = 0; death, code 2, is a competing event. (2) The SHR is \(\exp(-0.20)=0.819\). The coefficient interval is \(-0.20\pm1.96(0.10)=[-0.396, -0.004]\); exponentiating gives an SHR interval of approximately \([0.673,0.996]\). (3) The model estimates an unspecified baseline subdistribution hazard, so an intercept column is not needed and can create an inappropriate or redundant coefficient. (4) False. An SHR is a subdistribution hazard ratio; the CIF depends nonlinearly on the baseline cumulative subdistribution hazard and time. (5) For example, verify event and censoring codes, inspect event counts and factor levels, check for collinear or duplicate design-matrix columns, and confirm the time, status, and covariate rows are aligned.