Skip to main content
v2026.11,986 entries · CC-BY 4.0

Gray’s Test: A Guide for Researchers

Use Gray’s test for survival analysis with competing risks. This guide covers definitions, formulas, examples, and statistical implementation for researchers.

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.

Example CIF Comparison
Group (none)Patients (count)CIF (12m) (ratio)
Drug A1000.15
Drug B1000.2
Placebo1000.25

Sources

Compiled by CASRAI from the sources above. Free to reuse under CC BY 4.0 with attribution.

Follow CASRAI

Research-administration guidance, standards updates and independent tool reviews.

Ask CASRAI · free to try

Ask about Gray’s Test: A Guide for Researchers

2 free questions a day, no account.

An AI assistant for research: funder rules, compliance, methods and publishing. It links the sources behind its answers and labels answers that come from a web search.

Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.

Works on this site and inside Claude, Cursor and the AI tools you already use.

Everything CASRAI publishes — this page, the dictionary, the guides and the news — stays open to read, with no account and no card.

Referenced across the research world

University of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logoUniversity of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logo
  • University of Cambridge logo
  • Columbia University logo
  • Crossref logo
  • University of Edinburgh logo
  • Harvard University logo
  • University of Oxford logo
  • Princeton University logo
  • Stanford School of Medicine logo
  • University College London logo
  • ORCID logo

View CASRAI adoption →