MaxComboResult

The outcome of a MaxCombo weighted log-rank test.

Usage

Source

MaxComboResult(
    statistic,
    p_value,
    z_statistics,
    correlation,
    method,
)

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.

Attributes

statistic: float

The MaxCombo test statistic: the maximum absolute Z-statistic across the weight functions.

p_value: float

P-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: Array

Correlation matrix between the Z-statistics under H0, as a NumPy array.

method: str
Human-readable description of the test.

Examples

Run 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)
mc
MaxComboResult(statistic=3.5657, p_value=0.0009956, weights=[(0, 0), (1, 0), (0, 1), (1, 1)])

Inspect the per-weight Z-statistics:

mc.z_statistics
{(0, 0): 3.21352484896035,
 (1, 0): 3.565690872910549,
 (0, 1): 1.8601032675878904,
 (1, 1): 2.7685344459841996}