Package: bscm 1.0.1

Jouni Helske

bscm: Bayesian Synthetic Control Models

Implements the synthetic control method of Abadie, Diamond, and Hainmueller (2010) <doi:10.1198/jasa.2009.ap08746> within a Bayesian framework, enabling straightforward uncertainty quantification of treatment effects and other quantities of interest. Supports time-varying covariates with potentially time-varying effects, single or multiple treated units, and staggered treatment adoption. Provides methods for model assessment, comparison, and selection based on placebo studies, cross-validation, and posterior predictive checks. Posterior sampling is performed using Markov chain Monte Carlo via Stan.

Authors:Jouni Helske [aut, cre]

bscm_1.0.1.tar.gz
bscm_1.0.1.zip(r-4.7-x86_64)bscm_1.0.1.zip(r-4.7-arm64)bscm_1.0.1.zip(r-4.6-x86_64)bscm_1.0.1.zip(r-4.6-arm64)
bscm_1.0.1.tar.gz(r-4.7-arm64)bscm_1.0.1.tar.gz(r-4.7-x86_64)bscm_1.0.1.tar.gz(r-4.6-arm64)bscm_1.0.1.tar.gz(r-4.6-x86_64)
bscm_1.0.1.tgz(r-4.6-emscripten)
manual.pdf |manual.html✨
DESCRIPTION |NEWS
card.svg |card.png
bscm/json (API)

# Install 'bscm' in R:
install.packages('bscm', repos = c('https://cran.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/helske/bscm/issues

Uses libs:
  • onetbb– Parallelism library for C++
  • c++– GNU Standard C++ Library v3
Datasets:

On CRAN:

Conda:

onetbbcpp

1.70 score 2 scripts 306 downloads 44 exports 82 dependencies

Last updated from:89d2cec0d4. Checks:10 OK. Indexed: no.

TargetResultTimeFilesSyslog
linux-devel-arm64OK333
linux-devel-x86_64OK398
source / vignettesOK337
linux-release-arm64OK303
linux-release-x86_64OK301
windows-devel-arm64OK453
windows-devel-x86_64OK423
windows-release-arm64OK408
windows-release-x86_64OK417
wasm-releaseOK204

Exports:as_drawsaverage_treatment_effectbayes_R2beta_prbscmcheck_mcmc_diagnosticscovariate_adjustmentcovariate_imbalancedirichlet_prdonor_rankingdonor_weightseffective_donorsexponential_prgamma_prget_priorsget_refmodelget_standataget_stanfithalf_normal_prleave_donor_outlfolog_liklogistic_normal_prlooloo_R2nchainsndrawsnormal_prplacebo_effectsplot_coefsplot_effectsplot_residualsplot_weightsposterior_epredposterior_linpredposterior_predictproj_predict_bscmresidual_acfrmsermse_ratiostudent_prsynthetic_controltreatment_effecttv

Dependencies:abindbackportsBHbootcallrcheckmateclicpp11data.tabledescdigestdistributionaldplyrfarvergamm4genericsggplot2gluegridExtragtablegtoolsinlineisobandjsonlitelabelinglatticelifecyclelme4loomagrittrMASSMatrixmatrixStatsmclogitmemiscmgcvminqamvtnormnlmenloptrnnetnumDerivordinalotelpillarpkgbuildpkgconfigposteriorprocessxprogressrprojpredpspurrrquadprogQuickJSRR6rbibutilsRColorBrewerRcppRcppArmadilloRcppEigenRcppParallelRdpackreformulasrlangrstanrstantoolsS7scalesStanHeadersstringistringrtensorAtibbletidyrtidyselectucminfutf8vctrsviridisLitewithryaml

Readme and manuals

Help Manual

Help pageTopics
The 'bscm' packagebscm-package
Return posterior draws from BSCM fit as a draws objectas_draws as_draws.bscmfit
Extract posterior draws of model parameters as a data frameas.data.frame as.data.frame.bscmfit
Pre- and post-treatment average effects of a Bayesian synthetic control modelaverage_treatment_effect average_treatment_effect.bscmfit
Estimate Bayesian synthetic control modelbscm
Prior distributions in the Bayesian synthetic control modelbeta_pr bscm_prior dirichlet_pr exponential_pr gamma_pr half_normal_pr logistic_normal_pr normal_pr student_pr
Check the validity of the posterior of 'bscmfit' objectcheck_mcmc_diagnostics check_mcmc_diagnostics.bscmfit
Extract regression coefficients of a Bayesian synthetic control modelcoef coef.bscmfit
Covariate adjustments for Bayesian synthetic control modelcovariate_adjustment covariate_adjustment.bscmfit
Covariate imbalance of Bayesian synthetic control modelcovariate_imbalance covariate_imbalance.bscmfit
Donor rankingdonor_ranking
Extract donor weights of a Bayesian synthetic control modeldonor_weights donor_weights.bscmfit
Extract the number of effective donors in a Bayesian synthetic control modeleffective_donors effective_donors.bscmfit
Example bscmfit objectfit_single_treated
Expected values of posterior predictive distribution of Bayesian synthetic control modelfitted fitted.bscmfit
Get prior specifications used in the Bayesian synthetic control modelget_priors get_priors.bscmfit
Create a projpred reference model from a BSCM fitget_refmodel get_refmodel.bscmfit
Get input data to Stan from 'bscmfit' objectget_standata
Extract the 'stanfit' object from the 'bscmfit' objectget_stanfit get_stanfit.bscmfit get_stanfit.default
Leave-out donor sensitivity of a Bayesian synthetic control modelleave_donor_out leave_donor_out.bscmfit
Leave-Future-Out Cross-Validationlfo lfo.bscmfit
Posterior draws of pointwise log-likelihoodlog_lik log_lik.bscmfit
Bayesian R-squared valuebayes_R2 bayes_R2.bscmfit loo_R2 loo_R2.bscmfit
Approximate leave-one-out (LOO) cross-validation for Bayesian synthetic control modelsloo loo.bscmfit
Simulated example data with multiple treated unitsmultiple_treated
Return the number of chains of 'bscmfit' objectnchains nchains.bscmfit
Return the number of posterior draws of a 'bscmfit' objectndraws ndraws.bscmfit
Placebo effects of a Bayesian synthetic control modelplacebo_effects placebo_effects.bscmfit
Visualize regression coefficients of Bayesian synthetic control modelplot_coefs plot_coefs.bscmfit
Visualize BSCM treatment effectsplot_effects plot_effects.bscmfit plot_effects.bscm_ldo plot_effects.bscm_placebo_effects
Visualize BSCM residualsplot_residuals plot_residuals.bscmfit
Visualize donor weightsplot_weights plot_weights.bscmfit plot_weights.bscm_ldo
Plot Pareto k diagnostics from LFO cross-validationplot.bscm_lfo
Visualize BSCM estimatesplot plot.bscmfit
Posterior Draws of the Expected Predictive Distributionposterior_epred posterior_epred.bscmfit
Posterior Draws of the Linear Predictorposterior_linpred posterior_linpred.bscmfit
Posterior Predictive Distribution of Bayesian Synthetic Control Modelposterior_predict posterior_predict.bscmfit
Print method for LFO cross-validation outputprint.bscm_lfo
Print method for bscmfit objectsprint.bscmfit print.summary_bscmfit
Print MCMC Diagnosticsprint.bscmfit_diagnostics
Predictions from a projected BSCM modelproj_predict_bscm
Autocorrelation function for residuals of BSCMresidual_acf
Posterior residuals of a Bayesian synthetic control modelresiduals residuals.bscmfit
Extract root mean squared errors of a Bayesian synthetic control modelrmse rmse.bscmfit
Extract the ratio of post- to pre-treatment RMSErmse_ratio rmse_ratio.bscmfit
Extract residual standard deviations of a Bayesian synthetic control modelsigma sigma.bscmfit
Simulated example data with single treated unitsingle_treated
Summarise posterior draws of an estimated Bayesian synthetic control modelsummary summary.bscmfit
Synthetic control series of a Bayesian synthetic control modelsynthetic_control synthetic_control.bscmfit
Treatment effect estimates of a Bayesian synthetic control modeltreatment_effect treatment_effect.bscmfit
Define the time-varying coefficients for BSCMtv