Precompiled Stan models for fitting local country-level Bayesian hierarchical transition models for health coverage indicators.
bayescoveragedeploy is a deployment-focused package that provides precompiled Stan models for users without C++ compilers. It is a thin wrapper around the bayescoveragemodel package, which contains all the core functionality for fitting Bayesian hierarchical transition models to health coverage indicators (ANC4, institutional delivery, vaccination).
- No C++ compiler required: Stan models are precompiled during package installation
- Fast startup: No compilation wait time when running models
- Simple interface: One focused function for fitting local country models
- Full functionality: All data processing and analysis from bayescoveragemodel available
TO BE FINISHED
Binary packages are available for:
- Windows: No C++ compiler needed
- macOS: No C++ compiler needed
library(bayescoveragedeploy)
library(haven)
library(readr)
# Load data
dat0 <- read_dta("data_raw/ICEH_national.dta")
regions_dat <- read_csv("data_raw/regions_updated.csv")
# Process data using parent package functions
data <- bayescoveragemodel::process_data(
dat = dat0,
regions_dat = regions_dat,
indicator = "anc4"
)
# Fit local model with precompiled Stan models
fit <- fit_local_model(
survey_df = data,
iso_select = "KEN",
indicator = "anc4",
chains = 4,
iter_sampling = 200
)
# Plot results using parent package functions
bayescoveragemodel::plot_estimates_local_all(fit)The package includes global fit objects for:
anc4- Antenatal care (4+ visits)ideliv- Institutional deliveryvdpt- DPT vaccinationanc1trimester- Antenatal care (first trimester)ancq8- Antenatal care quality (8+ contacts)bfexcl0_5- Exclusive breastfeeding (0-5 months)cci- Comprehensive coverage indexsba- Skilled birth attendancevmsl- Measles vaccination
# Fit model with routine data
fit <- fit_local_model(
survey_df = data,
routine_df = routine_data,
iso_select = "KEN",
indicator = "anc4"
)This package contains:
- Precompiled Stan models: 4 model variants (fpem, fpem_routine, fpem_aggregates, fpem_routine_aggregates)
- Thin wrapper function:
fit_local_model()delegates tobayescoveragemodel::fit_model() - Global fit objects: Imported from bayescoveragemodel
All core functionality (data processing, model fitting logic, plotting, etc.) comes from the bayescoveragemodel package.
When bayescoveragemodel is updated:
- Check if Stan models changed (in
bayescoveragemodel/inst/stan/) - If changed, copy updated Stan files to
bayescoveragedeploy/inst/stan/ - Update include paths if needed (should use
chunks/prefix) - Rebuild and test:
roxygen2::roxygenize()
devtools::build()
devtools::install()MIT License - see LICENSE file
Stan Development Team. RStan: the R interface to Stan. https://mc-stan.org
- Main package: bayescoveragemodel
- Documentation: https://alkemalab.github.io/bayescoveragemodel/
- Issues: https://github.com/AlkemaLab/bayescoveragedeploy/issues