# Estimating Population Average Treatment Effects with the borrowr Package

## Introduction

The borrowr package estimates the population average treatment effect (PATE) from a primary data source with borrowing from supplemental sources.

To adjust for confounding confounding, the estimation is done by fitting a model 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). The user must specify a formula for the conditional mean. This requires more thought for the Bayesian linear model as the analyst must carefully consider the functional form of the regression relationship. For BART, the right hand side of the formula need only include the confounders and the treatment variable without specification of the functional form.

Borrowing between data sources is done with Multisource Exchangeability Models (MEMs; Kaizer et al., 2018) . MEMs borrow by assuming that each supplementary data source is either “exchangeable”, or not, with the primary data source. Two data sources are considered exchangeable if their model parameters are equal. Each data source can be exchangeable with the primary data, or not, so if there are $$r$$ data sources, there are $$2 ^ r$$ possible configurations regarding the exchangeability assumptions. Each of these configurations corresponds to a single MEM. The parameters for each MEM are estimated, and we compute a posterior probability for each. The posterior density of the PATE is a weighted posterior across all possible MEMs.

## The adapt Data

We illustrate usage of the borrowr package with the adapt data:

library(borrowr)
#>           y        x  source treatment compliant
#> 1  86.51740 31.33148 Primary         0         1
#> 2 102.28575 61.68575 Primary         1         0
#> 3  90.59959 30.84199 Primary         0         1
#> 4  87.39230 29.58268 Primary         0         0
#> 5  98.84180 49.49006 Primary         1         1
#> 6  86.03576 24.80415 Primary         0         0

The data include 3 data sources with a univariate confounding variable x and the treatment variable treatment:

library(ggplot2)
ggplot(data = adapt, mapping = aes(x = x, y = y, color = as.factor(treatment))) +
geom_point() +
geom_smooth(se = FALSE) +
facet_wrap(~ source) +
theme_classic()
#> geom_smooth() using method = 'loess' and formula 'y ~ x'

We will estimate the PATE while adjusting for the confounding variable x.

## Using the pate function to estimate the PATE

pate is the primary function of the borrowr package. The following arguments are required:

• formula: a formula specifying the conditional mean model. It must include the treatment variable and the confounders. It should not include a variable indicating the data source.
• estimator: either "BART" or bayesian_lm. The default is "BART"
• src_var: a character variable indicating which column of the data indicates the data source, e.g., source a, b, or c.
• primary_source: a character variable indicating which value of src_var is the primary data source.
• trt_var: a character variable indicating which column of the data indicates the treatment variable. This must be included in the formula, and it must be coded as 1 for treated and 0 for untreated.

We will estimate the PATE using a quadratic model for x, allowing for different quadratic relationships between treated and untreated:

est <- pate(y ~ treatment*x + treatment*I(x ^ 2), data = adapt,
estimator = "bayesian_lm", src_var = "source", primary_source = "Primary",
trt_var = "treatment")

The print method shows some information about the posterior:

est
#> Population Average Treatment Effect (PATE)
#>
#> Adjustment for confounding due to noncompliance:  No
#>
#> PATE Posterior Summary Statistics (Treated minus Untreated):
#>
#> Mean Treatment Effect             Std. Dev.          Pr(PATE > 0)
#>             8.3726036             0.9213913             1.0000000

summary(est)
#>
#> Population Average Treatment Effect (PATE)
#>
#> Call:
#>
#> pate(formula = y ~ treatment * x + treatment * I(x^2), estimator = "bayesian_lm",
#>     data = adapt, src_var = "source", primary_source = "Primary",
#>     trt_var = "treatment")
#>
#> Adjustment for confounding due to noncompliance:  No
#>
#> PATE Posterior Summary Statistics (Treated minus Untreated):
#>
#> Mean Treatment Effect             Std. Dev.          Pr(PATE > 0)
#>             8.3726036             0.9213913             1.0000000
#>
#> Prior Probability of Exchangeability:
#>
#> Supp1 Supp2
#>   0.5   0.5
#>
#> Exchangeability Matrix (1 == Exchangeable with primary source):
#>
#>          MEM
#> source    1 2 3 4
#>   Primary 1 1 1 1
#>   Supp1   1 0 1 0
#>   Supp2   1 1 0 0
#>
#> MEM Posterior Probability:
#>        MEM_1        MEM_2        MEM_3        MEM_4
#> 9.078825e-12 1.870505e-03 9.644998e-01 3.362970e-02

If treatment is randomly assigned but a causal estimator is needed due to noncompliant, use the compliance_var argument, and include the compliance indicator in the formula as appropriate:

est2 <- pate(y ~ treatment + x*compliant,
data = adapt, estimator = "bayesian_lm", src_var = "source", primary_source = "Primary", trt_var = "treatment", compliance_var = "compliant")
summary(est2)
#>
#> Population Average Treatment Effect (PATE)
#>
#> Call:
#>
#> pate(formula = y ~ treatment + x * compliant, estimator = "bayesian_lm",
#>     data = adapt, src_var = "source", primary_source = "Primary",
#>     trt_var = "treatment", compliance_var = "compliant")
#>
#> Adjustment for confounding due to noncompliance:  Yes
#>
#> PATE Posterior Summary Statistics (Treated minus Untreated):
#>
#> Mean Treatment Effect             Std. Dev.          Pr(PATE > 0)
#>              4.411903              1.298826              1.000000
#>
#> Prior Probability of Exchangeability:
#>
#> Supp1 Supp2
#>   0.5   0.5
#>
#> Exchangeability Matrix (1 == Exchangeable with primary source):
#>
#>          MEM
#> source    1 2 3 4
#>   Primary 1 1 1 1
#>   Supp1   1 0 1 0
#>   Supp2   1 1 0 0
#>
#> MEM Posterior Probability:
#>        MEM_1        MEM_2        MEM_3        MEM_4
#> 1.642223e-08 8.149898e-02 3.088664e-01 6.096346e-01

To set the prior probability that a source is exchangeable with the primary source, use the exch_prob argument:

est3 <- pate(y ~ treatment*x + treatment*I(x ^ 2), data = adapt,
estimator = "bayesian_lm", src_var = "source", primary_source = "Primary",
trt_var = "treatment", exch_prob = c(1 / 3, 1 / 8))
summary(est3)
#>
#> Population Average Treatment Effect (PATE)
#>
#> Call:
#>
#> pate(formula = y ~ treatment * x + treatment * I(x^2), estimator = "bayesian_lm",
#>     data = adapt, src_var = "source", primary_source = "Primary",
#>     exch_prob = c(1/3, 1/8), trt_var = "treatment")
#>
#> Adjustment for confounding due to noncompliance:  No
#>
#> PATE Posterior Summary Statistics (Treated minus Untreated):
#>
#> Mean Treatment Effect             Std. Dev.          Pr(PATE > 0)
#>             8.3611142             0.9024862             1.0000000
#>
#> Prior Probability of Exchangeability:
#>
#>     Supp1     Supp2
#> 0.3333333 0.1250000
#>
#> Exchangeability Matrix (1 == Exchangeable with primary source):
#>
#>          MEM
#> source    1 2 3 4
#>   Primary 1 1 1 1
#>   Supp1   1 0 1 0
#>   Supp2   1 1 0 0
#>
#> MEM Posterior Probability:
#>        MEM_1        MEM_2        MEM_3        MEM_4
#> 1.256401e-12 5.177112e-04 9.343270e-01 6.515529e-02

## References

Chipman, H. & McCulloch, R. (2010) BART: Bayesian additive regression trees. Annals of Applied Statistics, 4(1): 266-298.

Kaizer, Alexander M., Koopmeiners, Joseph S., Hobbs, Brian P. (2018) Bayesian hierarchical modeling based on multisource exchangeability. Biostatistics, 19(2): 169-184.