exactLR function

exactLR

exactLR

One-sided exact / approximate permutation and asymptotic log-rank test

exactLR(B, formula, data = parent.frame(), type = "exact")

Arguments

  • B: number of random permutations (only used if type="approximate")
  • formula: a formula object, as used by coxph, left hand side must be a 'Surv' object, right hand side may only consist of a single term (treatment indicator)
  • data: data.frame or list containing the variables in "formula", by default "formula" is evaluated in the parent frame
  • type: if type="exact" performs complete enumeration of all permutations, if type="approximate" draw random permutations, if type="asymptotic" perform asymptotic log-rank test

Returns

A list containing the exact or approximate permutation p-value and the observed test statistic

Details

This function performs a standard exact or approximate permutation test which is only valid under the extended null hypothesis of equal survival AND censoring distributions.

Examples

T <- rexp(20) C <- rexp(20) data <- data.frame(time=pmin(T, C), status=(T<=C), trt=rbinom(20, 1, 0.5)) # Approximate permutation test using 1000 random permutations x <- exactLR(1000, Surv(time, status) ~ trt, data, "approximate") print(paste("Approximate permutation p-value:", x$p)) # Exact permutation test y <- exactLR(0, Surv(time, status) ~ trt, data, "exact") print(paste("Exact permutation p-value:", y$p))
  • Maintainer: Matthias Brueckner
  • License: GPL-3 | file LICENSE
  • Last published: 2017-08-07

Useful links