Description
Usage
SAP(r, type1, type2, interim, tpi1, delta,p)
tra.size(type1, type2, pi1, pi2,delta) #return Chow's sample size
Gould.size(type1, type2, opi, delta) #return Gould Sample size
Shih.size(n,r, type1,type2,tpi1,tpi2,p,interim)
##return Shih's sample size, n is the sample size from either Gould or Chow.
Arguments
r number of replicates in simulation, such as 10000
type1 designed type1 error, such as 0.05
type2 designed type2 error, such as 0.2 (power=0.8)
interim the proportion of total information by which interim analysis is planned, such as 0.3
tpi1 designed arm 1 event rate, such as 0.3
delta minimum clinical effect size, such as 0.2
p the stratification factor for Shih's method, say 0.3 suggested by the paper.
Examples
To run the functions, you either to copy all the R codes from here or copy the following scripts to the R Gui window:
Download the function code on Mac:
Download the function code on Mac:
download.file("https://raw.github.com/devilszhang/blog/master/SAP.r", destfile="./SAP.r", method="curl")
Download the function code on Windows:
download.file("https://raw.github.com/devilszhang/blog/master/SAP.r", destfile="./SAP.r")
Source the code:
source("./SAP.r")
Suppose you're planning a trial with the desired values in Arguments:
References
- Chow S.C., et al. Sample Size Calculations in Clinical Research, Marcel Dekker Inc.: New York, 2003.
- Gould A. L., et al. Statistics in Medicine, 1992, 11: 55-66.
- Shih W. J., et al. Statistics in Medicine, 1997, 16: 1913-1923. (Shih's method based on Gould)
- Shih's method based on Chow.
No comments:
Post a Comment