bpsm: Bayesian Propensity Score Matching

Description Usage Arguments Details Value Note Author(s) References See Also Examples

View source: R/bpsm.R

Description

A function includes both Bayesian and non-Bayesian methods to incorporate uncertainties in estimated propensity scores and to provide adjusted standard errors for propensity score matching estimators.

Usage

1
bpsm(Y, t, X, estimand = "ATE", method = "AI", M = 1, L = 1, K = 10000, S = 1000)

Arguments

Y

A vector containing the outcome variable.

t

A vector containing the treatment indicator.

X

A matrix containing the covariates.

estimand

A character string for the estimand. The default is "ATE", average treatment effects. The other option is "ATT", average treatment effects on the treated.

method

A character string for the method to adjust standard errors. The default is "AI", which uses the methods proposed by Abadie and Imbens (2011). "BPSM" invokes the Bayesian methods developed by An (2010). "Both" use both methods.

M

Number of matches requested.

L

Number of within-group matches requested for the AI method.

K

Numbers of iterations. Only needed for BPSM.

S

Number of posterior samples. Only needed for BPSM.

Details

Estimated propensity scores are used to match treated units with untreated units. The function includes two methods to take into account the uncertainties in the estimated propensity scores and to provide adjusted standard errors. The AI method is computationally more efficient but may produce negative standard errors in some cases. In contrast, the BPSM method always provides positive standard errors but requires longer computational time to converge, especially when the sample size is large.

Value

estimates

The estimated treatment effects and their adjusted standard errors. Phat shows the results with unadjusted standard errors. AI shows the results with adjusted standard errors based on the AI method. BP* shows the results with adjusted standard errors based on the Bayesian method.

estimand

A character string indicting the estimand requested.

time

The time elapsed for the computation.

sims

The number of iterations requested for the Bayesian computation, K

posterior

The posterior sample distribution of the treatment effects. BPSM uses the posterior standard deviation to approximate the standard error.

Note

The latest verison of the Abadie and Imbens paper may be found at http://www.hks.harvard.edu/fs/aabadie/pscore.pdf. To use BPSM, first install JAGS to the local computer. JAGS is available at http://mcmc-jags.sourceforge.net/. Some parts of the code is still preliminary. So use at your own risk.

Author(s)

Weihua An, Huizi Xu, and Zhida Zheng, Indiana University Bloomington.

References

An, Weihua. 2010. "Bayesian Propensity Score Estimators: Incorporating Uncertainties In Propensity Scores Into Causal Inference." Sociological Methodology 40: 151-189. http://mypage.iu.edu/~weihuaan/Documents/2010_BPSE.pdf.

Abadie, Alberto and Guido W. Imbens. 2011. “Matching On the Estimated Propensity Score." Working Paper. http://mypage.iu.edu/~weihuaan/Documents/pscore_2011.pdf.

See Also

bpsr, modelpsm, modelpsr, Match, sortps

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
library(boot)

a = 2; b = c(1, -2, 5); N = 500
x1 <- runif(N, 0, 1)
x2 <- runif(N, 0, 1)
X <- as.matrix(cbind(rep(1, N), x1, x2))
p <- inv.logit( X %*% b )
t <- rbinom(N, 1, p)
e <- rnorm(N, 0, 1)
Y <- 5 * t + a * ( x1 + x2 ) + e
bpsm( Y, t, X, method = "AI", estimand = "ATE" )

Example output

Loading required package: R2jags
Loading required package: rjags
Loading required package: coda
Linked to JAGS 4.3.0
Loaded modules: basemod,bugs

Attaching package: 'R2jags'

The following object is masked from 'package:coda':

    traceplot

Loading required package: Matching
Loading required package: MASS
## 
##  Matching (Version 4.9-6, Build Date: 2019-04-07)
##  See http://sekhon.berkeley.edu/matching for additional documentation.
##  Please cite software as:
##   Jasjeet S. Sekhon. 2011. ``Multivariate and Propensity Score Matching
##   Software with Automated Balance Optimization: The Matching package for R.''
##   Journal of Statistical Software, 42(7): 1-52. 
##

Loading required package: boot
$estimates
          est        se
Phat 5.232024 0.2800884
AI   5.232024 0.2705232

$estimand
[1] "ATE"

$time
   user  system elapsed 
  0.155   0.007   0.175 

IUPS documentation built on May 1, 2019, 6:35 p.m.

Related to bpsm in IUPS...