Skip to contents

At each distinct death time with \(d\) deaths among \(r\) at risk, \(r_1\) of them in group 1, \(E_1 \mathrel{+}= d r_1 / r\) and \(V \mathrel{+}= d (r_1/r)(1 - r_1/r)(r-d)/(r-1)\); the statistic is \((O_1 - E_1)^2 / V\) on one degree of freedom. The \((r-d)/(r-1)\) factor is the finite-population correction of the hypergeometric variance. Ties in time are pooled into one risk set.

Usage

Logrank(time, event, group)

Arguments

time

Follow-up times.

event

1 for an observed death, 0 for right censoring.

group

Two distinct labels; the lower sorts to group 1.

Value

List with statistic, p_value, observed, expected, var, n, method.

References

Mantel (1966), Cancer Chemotherapy Reports 50:163-170; Peto and Peto (1972), JRSS A 135:185-207. The coded form was read from Therneau's survival package, src/survdiff2.c, rho = 0 branch of the G-rho family.

Examples

set.seed(1)
r <- Logrank(time = sort(runif(10)), event = rbinom(10, 1, 0.5), group = rbinom(10, 1, 0.5)); TRUE
#> [1] TRUE