Description Usage Arguments Value References Examples
View source: R/Function_CRTBound.R
Analyze the data (obtained from Data.Reform
or Simulation.Reform
functions) to infer the compliance group ITT effect using classifier-based approach; see Section 4 of Park and Kang (2021) for details.
1 | SharpBound(Data, paraC=NULL, method="Linear", CIcalc=FALSE, SSsize=1000, level=0.95, seed=1, Input.Type="Data")
|
Data |
A list obtained from |
paraC |
(Optional) Indices of the pre-treatment covariate matrix Data$X that are used in inference of the compliance group ITT effect. The default option is to use all pre-treatment covariates. |
method |
(Optional) The type of the transformation function. "Linear" and "Logistic" are available where "Linear" and "Logistic" use the linear and logistic transformations. The default option is "Linear"; see Section 4 of Park and Kang (2021) for details. |
CIcalc |
(Optional) A logical value whether the bootstrap-based confidence intervals are obtained. The dafault option is TRUE. |
SSsize |
(Optional) The total number of the bootstrap resamples used for the construction of the confidence intervals. The dafault option is 1000. |
level |
(Optional) The confidence level of the confidence interval. The default option is 0.95. |
seed |
(Optional) A random seed to generate the bootstrap resamples used for the construction of the confidence intervals. |
Input.Type |
(Optional) A variable whether Data is from |
Bound |
Bound estimates of the compliance group ITT effects. When Input.Type="Sim", the true bounds are available. |
Violation |
Summary whether the linear program was feasible. |
Resample.Bound |
Bootstrap bound estimates of the compliance group ITT effects. |
BootCIBound |
Confidence intervals of the bounds of the compliance group ITT effects. |
Chan Park & Hyunseung Kang (2021+) Assumption-Lean Analysis of Cluster Randomized Trials in Infectious Diseases for Intent-to-Treat Effects and Network Effects, Journal of the American Statistical Association [Link]
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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | #################################
# Generate Population
#################################
J <- 100 ; m <- 60
nc <- sample(c(3,4,5),J,replace=T)
N <- sum(nc)
C <- rep(1:J,nc)
n <- rep(nc,nc)
X1 <- rnorm(N)
X2 <- rbinom(N,1,0.3)
X3 <- rep(rnorm(J),nc)
A0 <- rbinom(N,1,logistic(-2+2*X3))
A1 <- apply(cbind(A0,rbinom(N,1,logistic(-2+3*X1+3*X2+2*X3))),1,max)
OtherA1 <- (rep(aggregate(A1~C,FUN="sum")[,2],nc)-A1)/(n-1)
NT <- which(A1==0 & A0==0)
AT <- which(A1==1 & A0==1)
CO <- which(A1==1 & A0==0)
Y0 <- Y1 <- rep(0,N)
for(jj in NT){
Y0[jj] <- rbinom(1,1,logistic(-2+2*OtherA1[jj]))
Y1[jj] <- max(Y0[jj],rbinom(1,1,logistic(-2+2*OtherA1[jj])))
}
for(jj in AT){
Y0[jj] <- rbinom(1,1,logistic(2+X1[jj]+X2[jj]))
Y1[jj] <- max(Y0[jj],rbinom(1,1,logistic(2+X1[jj]+X2[jj])))
}
for(jj in CO){
Y0[jj] <- rbinom(1,1,logistic(-2+2*OtherA1[jj]))
Y1[jj] <- max(Y0[jj],rbinom(1,1,logistic(2+X1[jj]+X2[jj])))
}
X <- cbind(1,X1,X2,X3,n)
Zc <- rep(0,J)
Zc[sort(sample(J,m))] <- 1
Z <- rep(Zc,nc)
A <- Z*A1 + (1-Z)*A0
Y <- Z*Y1 + (1-Z)*Y0
#################################
# Reform the Data
#################################
Reformed.Data <- Data.Reform(Y,Z,A,C,X,seed=1)
Simulated.Data <- Simulation.Reform(Y0,Y1,Z,A0,A1,C,X,seed=1)
#################################
# Bounds
#################################
Bound1 <- SharpBound(Reformed.Data,paraC=1:5,method="Logistic",CIcalc=TRUE,SSsize=100,level=0.95,seed=1,Input.Type="Data")
Bound2 <- LongHudgens(Reformed.Data,paraC=c(3),CIcalc=TRUE,SSsize=100,level=0.95,seed=1,Input.Type="Data")
Bound3 <- Bound.Intersect(Bound1,Bound2,level=0.95,Input.Type="Data")
Bound1.Sim <- SharpBound(Simulated.Data,paraC=1:5,method="Logistic",CIcalc=TRUE,SSsize=100,level=0.95,seed=1,Input.Type="Sim")
Bound2.Sim <- LongHudgens(Simulated.Data,paraC=c(3),CIcalc=TRUE,SSsize=100,level=0.95,seed=1,Input.Type="Sim")
Bound3.Sim <- Bound.Intersect(Bound1.Sim,Bound2.Sim,level=0.95,Input.Type="Sim")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.