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).
Binary packages are available for Windows and macOS.
Installation instructions are on https://github.com/AlkemaLab/bayescoverage_app.
To use the deploy package, install the following Bayescoverage-related packages from github (now also available via R universe)
devtools::install_github("AlkemaLab/bayescoveragemodel")
devtools::install_github("AlkemaLab/localhierarchy")
Install the deploy-related packages from R universe:
install.packages('bayescoveragedeploy', repos = c('https://alkemalab.r-universe.dev'))
Also install the following package from CRAN:
install.packages(c("dplyr", "haven", "ggplot2", "shiny", "posterior", "readr", "here", "stringr", "tibble"))
For using routine data, brms is used as well, install using
install.packages("brms")
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 delivery
vdpt - DPT vaccination
anc1trimester - Antenatal care (first trimester)
ancq8 - Antenatal care quality (8+ contacts)
bfexcl0_5 - Exclusive breastfeeding (0-5 months)
cci - Comprehensive coverage index
sba - Skilled birth attendance
vmsl - 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 to
bayescoveragemodel::fit_model()
All core functionality (data processing, model fitting logic, plotting,
etc.) comes from the bayescoveragemodel package.
When bayescoveragemodel is updated:
bayescoveragemodel/inst/stan/)bayescoveragedeploy/inst/stan/
chunks/ prefix)MIT License - see LICENSE file
Stan Development Team. RStan: the R interface to Stan. https://mc-stan.org