n2pwr.NPH: Power Calculation with Combination Test

Description Usage Arguments Details Value See Also Examples

View source: R/oxy-n2pwr.NPH.R View source: R/n2pwr.NPH.R

Description

n2pwr.NPH calculates the power given either the number of events or number of subjects using combination test

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
n2pwr.NPH(
  method = "MaxLR",
  entry = 1,
  fup = 1,
  CtrlHaz,
  hazR,
  transP1,
  transP0,
  Wlist,
  entry_pdf0 = function(x) {     (1/entry) * (x >= 0 & x <= entry) },
  entry_pdf1 = entry_pdf0,
  eventN = NULL,
  totalN = NULL,
  ratio = 1,
  alpha = 0.05,
  alternative = c("two.sided"),
  k = 100
)

Arguments

method

a text specifying the calculation method, either "MaxLR" or "Projection". Maximum weighted logrank test is used if "MaxLR" is specified; otherwise, projection test is used.

entry

a numeric value indicating the enrollment time, Default: 1

fup

a numeric value indicating the minimum follow-up time for subjects. , Default: 1

CtrlHaz

a function, specifying the hazard function for control group.

hazR

a function, specifying the hazard ratio function between treatment and control group

transP1

a numeric vector of length 2, consisting of the transition probability from receiving treatment to drop-out (drop-out rate) and from receiving treatment to receiving control (drop-in rate) per time unit.

transP0

a numeric vector of length 2, consisting of the transition probability from receiving control to drop-out (drop-out rate) and from receiving control to receiving treatment (drop-in rate) per time unit.

Wlist

a list, consisting of weight functions applied to the test. The element of the list must be functions. Default is a list of one constant function, corresponding to the logrank test.

entry_pdf0

a function, indicating the probability density function (pdf) of enrollment/entry time for control group. The default assumes a uniform distribution corresponding to the constant enrollment rate. Default: function(x) (1/entry) * (x >= 0 & x <= entry)

entry_pdf1

a pdf function of enrollment/entry time for treatment

eventN

the number of events

totalN

the number of subjects

ratio

allocation ratio, Default: 1

alpha

type i error, Default: 0.05

alternative

alternative hypothesis - one of c("two.sided", "less", "greater"), Default: "two.sided"

k

an integer, indicating number of sub-intervals per time unit, Default: 100

Details

Function npwr.NPH calculates the asymptotic power given number of events or number of subjects using maximum weighted logrank test or projection type test. If only eventN is provided, the asymptotic power is based on provided number of events. If only totalN is given, the pooled event probability (eprob) is calculated according input design parameters including entry time, follow-up time and hazard functions, etc. The number of events is calculated as totalN*eprob, which is given in returned vector outN. Similarly, if only eventN is given, the total sample size is given as eventN/eprob. However, if both eventN and totalN are provided, we only use eventN for calculation. Check function pwr2n.NPH for more calculation details.

Value

a list of components:

power

asymptotic power

inN

a vector consisting of the input of eventN and totalN

outN

a vector including the output of number of events and total sample. See details.

prob_event

event probability at the end of trial

L_trans

a list, consisting of transition matrix at each interval

pdat

a data frame including all the intermediate variables in the calculation.

studytime

a vector of length 2, including the entry and follow-up time as input

RandomizationRatio

as input

See Also

pwr2n.NPH

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
# entry time
t_enrl <- 12
# follow-up time
t_fup <- 18
# baseline hazard
lmd0 <- -log(0.2)/10
# delayed treatment effects
f_hr_delay <- function(x){(x<=6)+(x>6)*0.75}
# maxcombo test
maxc <- gen.wgt(method="Maxcombo")
pwr1 <- n2pwr.NPH(entry   = t_enrl
                 ,fup      = t_fup
                 ,CtrlHaz = function(x){x^0*lmd0}
                 ,hazR = f_hr_delay
                 ,transP1 = c(0,0)
                 ,transP0 = c(0,0)
                 ,Wlist = maxc
                 ,eventN = 50 # targeted number of events
)

nphPower documentation built on Dec. 1, 2021, 5:06 p.m.