testEquality: Testing of the Null Hypothesis of Equal Marginal Causal...

Description Usage Arguments Value References See Also Examples

View source: R/pssmooth.R

Description

Computes a two-sided p-value either from the test of {H_0^3: mCEP_1(s_1)=mCEP_2(s_1) for all s_1 in limS1}, where mCEP_1 and mCEP_2 are each associated with either a different biomarker (measured in the same units) or a different endpoint or both, or from the test of {H_0^4: mCEP(s_1|X=0)= mCEP(s_1|X=1) for all s_1 in limS1}, where X is a baseline dichotomous phase 1 covariate of interest, 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

1
2
3
4
5
6
7
8
9
testEquality(
  object1,
  object2,
  boot1,
  boot2,
  contrast = c("te", "rr", "logrr", "rd"),
  null = c("H03", "H04"),
  limS1 = NULL
)

Arguments

object1

an object returned by riskCurve pertaining to either mCEP_1(s_1) in H_0^3 or mCEP(s1|X=0) in H_0^4

object2

an object returned by riskCurve pertaining to either mCEP_2(s_1) in H_0^3 or mCEP(s1|X=1) in H_0^4

boot1

an object returned by bootRiskCurve pertaining to either mCEP_1(s_1) in H_0^3 or mCEP(s1|X=0) in H_0^4

boot2

an object returned by bootRiskCurve pertaining to either mCEP_2(s_1) in H_0^3 or mCEP(s1|X=1) in H_0^4

contrast

a character string specifying the mCEP curve. It must be one of te (treatment efficacy), rr (relative risk), logrr (log relative risk), and rd (risk difference [placebo minus treatment]).

null

a character string specifying the null hypothesis to be tested; one of H03 and H04 as introduced above

limS1

a numeric vector of length 2 specifying an interval that is a subset of the support of S(1). If NULL (default), then the specified null hypothesis is evaluated for all s_1.

Value

A numeric value representing the two-sided p-value from the test of either H_0^3 or H_0^4.

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 testConstancy

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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)
out0 <- riskCurve(formula=Y ~ S, bsm="Sb", tx="Z", data=data[data$X==0,], psGrid=grid)
out1 <- riskCurve(formula=Y ~ S, bsm="Sb", tx="Z", data=data[data$X==1,], psGrid=grid)
boot0 <- bootRiskCurve(formula=Y ~ S, bsm="Sb", tx="Z", data=data[data$X==0,],
                       psGrid=grid, iter=2, seed=10)
boot1 <- bootRiskCurve(formula=Y ~ S, bsm="Sb", tx="Z", data=data[data$X==1,],
                       psGrid=grid, iter=2, seed=15)

testEquality(out0, out1, boot0, boot1, contrast="te", null="H04")

pssmooth documentation built on Jan. 13, 2021, 5:56 a.m.