bootRiskCurve {pssmooth} | R Documentation |
Bootstrap Estimation of Conditional Clinical Endpoint Risk under Placebo and Treatment Given Biomarker Response to Treatment in a Baseline Surrogate Measure Three-Phase Sampling Design
Description
Estimates P\{Y(z)=1|S(1)=s_1\}
, z=0,1
, on a grid of s_1
values in bootstrap resamples (see riskCurve
for notation introduction). Cases
(Y=1
) and controls (Y=0
) are sampled separately yielding a fixed number of cases and controls in each bootstrap sample. Consequentially, the number of controls
with available phase 2 data varies across bootstrap samples.
Usage
bootRiskCurve(
formula,
bsm,
tx,
data,
pstype = c("continuous", "ordered"),
bsmtype = c("continuous", "ordered"),
bwtype = c("fixed", "generalized_nn", "adaptive_nn"),
hinge = FALSE,
weights = NULL,
psGrid = NULL,
iter,
seed = NULL,
saveFile = NULL,
saveDir = NULL
)
Arguments
formula |
a formula object with the binary clinical endpoint on the left of the |
bsm |
a character string specifying the variable name in |
tx |
a character string specifying the variable name in |
data |
a data frame with one row per randomized participant endpoint-free at |
pstype |
a character string specifying whether the biomarker response shall be treated as a |
bsmtype |
a character string specifying whether the baseline surrogate measure shall be treated as a |
bwtype |
a character string specifying the bandwidth type for continuous variables in the kernel density estimation. The options are |
hinge |
a logical value ( |
weights |
either a numeric vector of weights or a character string specifying the variable name in |
psGrid |
a numeric vector of |
iter |
the number of bootstrap iterations |
seed |
a seed of the random number generator supplied to |
saveFile |
a character string specifying the name of an |
saveDir |
a character string specifying a path for the output directory. If |
Value
If saveFile
and saveDir
are both specified, the output list (named bList
) is saved as an .RData
file; otherwise it is returned only.
The output object is a list with the following components:
-
psGrid
: a numeric vector ofS(1)
values at which the conditional clinical endpoint risk is estimated in the componentsplaRiskCurveBoot
andtxRiskCurveBoot
-
plaRiskCurveBoot
: alength(psGrid)
-by-iter
matrix of estimates ofP\{Y(0)=1|S(1)=s_1\}
fors_1
inpsGrid
, with columns representing bootstrap samples -
txRiskCurveBoot
: alength(psGrid)
-by-iter
matrix of estimates ofP\{Y(1)=1|S(1)=s_1\}
fors_1
inpsGrid
, with columns representing bootstrap samples -
cpointPboot
: ifhinge=TRUE
, a numeric vector of estimates of the hinge point in the placebo group in each bootstrap sample -
cpointTboot
: ifhinge=TRUE
, a numeric vector of estimates of the hinge point in the treatment group in each bootstrap sample
References
Fong, Y., Huang, Y., Gilbert, P. B., and Permar, S. R. (2017), chngpt: threshold regression model estimation and inference, BMC Bioinformatics, 18.
See Also
riskCurve
, summary.riskCurve
and plotMCEPcurve
Examples
n <- 500
Z <- rep(0:1, each=n/2)
S <- MASS::mvrnorm(n, mu=c(2,2,3), Sigma=matrix(c(1,0.9,0.7,0.9,1,0.7,0.7,0.7,1), nrow=3))
p <- pnorm(drop(cbind(1,Z,(1-Z)*S[,2],Z*S[,3]) %*% c(-1.2,0.2,-0.02,-0.2)))
Y <- sapply(p, function(risk){ rbinom(1,1,risk) })
X <- rbinom(n,1,0.5)
# delete S(1) in placebo recipients
S[Z==0,3] <- NA
# delete S(0) in treatment recipients
S[Z==1,2] <- NA
# generate the indicator of being sampled into the phase 2 subset
phase2 <- rbinom(n,1,0.4)
# delete Sb, S(0) and S(1) in controls not included in the phase 2 subset
S[Y==0 & phase2==0,] <- c(NA,NA,NA)
# delete Sb in cases not included in the phase 2 subset
S[Y==1 & phase2==0,1] <- NA
data <- data.frame(X,Z,S[,1],ifelse(Z==0,S[,2],S[,3]),Y)
colnames(data) <- c("X","Z","Sb","S","Y")
qS <- quantile(data$S, probs=c(0.05,0.95), na.rm=TRUE)
grid <- seq(qS[1], qS[2], length.out=3)
out <- bootRiskCurve(formula=Y ~ S + factor(X), bsm="Sb", tx="Z", data=data,
psGrid=grid, iter=1, seed=10)
# alternatively, to save the .RData output file (no '<-' needed):
bootRiskCurve(formula=Y ~ S + factor(X), bsm="Sb", tx="Z", data=data,
psGrid=grid, iter=1, seed=10, saveFile="out.RData", saveDir="./")