import greenwood as gw
lung = gw.load_dataset("lung", backend="polars")
mc = gw.maxcombo_test("Surv(time, status) ~ sex", data=lung)
mcMaxComboResult(statistic=3.5657, p_value=0.0009956, weights=[(0, 0), (1, 0), (0, 1), (1, 1)])
The outcome of a MaxCombo weighted log-rank test.
Usage
The MaxCombo test is designed to detect survival differences under non-proportional hazards by combining multiple Fleming-Harrington weight functions. The test statistic is the maximum absolute Z across the weight set, and the p-value accounts for the correlation between the Z-statistics.
statistic: floatThe MaxCombo test statistic: the maximum absolute Z-statistic across the weight functions.
p_value: floatP-value from the multivariate normal distribution. The probability of observing a max |Z| this large or larger under the null hypothesis.
z_statistics: dict[tuple[float, float], float]Dictionary mapping each (rho, gamma) weight tuple to its Z-statistic.
correlation: ArrayCorrelation matrix between the Z-statistics under H0, as a NumPy array.
method: strRun a MaxCombo test on the lung dataset, comparing survival by sex. The result holds the Z-statistics for each weight function and the combined p-value:
import greenwood as gw
lung = gw.load_dataset("lung", backend="polars")
mc = gw.maxcombo_test("Surv(time, status) ~ sex", data=lung)
mcMaxComboResult(statistic=3.5657, p_value=0.0009956, weights=[(0, 0), (1, 0), (0, 1), (1, 1)])
Inspect the per-weight Z-statistics: