Skip to contents

Compare survival across the groups named on the right-hand side of formula with the log-rank test. With strata, the test is the stratified log-rank: each stratum contributes its own observed-minus-expected counts and variance, and the sums enter one quadratic form.

Usage

sest_logrank(formula, data, strata = NULL)

Arguments

formula

A formula survival::Surv(time, status) ~ group, with a right-censored response. Several right-hand-side variables are crossed into one grouping.

data

A data frame.

strata

Optional character vector of column names in data to stratify on.

Value

A sest_logrank list: statistic, df, p_value, table (a data frame of group, n, observed, expected, o_minus_e), variance (the covariance matrix of O - E) and strata (the stratum names, or NULL). It has a print method.

Details

At each distinct event time \(t_j\) in a stratum, with \(n_j\) at risk, \(d_j\) events, and \(n_{gj}\) at risk in group \(g\), the expected count in group \(g\) is \(E_{gj} = d_j n_{gj} / n_j\) and the hypergeometric covariance is $$V_{ghj} = d_j \frac{n_j - d_j}{n_j - 1} \frac{n_{gj}}{n_j} \left(\delta_{gh} - \frac{n_{hj}}{n_j}\right).$$ The statistic is \((O - E)^\top V^{-} (O - E)\) on the first \(k - 1\) groups, referred to a chi-squared distribution on \(k - 1\) degrees of freedom.

References

Mantel N. Evaluation of survival data and two new rank order statistics arising in its consideration. Cancer Chemotherapy Reports 1966; 50(3): 163-170.

See also

sest_ph_check() for the proportional-hazards check.

Other estimands-and-tests: sest_contrast(), sest_cr_contrast(), sest_ph_check(), sest_pseudo()

Examples

sest_logrank(survival::Surv(time, status) ~ trt, survival::veteran)
#> <sest_logrank>
#>  group  n observed expected o_minus_e
#>      1 69       64     64.5   -0.5002
#>      2 68       64     63.5    0.5002
#> 
#>   chi-squared = 0.008227 on 1 df, p = 0.9277
sest_logrank(survival::Surv(time, status) ~ trt, survival::veteran,
                strata = "celltype")
#> <sest_logrank> stratified by 4 strata
#>  group  n observed expected o_minus_e
#>      1 69       64    68.21    -4.208
#>      2 68       64    59.79     4.208
#> 
#>   chi-squared = 0.7017 on 1 df, p = 0.4022