Skip to contents

Compares observed failures per group with the number expected under a common hazard, standardised by the hypergeometric variance. Equivalent to survival::survdiff with rho = 0.

Usage

morie_logrank_test(time, event, group)

morie_survival_logrank(time, event, group)

Arguments

time

follow-up times

event

1 for an event, 0 for censored

group

grouping vector

Value

list with statistic, df, p_value, observed, expected

Examples

morie_logrank_test(time = c(1, 2, 3, 4, 5, 6, 7, 8), event = c(0, 1, 0, 1, 1, 0, 1, 0),
  group = rep(c("a", "b"), 4))
#> $statistic
#> [1] 0.02983838
#> 
#> $df
#> [1] 1
#> 
#> $p_value
#> [1] 0.8628575
#> 
#> $observed
#> a b 
#> 2 2 
#> 
#> $expected
#>        a        b 
#> 1.828571 2.171429 
#> 
#> $groups
#> [1] "a" "b"
#>