SSLBinary: Estimate causal effect assuming homogeneous treatment effect...

Description Usage Arguments Value Examples

View source: R/HDCBinary.R

Description

This function will take in the observed data and estimate a treatment effect. y,x, and z must all be supplied, though all other parameters have pre-set values the user can proceed with unless they wish to change the prior specification. We recommend using the EB option to estimate lambda0 as results can be very sensitive to this parameter and choosing it a-priori is a difficult task. Note, however, that the EB option will take longer as it requires running multiple MCMCs instead of just one

Usage

1
2
3
4
SSLBinary(nScans = 20000, burn = 10000, thin = 10, y, x, z,
  z_type = "binary", lambda1 = 0.1, thetaA = 1, thetaB = 0.2 *
  dim(x)[2], lambda0 = "EB", weight = NULL, kMax = 20,
  comparison_groups = c(1, 0))

Arguments

nScans

The number of MCMC scans to run

burn

The number of MCMC scans that will be dropped as a burn-in

thin

This number represents how many iterations between each scan that is kept

y

The outcome to be analyzed

x

An n by p matrix of potential confounders

z

The treatment whose causal effect is to be estimated

z_type

String indicating whether treatment is binary or continuous. The default value is z_type="binary", though it should be set to z_type = "continuous" if the treatment is continuous

lambda1

A numeric value for lambda1

thetaA

The first parameter of the beta prior on the overall sparsity level

thetaB

The second parameter of the beta prior on the overall sparsity level

lambda0

Either a numeric value to be used for the value of lambda0 or "EB" is specified to indicate that it will be estimated via empirical Bayes

weight

The weight used to prioritize variables associated with treatment. This parameter has a default of NULL, and should only be used when lambdo0 is provided instead of estimated using empirical Bayes

kMax

The maximum number of covariates to be prioritized due to association with treatment

comparison_groups

parameter that controls which two levels of treatment should be compared. If the treatment is binary then there is no need to change this parameter since it defaults to c(1,0)

Value

A list of values that contain the treatment effect, confidence interval for the treatment effect, posterior means and confidence intervals for the regression coefficients for confounders, and the posterior mean of the binary variables indicating whether a covariate is important.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## p can be larger than n, but we keep the number of covariates small here
## just for illustration so that the code will finish faster
## n=200 and p=200 takes ~5 minutes to run for example
n = 200
p = 20
x = matrix(rnorm(n*p), n, p)
z = rbinom(n, 1, p=pnorm(0.7*x[,1] + 0.3*x[,2]))
y = rbinom(n, 1, p=pnorm(z + 0.3*x[,1] + 0.6*x[,2] + 0.5*x[,3]))

ssl = SSLBinary(y=y, z=z, x=x, nScans=3000, burn=1000, thin=2)
## Output treatment effect and credible interval
print(ssl$TreatEffect)
print(ssl$TreatEffectCI)

## Print the posterior inclusion probabilities for confounders
print(ssl$gammaPostMean)

jantonelli111/HDconfounding documentation built on Jan. 14, 2020, 9:16 p.m.