testConstancy {pssmooth} | R Documentation |
Testing of the Null Hypotheses of a Flat and a Constant Marginal Causal Effect Predictiveness Curve
Description
Computes a two-sided p-value either from the test of {H_0^1: mCEP(s_1)=CE
for all s_1
}, where CE
is the overall causal treatment effect on the clinical
endpoint, or from the test of {H_0^2: mCEP(s_1)=c
for all s_1
in the interval limS1
and a specified constant c
}, each against a general alternative
hypothesis. The testing procedures are described in Juraska, Huang, and Gilbert (2018) and are based on the simultaneous estimation method of Roy and Bose (1953).
Usage
testConstancy(
object,
boot,
contrast = c("te", "rr", "logrr", "rd"),
null = c("H01", "H02"),
overallPlaRisk = NULL,
overallTxRisk = NULL,
MCEPconstantH02 = NULL,
limS1 = NULL
)
Arguments
object |
an object returned by |
boot |
an object returned by |
contrast |
a character string specifying the mCEP curve. It must be one of |
null |
a character string specifying the null hypothesis to be tested; one of |
overallPlaRisk |
a numeric value of the estimated overall clinical endpoint risk in the placebo group. It is required when |
overallTxRisk |
a numeric value of the estimated overall clinical endpoint risk in the treatment group. It is required when |
MCEPconstantH02 |
the constant |
limS1 |
a numeric vector of length 2 specifying an interval that is a subset of the support of |
Value
A numeric value representing the two-sided p-value from the test of either H_0^1
or H_0^2
.
References
Juraska, M., Huang, Y., and Gilbert, P. B. (2020), Inference on treatment effect modification by biomarker response in a three-phase sampling design, Biostatistics, 21(3): 545-560, https://doi.org/10.1093/biostatistics/kxy074.
Roy, S. N. and Bose, R. C. (1953), Simultaneous condence interval estimation, The Annals of Mathematical Statistics, 24, 513-536.
See Also
riskCurve
, bootRiskCurve
and testEquality
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 <- riskCurve(formula=Y ~ S + factor(X), bsm="Sb", tx="Z", data=data, psGrid=grid)
boot <- bootRiskCurve(formula=Y ~ S + factor(X), bsm="Sb", tx="Z", data=data,
psGrid=grid, iter=2, seed=10)
fit <- glm(Y ~ Z, data=data, family=binomial)
prob <- predict(fit, newdata=data.frame(Z=0:1), type="response")
testConstancy(out, boot, contrast="te", null="H01", overallPlaRisk=prob[1],
overallTxRisk=prob[2])
testConstancy(out, boot, contrast="te", null="H02", MCEPconstantH02=0, limS1=c(qS[1],1.5))