DRbayesER: Estimate causal exposure response curve using a doubly robust...

Description Usage Arguments Value Examples

View source: R/Main.R

Description

This function will take in the observed data and estimate the treatment effect curve, which is the average potential outcomes across a range of exposure values. 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
5
DRbayesER(nScans = 20000, nBurn = 10000, thin = 10, y, x, t,
  locations = seq(quantile(t, 0.05), quantile(t, 0.95), length = 20),
  whichCat = c(), y_type = "continuous", dfY = 1, dfT = 1,
  band = 3, thetaA = 1, thetaB = 0.2 * dim(x)[2], nBoot = 500,
  threshold = 0.00001)

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

locations

The locations for t at which the user wants to estimate E(Y(t)), the average potential outcome at level t. The default is a grid across the range of t.

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

threshold

The lowest value that the ratio of propensities in the definition of the pseudo outcome used in the continuous doubly robust estimator can take. This is analagous to trimming the propensity score for binary treatments, and the parameter defaults to not trimming.

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 <- 0.6*x[,1] + 0.6*x[,2] + rnorm(n)
y <- 5 + 0.05*t^3 - 0.1*t^2 + 0.5*x[,1] + 0.5*x[,2] + rnorm(n)

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

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