View source: R/sampleSizeSurvival.R
sampleSizeSurvival | R Documentation |
Calculates two of the following quantities if one of them is given: Sample size, required number of events and power. The distribution of survival times is assumed to be either non-parametric given a Kaplan-Meier estimate or following an exponential or Weibull model given rate parameters or scale and shape parameters, respectively. The same time unit should be used for the survival times, the accrual period and the follow-up period.
sampleSizeSurvival(
HR,
a.length,
f.length,
sig.level = 0.05,
power = NULL,
n = NULL,
n.events = NULL,
alloc.ratio = 1,
drop.rate = 0,
non.inf.margin = 0,
dist = c("exponential", "weibull", "non-parametric"),
lambda = NULL,
shape = NULL,
survfit.ref = NULL,
alternative = c("two.sided", "one.sided"),
method = c("exact", "approx")
)
HR |
Hazard ratio of experimental group vs. control group. |
a.length |
Length of accrual period. |
f.length |
Length of follow-up period. |
sig.level |
Significance level. |
power |
Desired power. |
n |
Required sample size. |
n.events |
Required total number of events. |
alloc.ratio |
Allocation ratio: Ratio of the number of patients in the experimental group divided by the number of patients in the control group. |
drop.rate |
Drop-out rate. |
non.inf.margin |
Non-inferiority margin. |
dist |
Distributional assumption for survival times. Either "exponential", "weibull" or "non-parametric". Default is "exponential". |
lambda |
The rate parameter in the exponential distribution and the scale parameter in the Weibull distribution. |
shape |
The shape parameter of the Weibull distribution |
survfit.ref |
The survfit object, i.e. the Kaplan-Meier estimate of survival in the control group. |
alternative |
Either "one.sided" or "two.sided" depending on whether the alternative hypothesis is one- or two-sided. |
method |
Either "exact" or "approx", indicating whether the integral for the probability of event is solved by integration the function or approximated. If a non-parametric approach is chosen only the approximate approach is available. |
A list with the entries
n |
Required total sample size. |
HR |
Hazard ratio of experimental group vs. control group. |
power |
Power of the study. |
sig.level |
Significance level. |
alternative |
Indicates whether the the alternative hypothesis is one- or two-sided. |
distribution |
Distributional assumption for survival times. Either "exponential" for exponential, "weibull" or "non-parametric". |
PrEvent |
Probability that a patient will experience the event during the study. |
Events |
Required total number of events. |
Uriah Daugaard and Leonhard Held
leonhard.held@uzh.ch
Collett, D. (2015). Modelling Survival Data in Medical Research. New York: Chapman and Hall/CRC.
Schoenfeld, D.A. (1983). Sample-Size Formula for the Proportional-Hazards Regression Model. Biometrics, 39, 499–503.
The function sampleSizeSurvival
depends on
survEvents
and PrEvent
.
## survival of females in lung cancer data
data(lung, package = "survival")
lung.female <- subset(lung, sex == 2)
survObj <- Surv(time = lung.female$time, event=lung.female$status == 2,
type='right')
fit <- survfit(survObj ~ 1)
## exponential model
exp.reg <- survreg(survObj~1, dist = "exponential")
## Weibull model
weib.reg <- survreg(survObj~1, dist = "weibull")
## estimate the sample size with 5 different approaches
## Non-parametric
sampleSizeSurvival(HR = 0.65, power = 0.9, a.length = 400,
f.length = 400, dist = "non-parametric", survfit.ref = fit,
alloc.ratio = 1, method = "approx")
## Exponential, approximate
exp.lambda <- 1/exp(coef(exp.reg))
sampleSizeSurvival(HR = 0.65, power = 0.90, a.length = 400,
f.length = 400, dist = "exponential",
lambda = exp.lambda,
alloc.ratio = 1, method = "approx")
## Exponential, exact
sampleSizeSurvival(HR = 0.65, power = 0.90, a.length = 400,
f.length = 400, dist = "exponential",
lambda = exp.lambda,
alloc.ratio = 1, method = "exact")
weib.scale <- unname(exp(coef(weib.reg)))
weib.shape <- unname(1/weib.reg$scale)
## Weibull, approximate
sampleSizeSurvival(HR = 0.65, power = 0.90, a.length = 400,
f.length = 400, dist = "weibull", lambda = weib.scale,
alloc.ratio = 1, shape = weib.shape,
method = "approx")
## Weibull, exact
sampleSizeSurvival(HR = 0.65, power = 0.90, a.length = 400,
f.length = 400, dist = "weibull", lambda = weib.scale,
alloc.ratio = 1, shape = weib.shape,
method = "exact")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.