
Bootstrap posterior for a 2SLS effect as an edaphos_posterior
Source:R/causal_iv.R
causal_iv_posterior.RdWraps causal_iv_fit_2sls() in a nonparametric bootstrap over
rows (or over clusters if cluster is supplied) and packages the
resulting vector of effect estimates as an edaphos_posterior()
so that uncertainty_calibrate() and ggplot2::autoplot() apply
uniformly.
Usage
causal_iv_posterior(
data,
exposure,
outcome,
instruments,
covariates = NULL,
B = 500L,
cluster = NULL,
seed = NULL,
units = NULL
)Arguments
- data
A data frame.
- exposure
Character; name of the endogenous exposure column.
- outcome
Character; name of the outcome column.
- instruments
Character vector; names of instrument columns. More instruments than exposures gives an over-identified model on which the Sargan test is applicable.
- covariates
Optional character vector of exogenous-control column names included in both first and second stage.
- B
Integer; number of bootstrap resamples. Default
500L.- cluster
Optional character; column in
datato resample by block (e.g."kmeans_cluster"for spatial resampling).- seed
Optional RNG seed.
- units
Optional units string.