RMSTResult

Results of an RMST comparison test or difference calculation.

Usage

Source

RMSTResult(
    estimate,
    se,
    lower_ci,
    upper_ci,
    statistic,
    p_value,
    method,
    group1,
    group2,
    rmst1,
    se1,
    rmst2,
    se2,
    tau,
    estimand="difference",
    stratified=False,
    conf_level=0.95
)

This class stores the results of RMST group comparisons in a structured format, including point estimates, confidence intervals, and hypothesis test statistics.

Attributes

estimate: float

The point estimate of RMST difference, ratio, or percentage difference between groups.

lower_ci: float

Lower bound of the confidence interval for the estimate.

upper_ci: float

Upper bound of the confidence interval for the estimate.

se: float

Standard error of the estimate.

statistic: float

Test statistic (z-score for Wald test) for the null hypothesis of no difference.

p_value: float

Two-tailed p-value for the hypothesis test. Small values (typically < 0.05) indicate significant differences between groups.

method: str

Human-readable description of the comparison method, e.g., "RMST difference (tau=365)".

group1: Any

Label of the first group (minuend in difference).

group2: Any

Label of the second group (subtrahend in difference).

rmst1: float

RMST estimate for group 1 at tau.

se1: float

Standard error of RMST for group 1.

rmst2: float

RMST estimate for group 2 at tau.

se2: float

Standard error of RMST for group 2.

tau: float

The restriction time tau used in the RMST calculation.

estimand: str

The type of estimand: "difference", "ratio", or "percentage_difference".

stratified: bool

Whether this is a stratified comparison (True) or pooled (False).

conf_level: float
Confidence level used for interval estimation (the default is 0.95).

Examples

Compare RMST between two groups:

import greenwood as gw

lung = gw.load_dataset("lung", backend="polars")
y = gw.Surv.right(lung["time"], event=(lung["status"] == 2))

result = gw.rmst_test(y, tau=365, group=lung["sex"])
result
RMSTResult(method='RMST difference (tau=365)', estimate=-55.9703, se=14.9581, 95% CI=[-85.2877, -26.6529], p_value=0.0001827)

Access individual components:

result.estimate  # difference between groups
result.p_value   # significance
result.se        # standard error
np.float64(14.958125860424103)