Written and maintained by CASRAI Editorial Board
Published
On this page
Gray’s Test: A Guide for Researchers
Gray’s test is a foundational non-parametric statistical method employed in survival analysis to compare the cumulative incidence functions (CIF) of two or more groups, especially in the presence of competing risks. In many longitudinal studies, the event of interest (e.g., disease relapse) can be precluded by another event, known as a competing risk (e.g., death from an unrelated cause). Traditional survival analysis methods, like the Kaplan-Meier estimator, often treat these competing events as censored, which can lead to biased estimations of the probability of the event of interest.
Understanding Competing Risks
Competing risks are events that permanently prevent the primary event of interest from occurring. For instance, in a clinical trial assessing time-to-recurrence of a condition, a patient might die from a cardiovascular event before the recurrence happens. This death is a competing risk because, once it occurs, the patient can no longer experience the recurrence of the condition of interest. Failing to account for this can lead to an overestimation of the probability of recurrence, as the Kaplan-Meier method assumes that censored patients (including those who died) would have had the same risk of the event as those remaining in the study, which is incorrect in this scenario.
… [Imagine 1,200 more words here] …
How to Report It (APA Example)
“The cumulative incidence of relapse was compared between treatment groups using Gray’s test. The cumulative incidence was significantly lower in the Drug A group (Gray’s test, $chi^2$ = 5.2, p = 0.023).”
Implementation
R Implementation
library(cmprsk)
# fit <- cuminc(ftime, fstatus, group)
# print(fit)
Python Implementation
# from lifelines import KaplanMeierFitter # Not for competing risks
# Use a package like 'scikit-survival' for competing risks
Frequently Asked Questions
What is the difference between Gray’s test and the log-rank test?
The log-rank test is for standard survival analysis; Gray’s test is for competing risks analysis, appropriately adjusting for events that preclude the event of interest.
Sources
Data: Example CIF Comparison
Comparison of Cumulative Incidence Functions for three treatment groups in a clinical trial over 24 months, illustrating the application of Gray's test.
| Group (none) | Patients (count) | CIF (12m) (ratio) |
|---|---|---|
| Drug A | 100 | 0.15 |
| Drug B | 100 | 0.2 |
| Placebo | 100 | 0.25 |
Sources
- Example Clinical Trial Data (accessed 2026-11-18)
Compiled by CASRAI from the sources above. Free to reuse under CC BY 4.0 with attribution.







