Example

Worked example of trend test on larynx cancer data with 4 disease stages.

Data

Larynx cancer patients, , grouped by disease stage (I, II, III, IV). Variable = time to death (months). Goal: determine if hazard of death increases with disease stage.

Step 1: Descriptive Analysis

KM curves by stage show a clear ordering: Stage I (highest survival) → Stage IV (lowest survival). Boxplots of survival time show decreasing median survival with increasing stage.

Step 2: K-Sample Test (Omnibus)

First, test if any difference exists:

fit <- survdiff(Surv(time, status) ~ as.factor(stage), data = dat)
fit

If is rejected, proceed to trend test for the ordered alternative.

Step 3: Trend Test with Scores

Assign scores for stages I–IV ():

R Implementation (using Cox model for trend):

# Treat stage as numeric for trend
fit_trend <- coxph(Surv(time, status) ~ as.numeric(stage), data = dat)
summary(fit_trend)

Step 4: Results Interpretation

Coefficients (Cox model with stage as factor, stage I as reference):

StageCoefficientHazard Ratio
I (ref)01.000
II0.06481.0676.7% higher than stage I
III0.61481.84984.9% higher than stage I
IV1.73495.667466.7% higher than stage I

Trend pattern: — confirming increasing hazard with stage.

Likelihood ratio test: p-value = 0.0009 → reject , conclude a significant increasing trend.

Step 5: Partial Testing

Identify which specific stages differ significantly:

ComparisonCoefficientp-valueSignificant ()?
Stage II vs I0.06480.8876No
Stage III vs I0.61480.0949At
Stage IV vs I1.7349< 0.05Yes

Conclusion: Hazard of death increases with larynx cancer stage. Stage IV patients have significantly higher hazard than stage I. The increase from stage II to III is borderline significant. Stage I and II are not significantly different.

Interpretation

The trend test is more powerful than the omnibus k-sample test when groups have a natural ordering. Use the omnibus test to establish that some difference exists, then the trend test to confirm the direction of the difference.