Description Usage Arguments Details Value Examples
This function is used to perform power calculation of the Log-rank test based on simulation datasets, with user specified total sample size (in one simulation), type I error, effect size, total number of simulation datasets, sample size ratio between comparison groups, the death rate in the reference group, and the distribution of follow-up time (negative binomial).
1 2 3 |
total.sample.size |
Total sample size in this simulation dataset. |
type.I.error |
The significance level for performing the Log-rank test. type.I.error=0.05 by default. |
effect.size |
A scalar parameter (between 0 and 1). effect.size=0.2 (small effect size); effect.size=0.5 (median effect size); effect.size=0.8 (large effect size). effect.size=0.6 by default. |
simulation.n |
Total number of simulation datasets used for power calculation. simulation.n=1000 by default. |
group.sample.size.ratio |
Ratio between samples of contrast group and the reference or control group. group.sample.size.ratio=1 by default. |
reference.group.incidence |
Incidence of death or event of interest in the reference patient group. reference.group.incidence=0.5 by default. |
time.distribution.para |
A numeric vector of length 2. This vector is used to specify the negative binomial distribution that will be used to simulate follow-up time. The 1st element in this vector is the target for number of successful trials, or dispersion parameter (the shape parameter of the gamma mixing distribution). Must be strictly positive, need not be integer. Then 2nd parameter is the probability of success in each trial. time.distribution.para=c(100, 0.8) by default. |
By default, this function will generate simulation.n=1000
simulation datasets to calculate the power of the log-rank test at significance leve of type.I.error = 0.05
.
The simulation datasets are generated following the steps below:
1) determine sample size of the reference patient group (group 1) by calculating
round(total.sample.size/(group.sample.size.ratio+1))
;
2) determine sample size of the contrast group (group 2) total.sample.size - reference.group.n
;
3) generate follow-up time for both the referencee and the contrast group using negative bionomial distribution with user specified parameters time.to.event.distribution.para
;
4) generate vital status indictor for the reference group by sampling from the bionomial distribution with the number of trials = 1 and the probability of success/death = reference.group.incidence
;
5) generate vital status indictor for the contrast group by sampling from the bionomial distribution with the number of trials = 1 and
the probability of success/death = reference.group.incidence*(1-effect.size)
;
The log-rank test p-values are calculated based on the results of survdiff()
with rho=0
.
LRPower()
returns a point estimate of the power.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | set.seed(1234)
LRPower(total.sample.size=160, type.I.error = 0.05, effect.size=0.2,
simulation.n=1000,group.sample.size.ratio=1, reference.group.incidence=0.5)
LRPower(total.sample.size=160, effect.size=0.5)
LRPower(total.sample.size=160, effect.size=0.8)
total.sample.size <- 160
effect.size <- c(1:20)/20
power <- sapply(effect.size, function(x){
LRPower(total.sample.size, effect.size=x, simulation.n=100)
})
plot(effect.size, power,
main=paste("Log-rank Test Power Calculation (n=", total.sample.size,")", sep=""),
type="b")
|
Loading required package: survival
Loading required package: survminer
Loading required package: ggplot2
Loading required package: ggpubr
[1] 0.15
[1] 0.761
[1] 0.999
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.