sample.size.NI {dani} | R Documentation |
A function for calculating sample size of a non-inferiority trial.
sample.size.NI(p0.expected, p1.expected, p1.tolerable, sig.level=0.025, power=0.9, r=1, scale="RD", print.out=TRUE)
p0.expected |
Expected event risk in the control arm. |
p1.expected |
Expected event risk in the active arm. |
p1.tolerable |
Maximum tolerable active event risk for declaring non-inferiority. |
sig.level |
One-sided significance level for testing. Default is 0.025, i.e. 2.5%. |
power |
Power of the trial, i.e. one minus type-II error of the study. Default is 0.9, i.e.90%. |
r |
Allocation ratio, i.e. ratio between sample sizes in the active and control goups. Deafault is 1. |
scale |
The scale on which we define the non-inferiority trial. Can be one of "RD" (Risk difference), "RR" (log-risk ratio) or "AS" (arc-sine difference). |
print.out |
Logical. If FALSE, no output is printed. |
This is a function to calculate sample size needed to test non-inferiority of an active treatment against the control within a specific NI margin. The margin can be specified on a number of different scales, which give different answers.
The output is a vector ss, containing the sample sizes for the control and active arms respectively.
p0.expected<-0.05 # Expected control event rate p1.expected<-p0.expected # Same as expected active event rate p1.tolerable<-0.1 # Maximum tolerable active event rate r<-1 # Allocation ratio power<-0.9 # Power alph<-0.025 # Significance level sample.size.RD<-sample.size.NI(sig.level=alph, power=power, p0.expected=p0.expected, p1.expected=p1.expected, p1.tolerable=p1.tolerable, r=r) # Risk difference scale sample.size.lRR<-sample.size.NI(sig.level=alph, power=power, p0.expected=p0.expected, p1.expected=p1.expected, p1.tolerable=p1.tolerable, r=r, scale="RR") # Log-risk ratio scale sample.size.AS<-sample.size.NI(sig.level=alph, power=power, p0.expected=p0.expected, p1.expected=p1.expected, p1.tolerable=p1.tolerable, r=r, scale="AS") # Arc-sine difference scale