| Type: | Package |
| Title: | Estimate Causal Effects with Borrowing Between Data Sources |
| Version: | 0.2.0 |
| Author: | Jeffrey A. Boatman [aut, cre], David M. Vock [aut], Joseph S. Koopmeiners [aut] |
| Maintainer: | Jeffrey A. Boatman <jeffrey.boatman@gmail.com> |
| Description: | Estimate population average treatment effects from a primary data source with borrowing from supplemental sources. Causal estimation is done with either a Bayesian linear model or with Bayesian additive regression trees (BART) to adjust for confounding. Borrowing is done with multisource exchangeability models (MEMs). For information on BART, see Chipman, George, & McCulloch (2010) <doi:10.1214/09-AOAS285>. For information on MEMs, see Kaizer, Koopmeiners, & Hobbs (2018) <doi:10.1093/biostatistics/kxx031>. |
| Depends: | R (≥ 3.5.0) |
| License: | GPL (≥ 3) |
| Encoding: | UTF-8 |
| LazyData: | true |
| RoxygenNote: | 7.1.1 |
| Imports: | mvtnorm(≥ 1.0.8), BART(≥ 2.1), Rcpp (≥ 1.0.0) |
| LinkingTo: | Rcpp |
| Suggests: | knitr, rmarkdown, ggplot2 |
| VignetteBuilder: | knitr |
| NeedsCompilation: | yes |
| Packaged: | 2020-12-08 00:09:56 UTC; Jeff |
| Repository: | CRAN |
| Date/Publication: | 2020-12-08 12:50:03 UTC |
Data set used in the package vignette
Description
A simulated data set used in the package vignette. Data generatingmechanism is adapted from Hill (2011). Includes 3 data sources to illustrateborrowing information in estimate the population average treatment effect.
Usage
adaptFormat
A data frame with 180 rows and 5 variables
- y
the outcome
- x
a variable associated with y and treatment
- source
character variable with 3 levels: "Primary", "Supp1", "Supp2"
- treatment
treatment variable. 1 = treated, 0 = untreated
- compliant
compliance indicator. 1 = compliant to treatment,0 = noncompliant to treatment
References
Hill, Jennifer L. (2011) Bayesian Nonparametric Modeling for Causal Inference.Journal of Computational and Graphical Statistics, 20:1, 217-240.
Examples
data(adapt)head(adapt)Posterior Credible Interval for Population Average Treatment Effect (PATE)
Description
Computes an equal-tailed credible interval for an object of class 'pate'
Usage
credint(object, level = 0.95)Arguments
object | An object of class pate fit by the |
level | the credible level required |
Examples
data(adapt)est <- pate(y ~ treatment*x + treatment*I(x ^ 2), data = adapt, estimator = "bayesian_lm", src_var = "source", primary_source = "Primary", trt_var = "treatment")credint(est)Population Average Treatment Effect (PATE)
Description
Estimates the population average treatment effect from a primary data sourcewith potential borrowing from supplemental sources. Adjust for confounding by fittinga conditional mean model with the treatment variable and confounding variables.
Usage
pate( formula, estimator = c("BART", "bayesian_lm"), data, src_var, primary_source, exch_prob, trt_var, compliance_var, ndpost = 1000, model_prior = c("none", "power", "powerlog"), ...)Arguments
formula | An object of class formula. The left hand side must be the outcome,and the right hand side must include the treatment variable. To adjust for confounding,the right hand side must also include the confounders. For the Bayesian linear model,the use is responsible for specifying the function form. |
estimator | "bayesian_lm" or "BART". If "bayesian_lm", a Bayesian linear model witha normal inverse-gamma prior. If "BART", Bayesian Additive Regression Trees |
data | the data frame with the outcome variable and all variables in the formula |
src_var | a character variable which variable indicates the source variable.Must match a column name in the data. |
primary_source | character variable indicating the primary source. Must matchone of the values of |
exch_prob | numeric vector giving prior probability that each source is exchangeablewith the primary source. Number of elements must be equal to the number of sourcesminus 1. Each element must be between 0 and 1.Order of probabilities should match the order returned by calling |
trt_var | which variable indicates the treatment.Must match a column name in the data. Must be coded as numeric values 0 and 1, 0 foruntreated, 1 for treated. |
compliance_var | Optional argument if adjustment for confoundingdue to noncompliance is needed. |
ndpost | number of draws from the posterior |
model_prior | specifices the prior probability of exchangebility of data sources. Details for priorsare given in Boatman et al. (2020). |
... | additional arguments passed to BART |
Details
To adjust for confounding, the PATE is estimated using amodel for the conditional mean given treatment and confounders. Currently,two models are available, a Bayesian linear model with an inverse-gamma prior,and Bayesian Additive Regression Trees (BART; Chipman & McCulloch, 2010).The user must specify aformula for the conditional mean. This requires more thought for theBayesian linear model as the analyst must carefully consider the functionalform of the regression relationship. For BART, the right hand side of theformula need only include the confounders and the treatment variable withoutspecification of the functional form. If there is no confounding, the right handside of the formula needs to include the treatment variable only.
Ifformula = "bayesian_lm", then the function fits the Bayesian linear model
Y = X\beta + \epsilon, \epsilon ~ N(0, \sigma ^ 2).
The prior on the regression coefficients is normal with mean vector 0 and variancematrix with diagonal elements equal to 100 and off-diagonal elements equal to 0.The prior on\sigma ^ 2 is a Inverse Gamma(0.1, 0.1)
Ifformula = "BART", the function fits the Bayesian Additive Regression Treesmodel, but with a modified prior on the terminal nodes. The prior on each terminal nodeis
N(0, \gamma\sigma ^ 2).
The package uses the default value
\gamma = 1 / (16 * m * \hat{sigma ^ 2})
wherem is the number of trees and\hat{sigma ^ 2} is the variance ofY.
Borrowing between data sources is done withMultisource Exchangeability Models(MEMs; Kaizer et al., 2018) . MEMs borrow by assuming that each supplementary data sourceis either "exchangeable", or not, with the primary data source. Two data sourcesare considered exchangeable if their model parameters are equal. Each data sourcecan be exchangeable with the primary data, or not, so if there arer datasources, there are2 ^ r possible configurations regarding the exchangeabilityassumptions. Each of these configurations corresponds to a single MEM.The parameters for each MEM are estimated, and we compute a posterior probabilityfor each. The posterior density of the PATE is a weighted posterior across allpossible MEMs.
Value
A list with components:
call | The function call |
estimator | The estimator used to adjust for confounding, "bayesian_lm" forBayesian linear model, or "BART" for Bayesian additive regression trees |
EY0 | Posterior draws of the expected potential outcome if all observations weretreated. One column for each MEM |
EY1 | Posterior draws of the expected potential outcome if all observations wereuntreated. One column for each MEM |
log_marg_like | Log marginal likelihood for each MEM |
mem_pate_post | Array containing, for each MEM, posterior draws for the populationaverage treatment effect |
MEMs | Matrix showing showing which data sources are exchangeable under each MEM.1 = exchangeable. |
pate_post | Posterior draws for the population average treatment effect. Weightedaverage of |
post_probs | Posterior probability that each MEM (shown in the list element |
exch_prob | Prior probability that each source is exchangeable with the primary source. |
beta_post_mean | If |
.
beta_post_var | If |
.
beta_post_var | If |
.
non_compliance | Logical, indicating whether the model adjusted for confoundingdue to noncompliance |
References
Chipman, H. & McCulloch, R. (2010) BART: Bayesian additive regression trees. Annalsof Applied Statistics, 4(1): 266-298.
Kaizer, Alexander M., Koopmeiners, Joseph S., Hobbs, Brian P. (2018) Bayesianhierarchical modeling based on multisource exchangeability. Biostatistics,19(2): 169-184.
Boatman, Jeffrey A., Vock, David. M, and Koopmeiners, Joseph S. (2020) Borrowing fromSupplemental Sources to Estimate Causal Effects from a Primary Data Source. arXiv:2003.09680
Examples
data(adapt)est <- pate(y ~ treatment*x + treatment*I(x ^ 2), data = adapt, estimator = "bayesian_lm", src_var = "source", primary_source = "Primary", trt_var = "treatment")summary(est)