README.md

BAC

Bayesian Adjustment for Confounding

R package to perform the method of "Bayesian Effect Estimation Accounting for Adjustment Uncertainty" by Chi Wang, Giovanni Parmigiani, and Francesca Dominici.

Why use BAC?

What does BAC do?

Consider a continuous treatment X, a continuous outcome Y, and a set of possible confounders D = {D1, D2, ..., Dp}. BAC models:

allowing only some of the D1, D2, ..., Dp to be included in the exposure or the outcome model at each iteration of the MCMC.

The BAC prior links the indicators of inclusion of D1, D2, ..., Dp to encourage the inclusion of the true confounders in the outcome model. Specifically, BAC is designed to capture confounders that are weakly associated with the outcome, but strongly associated with the exposure, making them strong confounders.

What does the BAC R package do?

The BAC R package models the exposure X as normal with mean linear in the covariates D, and the outcome Y also as normal with mean linear in X and in the covariates. The priors on the coefficients are assumed normal, and the prior on the variance terms for both the exposure and the outcome models are inverse gamma distributions.

The BAC function in the BAC R package returns a list of: - alphaX: posterior samples of the indicators of inclusion for each of the covariates D1, D2, ..., Dp in the exposure model. Specifically if alphaX[i, j] = 1 if in iteration i of the MCMC, Dj was included in the model, and alphaX[i, j] = 0 otherwise.

Installing BAC

Installing and using BAC in Rstudio is straightforward. You will first need the devtools R package.

Install and load devtools

Simply write install.packages('devtools') in the console to install it, and load it using library(devtools).

Install and load BAC

library(devtools)

devtools::install_github("gpapadog/BAC")

BAC example

toyData

toyData is a simulated data set of 100 observations with p = 50 potential confounders generated as:

Analyzing toyData with BAC

library(BAC)

data(toyData)
X <- toyData[, 2]
Y <- toyData[, 1]
D <- toyData[, - c(1, 2)]

bac <- BAC(X = X, Y = Y, D = D, Nsims = 1000, chains = 3)


gpapadog/BAC documentation built on Feb. 15, 2021, 6:37 a.m.