Description Usage Arguments Details Value References Examples
View source: R/IntegrativeHTE.R
Implements integrative HTE analysis combing randomized trial and real-world data.
1 2 | IntHTE(A, X, Y, delta, family.oc = "gaussian", gamma1 = 0.9,
gamma2 = 2, nptb = 50, nboots = 50, alpha.CI = 0.05)
|
A |
is a vector of treatment ( (n+m) x 1). |
X |
is a matrix of covariates without intercept ( (n+m) x p). |
Y |
is a vector of outcome ( (n+m) x 1). |
delta |
is a vector of the binary indicator of belonging to the randomized trial (RT) sample; i.e., 1 if the unit belongs to the RT sample, and 0 otherwise ( (n+m) x 1). |
family.oc |
specifies the family for the outcome model.
|
gamma1 |
is the parameter in the violation test such that T > chisq_1-gamma1 indicates the bias of the RW analysis is significant. |
gamma2 |
is a smooth parameter in using the normal cummulative distribution with mean 0 and variance gamma2^2 function to approximate the indicator function. |
nptb |
is the number for replication-based method for estimating Sigma_SS. |
nboots |
is the number of bootstrap samples. |
alpha.CI |
is the level of percentile bootstrap confidence interval. |
Details will be provided in the reference paper.
est
: the HTE estimators including
i) the covariate adjustment estimator;
ii) the RT estimating equation estimator;
iii) the RT&RW estimating equation estimator;
iv) the elastic integrative estimator.
ve
: variance estimate for est
.
boot.CI
: 1-alpha.CI percentiel bootstrap confidence interval for the elastic integrative estimator.
A reference paper will come up soon.
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 58 59 60 61 62 63 64 65 | library(MASS)
library(rootSolve)
library(stats)
set.seed(1234)
## population size
n <- 1e5
beta0<- c(0,1,1)
psi0 <- c(1,1,1)
family.oc <- "binomial"
X.pop <- cbind(rnorm(n,0,1),rnorm(n,0,1))
if( family.oc=="Gaussian" ){
Y0 <- cbind(1,X.pop)%*%beta0+rnorm(n,0,1)
Y1 <- cbind(1,X.pop)%*%beta0+cbind(1,X)%*%psi0+rnorm(n,0,1)
}
if( family.oc=="binomial" ){
lY0 <- -cbind(1,X.pop)%*%psi0
lY1 <- cbind(1,X.pop)%*%psi0
pY0 <- exp(lY0)/(1+exp(lY0) )
pY1 <- exp(lY1)/(1+exp(lY1) )
Y0 <- rbinom(n,1, pY0 )
Y1 <- rbinom(n,1, pY1 )
}
## RCT data
eS <- expoit(-cbind(1,X.pop)%*%c(5.5,1,1))
mean(eS)*n
S <- sapply(eS,rbinom,n = 1, size = 1)
S.ind <- which(S==1)
n.t <- length(S.ind)
n.t
X.t <- X.pop[S.ind,]
Y0.t <- Y0[S.ind]
Y1.t <- Y1[S.ind]
A.t <- rbinom(n.t,1,0.5) # randomly assign treatment to trial participant
Y.t <- Y1.t*A.t+Y0.t*(1-A.t)
## OS data
m <- 5000
P.ind <- sample(1:n,size = m)
X.os <- X.pop[P.ind,]
Y0.os <- Y0[P.ind]
Y1.os <- Y1[P.ind]
eA <- expoit( cbind(1,X.os)%*%c(1,-1,-1))
mean(eA)
A.os <- sapply(eA,rbinom,n=1,size=1)
Y.os <- Y1.os*A.os+Y0.os*(1-A.os)
A<-c(A.t,A.os)
X<-rbind(X.t,X.os)
Y<-c(Y.t,Y.os)
delta<-c(rep(1,n.t),rep(0,m))
gamma1=0.9
gamma2=2
nptb=5
nboots=2
alpha.CI=0.05
IntHTE(A, X, Y, delta, family.oc,
gamma1, gamma2, nptb, nboots, alpha.CI)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.