| Title: | Precompiled Stan Models for Deployment of Bayesian Coverage Model |
|---|---|
| Description: | Provides precompiled Stan models for fitting local country-level Bayesian hierarchical transition models for health coverage indicators. This package uses the rstan backend with precompiled models for users without C++ compilers. All core functionality is provided by the bayescoveragemodel package. |
| Authors: | Leontine Alkema [aut, cre] |
| Maintainer: | Leontine Alkema <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.21 |
| Built: | 2026-06-10 03:00:20 UTC |
| Source: | https://github.com/AlkemaLab/bayescoveragedeploy |
Provides precompiled Stan models for fitting local country-level Bayesian hierarchical transition models for health coverage indicators (ANC4, institutional delivery, vaccination). This package uses the rstan backend with precompiled models for users without C++ compilers. All core functionality is provided by the bayescoveragemodel package.
This package contains precompiled Stan models for the following variants:
fpem - Basic transition model
fpem_routine - Model with routine data
fpem_aggregates - Model with subnational aggregates
fpem_routine_aggregates - Model with routine data and aggregates
The main user-facing function is fit_local_model.
Maintainer: Leontine Alkema [email protected]
Stan Development Team (NA). RStan: the R interface to Stan. R package version 2.32.7. https://mc-stan.org
Useful links:
Report bugs at https://github.com/AlkemaLab/bayescoveragedeploy/issues
This function provides a simplified interface for fitting country-specific models using precompiled Stan models. All data processing and model logic is delegated to bayescoveragemodel::fit_model().
fit_local_model( survey_df, iso_select, indicator = "anc4", routine_df = NULL, chains = 4, seed = 1234, refresh = 10, iter_sampling = 300, iter_warmup = 150, adapt_delta = 0.95, max_treedepth = 14, ... )fit_local_model( survey_df, iso_select, indicator = "anc4", routine_df = NULL, chains = 4, seed = 1234, refresh = 10, iter_sampling = 300, iter_warmup = 150, adapt_delta = 0.95, max_treedepth = 14, ... )
survey_df |
Survey data (processed via bayescoveragemodel::process_data) |
iso_select |
ISO code for the country |
indicator |
Indicator name ("anc4", "ideliv", "vdpt", etc.) |
routine_df |
Optional tibble with routine data |
chains |
Number of MCMC chains (default 4) |
seed |
Random seed (default 1234) |
refresh |
Progress update frequency (default 10) |
iter_sampling |
Number of sampling iterations (default 200) |
iter_warmup |
Number of warmup iterations (default 150) |
adapt_delta |
Target acceptance rate (default 0.9) |
max_treedepth |
Maximum tree depth (default 14) |
... |
Additional arguments passed to bayescoveragemodel::fit_model() |
Model fit object (same structure as bayescoveragemodel::fit_model)
## Not run: # ===== Quick Example ===== library(haven) dat0 <- read_dta("data_raw/ICEH_national.dta") regions_dat <- readr::read_csv("data_raw/regions_updated.csv") # Process data data <- bayescoveragemodel::process_data( dat = dat0, regions_dat = regions_dat, indicator = "anc4" ) # Fit model (fast test) fit <- fit_local_model( survey_df = data, iso_select = "KEN", indicator = "anc4", chains = 1, iter_sampling = 5, iter_warmup = 5 ) # Plot results bayescoveragemodel::plot_estimates_local_all(fit) # ===== Production Example ===== fit_prod <- fit_local_model( survey_df = data, iso_select = "KEN", indicator = "anc4", chains = 4, iter_sampling = 200, iter_warmup = 150, seed = 123 ) # ===== More Examples ===== # See BayesCoverage app! ## End(Not run)## Not run: # ===== Quick Example ===== library(haven) dat0 <- read_dta("data_raw/ICEH_national.dta") regions_dat <- readr::read_csv("data_raw/regions_updated.csv") # Process data data <- bayescoveragemodel::process_data( dat = dat0, regions_dat = regions_dat, indicator = "anc4" ) # Fit model (fast test) fit <- fit_local_model( survey_df = data, iso_select = "KEN", indicator = "anc4", chains = 1, iter_sampling = 5, iter_warmup = 5 ) # Plot results bayescoveragemodel::plot_estimates_local_all(fit) # ===== Production Example ===== fit_prod <- fit_local_model( survey_df = data, iso_select = "KEN", indicator = "anc4", chains = 4, iter_sampling = 200, iter_warmup = 150, seed = 123 ) # ===== More Examples ===== # See BayesCoverage app! ## End(Not run)