# NOT RUN {
## Trichotomous biomarker, Approach 1, varying sens and spec ##
## Specify sens, spec, FP0, FN2
nCasesTx <- 32
nControlsTx <- 1000
nCasesTxWithS <- 32
controlCaseRatio <- 5
VEoverall <- 0.75
risk0 <- 0.034
VElat0 <- seq(0, VEoverall, len=20) # 20 data points for the power curve
VElat1 <- rep(VEoverall, 20)
Plat0 <- 0.2
Plat2 <- 0.6
P0 <- Plat0 # different values of P0 can be set
P2 <- Plat2 # different values of P2 can be set
sens <- spec <- c(1, 0.9, 0.8, 0.7)
FP0 <- FN2 <- rep(0, 4)
M <- 5
alpha <- 0.05
biomType <- "trichotomous"
computePower(nCasesTx=nCasesTx, nControlsTx=nControlsTx, nCasesTxWithS=nCasesTxWithS,
controlCaseRatio=controlCaseRatio, VEoverall=VEoverall,
risk0=risk0, VElat0=VElat0, VElat1=VElat1, Plat0=Plat0,
Plat2=Plat2, P0=P0, P2=P2, M=M, alpha=alpha, spec=spec,
FP0=FP0, sens=sens, FN2=FN2, biomType=biomType)
# }
# NOT RUN {
## Trichotomous biomarker, Approach 2, varying rho ##
## Saving simulated data (including placebo and BIP data)
## Specify rho, sigma2obs, saveDataDir, saveDataFile, corr
nCasesTx <- 32
nControlsTx <- 1000
nCasesTxWithS <- 32
controlCaseRatio <- 5
VEoverall <- 0.75
risk0 <- 0.034
VElat0 <- seq(0, VEoverall, len=20)
VElat1 <- rep(VEoverall, 20)
Plat0 <- 0.2
Plat2 <- 0.6
P0 <- Plat0
P2 <- Plat2
M <- 5
alpha <- 0.05
sigma2obs <- 1
rho <- c(1, 0.9, 0.7, 0.5)
biomType <- "trichotomous"
saveDataDir <- "~/myDir"
saveDataFile <- "myDataFile.RData"
corr <- 0.7
computePower(nCasesTx=nCasesTx, nControlsTx=nControlsTx, nCasesTxWithS=nCasesTxWithS,
controlCaseRatio=controlCaseRatio, VEoverall=VEoverall, risk0=risk0,
VElat0=VElat0, VElat1=VElat1, Plat0=Plat0, Plat2=Plat2, P0=P0, P2=P2,
M=M, alpha=alpha, sigma2obs=sigma2obs, rho=rho, biomType=biomType,
saveDataDir=saveDataDir, saveDataFile=saveDataFile, corr=corr)
## dichotomous biomarker, Approach 2, varying rho ##
## Plat0 + Plat2 = 1
nCasesTx <- 32
nControlsTx <- 1000
nCasesTxWithS <- 32
controlCaseRatio <- 5
VEoverall <- 0.75
risk0 <- 0.034
VElat0 <- seq(0, VEoverall, len=20) # 20 data points for the power curve
VElat1 <- rep(0, 20) # will not be used by function
Plat0 <- 0.25
Plat2 <- 1 - Plat0
P0 <- Plat0
P2 <- Plat2
M <- 5
alpha <- 0.05
sigma2obs <- 1
rho <- c(1, 0.9, 0.7, 0.5)
biomType <- "dichotomous"
computePower(nCasesTx=nCasesTx, nControlsTx=nControlsTx, nCasesTxWithS=nCasesTxWithS,
controlCaseRatio=controlCaseRatio, VEoverall=VEoverall, risk0=risk0,
VElat0=VElat0, VElat1=VElat1, Plat0=Plat0, Plat2=Plat2, P0=P0, P2=P2,
M=M, alpha=alpha, sigma2obs=sigma2obs, rho=rho, biomType=biomType)
## Continuous biomarker, varying rho ##
nCasesTx <- 32
nControlsTx <- 1000
nCasesTxWithS <- 32
controlCaseRatio <- 5
VEoverall <- 0.75
risk0 <- 0.034
PlatVElowest <- 0.2
VElowest <- seq(0, VEoverall, len=20)
M <- 5
alpha <- 0.05
sigma2obs <- 1
rho <- c(1, 0.9, 0.7, 0.5)
biomType <- "continuous"
computePower(nCasesTx=nCasesTx, nControlsTx=nControlsTx, nCasesTxWithS=nCasesTxWithS,
controlCaseRatio=controlCaseRatio, VEoverall=VEoverall, risk0=risk0,
PlatVElowest=PlatVElowest, VElowest=VElowest, M=M, alpha=alpha,
sigma2obs=sigma2obs, rho=rho, biomType=biomType)
## Continuous biomarker, case-cohort sampling design, varying p ##
nCasesTx <- 32
nControlsTx <- 1000
nCasesTxWithS <- 32
VEoverall <- 0.75
risk0 <- 0.034
PlatVElowest <- 0.2
VElowest <- seq(0, VEoverall, len=20)
M <- 5
alpha <- 0.05
sigma2obs <- 1
rho <- 0.9
biomType <- "continuous"
cohort <- TRUE
p <- c(0.01, 0.02, 0.03)
computePower(nCasesTx=nCasesTx, nControlsTx=nControlsTx, nCasesTxWithS=nCasesTxWithS,
VEoverall=VEoverall, risk0=risk0, PlatVElowest=PlatVElowest,
VElowest=VElowest, M=M, alpha=alpha, sigma2obs=sigma2obs,
rho=rho, biomType=biomType, cohort=cohort, p=p)
## Continuous biomarker, saving output, varying sample sizes ##
nCasesTx <- 32
nControlsTx <- 1000
nCasesTxWithS <- 32
controlCaseRatio <- 5
VEoverall <- 0.75
risk0 <- 0.034
PlatVElowest <- 0.2
VElowest <- seq(0, VEoverall, len=20)
M <- 5
alpha <- 0.05
sigma2obs <- 1
rho <- c(1, 0.9, 0.7, 0.5)
biomType <- "continuous"
saveDir <- "~/myDir"
saveFile <- "MyFile.RData"
computePower(nCasesTx=nCasesTx, nCasesTxWithS=nCasesTxWithS, nControlsTx=nControlsTx,
controlCaseRatio=controlCaseRatio, VEoverall=VEoverall,
risk0=risk0, PlatVElowest=PlatVElowest, VElowest=VElowest,
M=M, alpha=alpha, sigma2obs=sigma2obs, rho=rho,
biomType=biomType, saveDir=saveDir, saveFile=saveFile)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab