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)
fitIf 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):
| Stage | Coefficient | Hazard Ratio | |
|---|---|---|---|
| I (ref) | 0 | 1.000 | — |
| II | 0.0648 | 1.067 | 6.7% higher than stage I |
| III | 0.6148 | 1.849 | 84.9% higher than stage I |
| IV | 1.7349 | 5.667 | 466.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:
| Comparison | Coefficient | p-value | Significant ()? |
|---|---|---|---|
| Stage II vs I | 0.0648 | 0.8876 | No |
| Stage III vs I | 0.6148 | 0.0949 | At |
| Stage IV vs I | 1.7349 | < 0.05 | Yes |
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.