Skip to contents

Delegates to survival::survdiff() for the standard log-rank weight (rho=0) and Peto-Peto (rho=1). Gehan/Tarone-Ware are not supported by survdiff directly and currently fall back to rho=1 (Peto) as the closest analogue; use survival::survdiff(..., rho=1) plus FH weights for exact equivalents.

Usage

morie_survival_logrank(
  time,
  event,
  group,
  weight = c("logrank", "peto", "gehan", "tarone")
)

Arguments

time, event, group

Vectors.

weight

One of "logrank", "peto", "gehan", "tarone".

Value

A named list with elements method, test_statistic, p_value, df, n_groups, n_total.

Examples

set.seed(1)
time <- rexp(60); event <- rbinom(60, 1, 0.7)
group <- rep(c(0, 1), 30)
str(morie_survival_logrank(time, event, group), max.level = 1)
#> List of 6
#>  $ method        : chr "Log-rank test"
#>  $ test_statistic: num 0.571
#>  $ p_value       : num 0.45
#>  $ df            : num 1
#>  $ n_groups      : int 2
#>  $ n_total       : int 60