The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

Running a subnational level single-country model with custom data

Load your library

library(mcmsupply)
library(dplyr)
set.seed(1209)

Try to use unsuitable data. The get_data function throws an error indicating that the Method column is missing from the custom user-supplied data.

cleaned_data <- get_data(national=FALSE, local=TRUE, 
                         surveydata_filepath = "~/Documents/R/mcmsupply/inst/data-raw/my_custom_subnational_data_bad.xlsx",
                         mycountry="Ethiopia")
## Error in check_format(subnat_FPsource_format, subnat_FPsource_data): DATA FORMAT ERROR: Column Method is missing or incorrectly named.

Load the suitable data

cleaned_data <- get_data(national=FALSE, local=TRUE, 
                         surveydata_filepath = "~/Documents/R/mcmsupply/inst/data-raw/my_custom_subnational_data_good.xlsx",
                         mycountry="Ethiopia")

Get the JAGS model inputs and the cleaned data

pkg_data <- get_modelinputs(startyear=1990, endyear=2025.5,
                            nsegments=12, raw_data = cleaned_data)

Run JAGS model and get posterior point estimates with uncertainty

mod <- run_jags_model(jagsdata = pkg_data, jagsparams = NULL,
                      n_iter = 40000, n_burnin = 10000, n_thin = 15)

Plot posterior point estimates with uncertainty

plots <- plot_estimates(jagsdata = pkg_data, model_output = mod)

Pull out estimates that you are particularly interested in

estimates_2018 <- pull_estimates(model_output = mod, country = 'Ethiopia', year=2018)

head(estimates_2018)

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.