ITT: Inference of the Intent-to-Treat Effect

Description Usage Arguments Value References Examples

View source: R/Function_CRTBound.R

Description

Analyze the data (obtained from Data.Reform or Simulation.Reform functions) to infer the intent-to-treat effect; see Section 3 of Park and Kang (2021) for details.

Usage

1
ITT(Data, Input.Type="Data")

Arguments

Data

A list obtained from Data.Reform and Simulation.Reform functions.

Input.Type

(Optional) A variable whether Data is from Data.Reform (Input.Type="Data") or Simulation.Reform (Input.Type="Sim") function. The default The default option is "Data".

Value

ITT

A point estimate of the ITT effect.

SE

The standard error of the above point estimate.

z-statistic

The z-statistic of the ITT effect.

True.ITT

Optional The true ITT effect; only available under Input.Type="Sim"

True.SE

Optional The true standard error; only available under Input.Type="Sim"

References

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]

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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#################################
# 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)

#################################
# ITT Effect
#################################

ITT.Data <- ITT(Reformed.Data,Input.Type="Data")
ITT.Sim.Data <- ITT(Simulated.Data,Input.Type="Sim")

qkrcks0218/CRTBound documentation built on Dec. 22, 2021, 10:56 a.m.