powlgrnk: Computes the power of the logrank test

View source: R/powlgrnknew.R

powlgrnkR Documentation

Computes the power of the logrank test

Description

Computes the power of the two-group logrank test for arbitrary failure time distributions in a standard clinical trials setting.

Usage

powlgrnk(
  acc.per,
  acc.rate,
  add.fu,
  alpha = 0.025,
  p.con = 0.5,
  hazcon = function(x, lc, pc, ...) {
     u <- (1 - pc) * exp(-lc * x)
     lc * u/(pc +
    u)
 },
  survcon = function(x, lc, pc, ...) pc + (1 - pc) * exp(-lc * x),
  haztst = function(x, lt, pt, ...) {
     u <- (1 - pt) * exp(-lt * x)
     lt * u/(pt +
    u)
 },
  survtst = function(x, lt, pt, ...) pt + (1 - pt) * exp(-lt * x),
  control.rate = NULL,
  test.rate = NULL,
  control.cure = 0,
  test.cure = 0,
  ...
)

Arguments

acc.per

Planned duration of accrual

acc.rate

Number of patients expected to be entered per time unit

add.fu

Additional follow-up between the end of accrual and the time of analysis

alpha

The one-sided type I error of the test

p.con

The proportion randomized to the control arm

hazcon

A function evaluating the control group hazard function at a vector of times

survcon

A function evaluating the control group survivor function at a vector of times

haztst

A function evaluating the experimental or test group hazard function at a vector of times

survtst

A function evaluating the experimental or test group survivor function at a vector of times

control.rate

Exponential hazard rate in control group for non-cured

test.rate

Exponential hazard rate in test group for non-cured

control.cure

Cure fraction in control group

test.cure

Cure fraction in test group

...

additional arguments passed to survival and hazard functions

Details

The calculations assume that n=acc.rate*acc.per patients are entered uniformly over the period [0,acc.per], with follow-up continuing for an addition add.fu time units, so censoring will be uniform on [add.fu,add.fu+acc.per]. The failure probability under the specified failure distribution is then computed, as is the expected number of failures, n*fail.prob.

hazcon must be the hazard function corresponding to the survivor function in survcon (and similarly for haztst and survtst). The program does not check for consistency of these functions, though. One way to check would be to compare survcon(x) to exp(-integrate(hazcon,0,x)$value) for various values x. The default functions are for the exponential cure rate model, which reduces to the two-sample exponential when the cure fractions are 0.

If custom hazcon, survcon, haztst, and survtst functions are given, the arguments should match those in the default functions (ie x,lc,pc,... for hazcon, etc). The values of lc, pc, lt, and pt are specified in the control.rate, control.cure, test.rate, and test.cure arguments and passed through to these functions.

The calculations are performed by using the integrate function to approximate the expectations of the logrank score and the logrank variance estimator and the variance of the logrank score under the specified conditions, and then using a normal approximation to the distribution of the logrank statistic.

This function only computes power for a single analysis, and does not consider group sequential tests.

Caution: consistent time units must be used for all quantities; eg if the accrual rate is given in patients/month, then the hazard rates must be in units of events/month and acc.per and add.fu must be in months.

Value

Returns a vector giving the power of the test under the specified conditions (power), the total sample size (n) and the expected number of events (nd).

See Also

powlgrnk6

Examples

# Exponential distributions
powlgrnk(5, 200, 3, control.rate = 0.1, test.rate = 0.075)

# Cure rate
powlgrnk(3, 200, 3, control.rate = log(2) / 3, test.rate = log(2) / 4,
         control.cure = 0.3, test.cure = 0.4)

# Exponential cure-rate with proportional hazards alternative
ht <- function(x, rat, ...) rat * hc(x, ...)
st <- function(x, rat, ...) sc(x, ...) ^ rat
sc <- function(x, pic, lic, ...) pic + (1 - pic) * exp(-lic * x)
hc <- function(x, pic, lic, ...) {
  u <- (1 - pic) * exp(-lic * x); lic * u / (pic + u)
}
powlgrnk(5, 200, 3, hazcon = hc, survcon = sc, haztst = ht,
         survtst = st, lic = log(2) / 3, pic = 0.3, rat = 0.5)


raredd/desmon documentation built on May 7, 2024, 3:46 p.m.