DRbayes: Estimate causal effect using doubly robust estimators in high...

Description Usage Arguments Value Examples

View source: R/Main.R

Description

This function will take in the observed data and estimate a treatment effect. y,x, and t 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.

Usage

1
2
3
4
DRbayes(nScans = 20000, nBurn = 10000, thin = 10, y, x, t,
  whichCat = c(), y_type = "continuous", dfY = 1, dfT = 1,
  band = 3, thetaA = 1, thetaB = 0.2 * dim(x)[2], nBoot = 500,
  lower = 0, upper = 1)

Arguments

nScans

The number of MCMC scans to run

nBurn

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

t

The treatment whose causal effect is to be estimated

whichCat

A vector of indices that indicate which variables in x are categorical. The default is c(), which means the program defaults to assuming all covariates are continuous

y_type

A categorical variable indicating whether y is binary or continuous. Possible values are "binary" or "continuous", and the program defaults to "continuous"

dfY

the degrees of freedom of the splines used to model the relationship between the covariates and the outcome. If the user wants to use gaussian process priors instead of splines then dfY should be set to "GP"

dfT

the degrees of freedom of the splines used to model the relationship between the covariates and the treatment. If the user wants to use gaussian process priors instead of splines then dfY should be set to "GP"

band

The bandwidth parameter for the gaussian process kernel function

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

nBoot

The number of resampling iterations to use when estimating the credible intervals

lower

The lowest value the estimated propensity score can take in the DR estimator. This parameter defaults to 0 so that the propensity score is not trimmed.

upper

The largest value the propensity score can take in the DR estimator. This parameter defaults to 1 so that the propensity score is not trimmed.

Value

A list of values that contain the treatment effect, confidence interval for the treatment effect, WAIC for the chosen treatment model and outcome model,

Examples

1
2
3
4
5
6
7
8
9
## 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
p = 20
x = matrix(rnorm(n*p), n, p)
t = rbinom(n, 1, p=pnorm(0.7*x[,1] + 0.3*x[,2]))
y = rnorm(n, mean=t + 0.3*x[,1] + 0.6*x[,2] + 0.5*x[,3], sd=1)

est = DRbayes(y=y, t=t, x=x, nScans=2000, nBurn=1000, thin=2)

jantonelli111/DoublyRobustHD documentation built on Dec. 4, 2020, 1:09 a.m.