psace: Multiple robust estimators of average causal effects within...

Description Usage Arguments Details Value References Examples

View source: R/psace.R

Description

Implements various estimators of PS-ACE from randomized experiments and observational studies

Usage

1
psace(X, Z, S, Y, family.Y, nboot = 0)

Arguments

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.

Details

Details will be provided in the reference paper.

Value

References

A reference paper will come up soon.

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
library(stats)

set.seed(1)
#X consists of 5 covariates
n <- 500
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(X,Z,S,Y1,family.Y="gaussian",nboot=50)
out1$tau10aw
out1$ve.tau10aw

out2<-psace(X,Z,S,Y2,family.Y="binomial",nboot=50)
out2$tau10aw
out2$ve.tau10aw

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