PSAboot {PSAboot} | R Documentation |
Bootstrapping for propensity score analysis
Description
Bootstrapping has become a popular resampling method for estimating sampling distributions. And propensity score analysis (PSA) has become popular for estimating causal effects in observational studies. This function implements bootstrapping specifically for PSA. Like typical bootstrapping methods, this function estimates treatment effects for M random samples. However, unlike typical bootstrap methods, this function allows for separate sample sizes for treatment and control units. That is, under certain circumstances (e.g. when the ratio of treatment-to-control units is large) bootstrapping only the control units may be desirable. Additionally, this function provides a framework to use multiple PSA methods for each bootstrap sample.
Usage
PSAboot(
Tr,
Y,
X,
M = 100,
formu = as.formula(paste0("treat ~ ", paste0(names(X), collapse = " + "))),
control.ratio = 5,
control.sample.size = min(control.ratio * min(table(Tr)), max(table(Tr))),
control.replace = TRUE,
treated.sample.size = min(table(Tr)),
treated.replace = TRUE,
methods = getPSAbootMethods(),
parallel = TRUE,
seed = NULL,
...
)
Arguments
Tr |
numeric (0 or 1) or logical vector of treatment indicators. |
Y |
vector of outcome variable |
X |
matrix or data frame of covariates used to estimate the propensity scores. |
M |
number of bootstrap samples to generate. |
formu |
formula used for estimating propensity scores. The default is to use
all covariates in |
control.ratio |
the ratio of control units to sample relative to the treatment units. |
control.sample.size |
the size of each bootstrap sample of control units. |
control.replace |
whether to use replacement when sampling from control units. |
treated.sample.size |
the size of each bootstrap sample of treatment units. The default uses all treatment units for each bootstrap sample. |
treated.replace |
whether to use replacement when sampling from treated units. |
methods |
a named vector of functions for each PSA method to use. |
parallel |
whether to run the bootstrap samples in parallel. |
seed |
random seed. Each iteration, i, will use a seed of |
... |
other parameters passed to |
Value
a list with following elements:
- overall.summary
Data frame with the results using the complete dataset (i.e. unbootstrapped results).
- overall.details
Objects returned from each method for complete dataset.
- pooled.summary
Data frame with results of each bootstrap sample.
- pooled.details
List of objects returned from each method for each bootstrap sample.
- control.sample.size
sample size used for control units.
- treated.sample.size
sample size used for treated units.
- control.replace
whether control units were sampled with replacement.
- treated.replace
whether treated units were sampled with replacement.
- Tr
vector of treatment assignment.
- Y
vector out outcome.
- X
matrix or data frame of covariates.
- M
number of bootstrap samples.
See Also
getPSAbootMethods
Examples
library(PSAboot)
data(pisa.psa.cols)
data(pisausa)
bm.usa <- PSAboot(Tr = as.integer(pisausa$PUBPRIV) - 1,
Y = pisausa$Math,
X = pisausa[,pisa.psa.cols],
control.ratio = 5, M = 100, seed = 2112)