README.md

psace

The goal of psace is to implement various estimators of Average Causal Effects within principal strata (PS-ACEs) from randomized experiments and observational studies.

Installation with devtools:

devtools::install_github("shuyang1987/psace")

Main Paper: coming soon

The reference paper will come soon.

Usage

psace(X,Z,S,Y,family.Y,nboot)

Arguments

| Argument | | | -------- | ------------------------------------------------------------------ | | X | is a matrix of pre-treatment covariates without intercept (n x p). | | Z | is a vector of treatment (n x 1). | | S | is a vector of binary intermediate outcome (n x 1). | | Y | is a vector of outcome ( n x 1). | | family.Y | specifies the family for the outcome model. | | * | “gaussian”: a linear regression model for the continuous outcome. | | * | “binomial”: a logistic regression model for the binary outcome. | | nboot | is the number of bootstrap samples. |

Value

| | | | ---------------------------- | ------------------------------------------------------------------------------------------------------------ | | Complier | | | tau10w | a principal score weighting estimator of tau10 | | tau10sw | a stabilized weighting estimator of tau10 | | tau10reg | a regression estimator of tau10 using outcome mean regression and inverse probability of treatment weighting | | tau10reg2 | a regression estimator of tau10 using outcome mean and principal score regression | | tau10aw | a triply robust estimator of tau10 | | bootstrap variance estimator | ve.tau10w,ve.tau10sw,ve.tau10reg,ve.tau10reg2,ve.tau10aw |

| | | | ---------------------------- | ------------------------------------------------------------------------------------------------------------ | | Never Taker | | | tau00w | a principal score weighting estimator of tau00 | | tau00sw | a stabilized weighting estimator of tau00 | | tau00reg | a regression estimator of tau00 using outcome mean regression and inverse probability of treatment weighting | | tau00reg2 | a regression estimator of tau00 using outcome mean and principal score regression | | tau00aw | a triply robust estimator of tau00 | | bootstrap variance estimator | ve.tau00w,ve.tau00sw,ve.tau00reg,ve.tau00reg2,ve.tau00aw |

| | | | ---------------------------- | ------------------------------------------------------------------------------------------------------------ | | Always Taker | | | tau11w | a principal score weighting estimator of tau11 | | tau11sw | a stabilized weighting estimator of tau11 | | tau11reg | a regression estimator of tau11 using outcome mean regression and inverse probability of treatment weighting | | tau11reg2 | a regression estimator of tau11 using outcome mean and principal score regression | | tau11aw | a triply robust estimator of tau11 | | bootstrap variance estimator | ve.tau11w,ve.tau11sw,ve.tau11reg,ve.tau11reg2,ve.tau11aw |

Example

This is an example for illustration.

library(stats)

set.seed(1)
#X consists of 5 covariates
n <- 1000
X <- rnorm(n,0.25,1)
for(k in 2:4){
  X <- cbind(X,rnorm(n,0.25,1))
}
X <- cbind(X,rbinom(n,1,0.5))

# treatment assignment
Xtilde1 <- (X-0.25)/1
theta <- 0
eta <- c(0,1,1,1,1,theta)/2.5
px0 <- exp(cbind(1,Xtilde1)%*%eta)
pix  <- px0/(1+px0)
Z   <- rbinom(n,1,pix)

# S-model
eta1 <- c( 2,-1,1,-1,1,theta)/2.5
eta0 <- c(-2,1,-1,1,-1,theta)/2.5
p1xtemp <- exp(cbind(1,Xtilde1)%*%eta1)
p0xtemp <- exp(cbind(1,Xtilde1)%*%eta0)
p1x <- p1xtemp/(1+p1xtemp)
p0x <- p0xtemp/(1+p0xtemp)
s1<-rbinom(n,1,p1x)
s0<-rbinom(n,1,p0x)
S<-s1*Z+s0*(1-Z)

# Y-model (continuous outcome)
Y1<- Xtilde1%*%rep(1,5)*(1+S+Z) +rnorm(n)
# Y-model (binary outcome)
leYtemp <- Xtilde1%*%rep(1,5)*(1+S+Z)/4
eY<-exp(leYtemp)/(1+exp(leYtemp) )
Y2<-rbinom(n,1,eY)

out1<-PSACE::psace(X,Z,S,Y1,family.Y="gaussain",nboot=100)
out1$tau10aw
#> [1] 0.2610623
out1$ve.tau10aw
#> [1] 0.4686136

out2<-PSACE::psace(X,Z,S,Y2,family.Y="binomial",nboot=100)
out2$tau10aw
#> [1] 0.08370875
out2$ve.tau10aw
#> [1] 0.00627494


shuyang1987/psace documentation built on May 6, 2020, 12:37 a.m.