Package: mcmsupply 1.0.3

mcmsupply: Estimating Public and Private Sector Contraceptive Market Supply Shares

Family Planning programs and initiatives typically use nationally representative surveys to estimate key indicators of a country’s family planning progress. However, in recent years, routinely collected family planning services data (Service Statistics) have been used as a supplementary data source to bridge gaps in the surveys. The use of service statistics comes with the caveat that adjustments need to be made for missing private sector contributions to the contraceptive method supply chain. Evaluating the supply source of modern contraceptives often relies on Demographic Health Surveys (DHS), where many countries do not have recent data beyond 2015/16. Fortunately, in the absence of recent surveys we can rely on statistical model-based estimates and projections to fill the knowledge gap. We present a Bayesian, hierarchical, penalized-spline model with multivariate-normal spline coefficients, to account for across method correlations, to produce country-specific,annual estimates for the proportion of modern contraceptive methods coming from the public and private sectors. This package provides a quick and convenient way for users to access the DHS modern contraceptive supply share data at national and subnational administration levels, estimate, evaluate and plot annual estimates with uncertainty for a sample of low- and middle-income countries. Methods for the estimation of method supply shares at the national level are described in Comiskey, Alkema, Cahill (2022) <arxiv:2212.03844>.

Authors:Hannah Comiskey [aut, cre], Niamh Cahill [aut], Leontine Alkema [aut]

mcmsupply_1.0.3.tar.gz
mcmsupply_1.0.3.zip(r-4.7)mcmsupply_1.0.3.zip(r-4.6)mcmsupply_1.0.3.zip(r-4.5)
mcmsupply_1.0.3.tgz(r-4.6-any)mcmsupply_1.0.3.tgz(r-4.5-any)
mcmsupply_1.0.3.tar.gz(r-4.7-any)mcmsupply_1.0.3.tar.gz(r-4.6-any)
mcmsupply_1.0.3.tgz(r-4.6-emscripten)
manual.pdf |manual.html
DESCRIPTION |NEWS
card.svg |card.png
mcmsupply/json (API)

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

Bug tracker:https://github.com/hannahcomiskey/mcmsupply/issues

Pkgdown/docs site:https://hannahcomiskey.github.io

Uses libs:
  • jags– Just Another Gibbs Sampler for Bayesian MCMC
  • c++– GNU Standard C++ Library v3
Datasets:
  • Country_and_area_classification - The Country and area classification according to the United Nations Standaistical Division, Standard country or area codes for statistical use (M49). Adapted for use in FP2030 by the Track20 project. A subset of data from the United Nations country classifications
  • country_names - The names of the countries with national and subnational administration level data stored
  • DEFT_DHS_database - DEFT_DHS_database A database of the design effects for some of the DHS surveys in the national and subnational datasets. Due to due to multistage and clustering of the DHS sample, the average standard error is increased by a design effect (DEFT) factor over that in an equivalent simple random sample.
  • national_estimated_correlations_bivarlogitnormal - The estimated national-level correlations between the rates of change in methods
  • national_FPsource_data - DHS survey observations for the proportion of modern contraceptives supplied by the public and private sectors at the national level
  • national_FPsource_format - A checklist for ensuring national-level custom data is appropriate to be used for estimation
  • national_FPsource_VARCOV_bivarlogitnormal - An array of variance-covariance matrices transformed onto the logit-scale via the delta method. Each matrix corresponds to the DHS survey logit-transformed observations for the proportion of modern contraceptives supplied by the public and private sectors at the national level
  • national_inv_sigma_delta_hat_bivarlogitnorm - The median estimate for the national-level variance-covariance matrix of the delta.k terms in the multi-country national model.
  • national_tau_alpha_cms_hat_bivarlogitnorm - The median estimates of the precision for the national-level country
  • national_theta_rms_hat_bivarlogitnorm - The median estimates of the national-level sub-continental, sector-, method-specific intercepts in the multi-country national model. This array is used to inform the Normal prior of the country-level intercept in the single-country national model.
  • national_varcov_order_bivarlogitnormal - The order of observations to join the variance-covariance array data and the DHS survey observations for the proportion of modern contraceptives supplied by the public and private sectors at the national level
  • subnat_FPsource_data - DHS survey observations for the proportion of modern contraceptives supplied by the public and private sectors at the subnational administration level.
  • subnat_FPsource_format - A checklist for ensuring subnational-level custom data is appropriate to be used for estimation
  • subnational_alpha_cms_hat - The median estimates of the subnational-level country, sector-, method-specific intercepts in the multi-country subnational model. This array is used to inform the Normal prior of the subnational-level intercept in the single-country subnational model.
  • subnational_estimated_correlations - The estimated subnational-level correlations between the rates of change in methods
  • subnational_inv.sigma_delta_hat - The median estimate for the subnational-level precision matrix of the delta.k terms in the multi-country subnational model. This array is used to inform the multi-variate normal prior in the single-country subnational model.
  • subnational_tau_alpha_pms_hat - Subnational_tau_alpha_pms_hat The median estimates of the precision for the subnational-level country

On CRAN:

Conda:

jagscpp

5.98 score 2 stars 34 scripts 238 downloads 9 exports 132 dependencies

Last updated from:a6f30a0a04. Checks:7 ERROR, 2 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-x86_64ERROR248
source / vignettesOK251
linux-release-x86_64ERROR219
macos-release-arm64ERROR109
macos-oldrel-arm64ERROR143
windows-develERROR167
windows-releaseERROR138
windows-oldrelERROR136
wasm-releaseOK143

Exports:calculate_SE_data_from_DTAcheck_data_freshnessget_dataget_modelinputsget_posterior_P_sampsharvest_dhsplot_estimatespull_estimatesrun_jags_model

Dependencies:abindarrayhelpersaskpassbackportsbase64encbitbit64blobbootbroombslibcachemcallrcellrangercheckmateclicliprcodacodetoolsconflictedcpp11crayoncurldata.tableDBIdbplyrdigestdistributionaldplyrdtplyrevaluatefarverfastmapfontawesomeforcatsforeachfsgarglegenericsggdistggplot2gluegoogledrivegooglesheets4gtablehavenhighrhmshtmltoolshttridsisobanditeratorsjquerylibjsonliteknitrlabelinglatticelifecyclelubridatemagrittrMatrixmatrixStatsmemoisemimeminqamitoolsmodelrnumDerivopensslopenxlsxotelpillarpkgconfigplyrposteriorprettyunitsprocessxprogresspspurrrquadprogR2jagsR2WinBUGSR6raggrappdirsRColorBrewerRcppRcppArmadilloreadrreadxlrematchrematch2reprexrjagsrlangrmarkdownrstudioapirunjagsrvestS7sassscalesselectrstringistringrsurveysurvivalsvUnitsyssystemfontstensorAtextshapingtibbletidybayestidyrtidyselecttidyversetimechangetinytextzdbutf8uuidvctrsviridisLitevroomwithrxfunxml2yamlzip

Running a national level multi-country model
Load your library | Load the data | Get the JAGS model inputs and the cleaned data | Run JAGS model and get posterior point estimates with uncertainty. | Check the model diagnostics | Plot posterior point estimates with uncertainty | Pull out estimates for a particular country and year that you are particularly interested in | Review the complete posterior sample of estimated method-supply shares

Last update: 2026-03-21
Started: 2024-04-05

Package data
Load your library | Family planning source data | Country and area classification | Country names | Estimated national correlations | Estimated subnational correlations | Estimated model parameters for national one-country runs | Estimated model parameters for subnational one-country runs

Last update: 2024-04-05
Started: 2023-03-23

Running a national level single-country model
Load your library | Load the data | Get the JAGS model inputs and the cleaned data | Run JAGS model and get posterior point estimates with uncertainty | Check the model diagnostics | Plot posterior point estimates with uncertainty | Pull out estimates that you are particularly interested in | Review the complete posterior sample of estimated method-supply shares

Last update: 2024-04-05
Started: 2024-04-05

Running a national level single-country model with custom data
Load your library | Try to use unsuitable data in the get_data function. | Load suitable data into the get_data function | Get the JAGS model inputs and the cleaned data | Run JAGS model and get posterior point estimates with uncertainty | Check the model diagnostics | Plot posterior point estimates with uncertainty | Pull out estimates that you are particularly interested in | Review the complete posterior sample of estimated method-supply shares

Last update: 2024-04-05
Started: 2024-04-05

Running a subnational level multi-country model
Load your library | Get your data | Get the JAGS model inputs from the cleaned data | Run JAGS model and get posterior point estimates with uncertainty. | Check the model diagnostics | Plot posterior point estimates with uncertainty | Pull out estimates that you are particularly interested in

Last update: 2024-04-05
Started: 2024-04-05

Running a subnational level single-country model
Load your library | Load the data | Get the JAGS model inputs and the cleaned data | Run JAGS model and get posterior point estimates with uncertainty | Check the model diagnostics | Plot posterior point estimates with uncertainty | Pull out estimates that you are particularly interested in

Last update: 2024-04-05
Started: 2024-04-05

Running a subnational level single-country model with custom data
Load your library | 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. | Load the suitable data | Get the JAGS model inputs and the cleaned data | Run JAGS model and get posterior point estimates with uncertainty | Plot posterior point estimates with uncertainty | Pull out estimates that you are particularly interested in

Last update: 2024-04-05
Started: 2024-04-05

Readme and manuals

Help Manual

Help pageTopics
Calculate Standard Errors and Variance-Covariance Matrices for DHS Subnational Estimatescalculate_SE_data_from_DTA
Check Data Freshness Against DHS Referencecheck_data_freshness
The Country and area classification according to the United Nations Standaistical Division, Standard country or area codes for statistical use (M49). Adapted for use in FP2030 by the Track20 project. A subset of data from the United Nations country classificationsCountry_and_area_classification
The names of the countries with national and subnational administration level data storedcountry_names
DEFT_DHS_database A database of the design effects for some of the DHS surveys in the national and subnational datasets. Due to due to multistage and clustering of the DHS sample, the average standard error is increased by a design effect (DEFT) factor over that in an equivalent simple random sample.DEFT_DHS_database
Wrapper function that retrieves the DHS data used for modelling the proportion of modern contraceptives supplied by the public and private sectors at the national and subnational administration levels.get_data
Function to pull the complete posterior sample for the national method-supply share estimates. Functionality for the subnational models is still under development.get_posterior_P_samps
Get JAGS model inputsget_modelinputs get_subnational_modelinputs
Harvest DHS Dataset Availabilityharvest_dhs
The estimated national-level correlations between the rates of change in methodsnational_estimated_correlations_bivarlogitnormal
DHS survey observations for the proportion of modern contraceptives supplied by the public and private sectors at the national levelnational_FPsource_data
A checklist for ensuring national-level custom data is appropriate to be used for estimationnational_FPsource_format
An array of variance-covariance matrices transformed onto the logit-scale via the delta method. Each matrix corresponds to the DHS survey logit-transformed observations for the proportion of modern contraceptives supplied by the public and private sectors at the national levelnational_FPsource_VARCOV_bivarlogitnormal
The median estimate for the national-level variance-covariance matrix of the delta.k terms in the multi-country national model.national_inv_sigma_delta_hat_bivarlogitnorm
The median estimates of the precision for the national-level country, sector-, method-specific intercepts in the multi-country national model. This vector is used to inform the precision in the Normal prior of the national-level intercept in single-country national models.national_tau_alpha_cms_hat_bivarlogitnorm
The median estimates of the national-level sub-continental, sector-, method-specific intercepts in the multi-country national model. This array is used to inform the Normal prior of the country-level intercept in the single-country national model.national_theta_rms_hat_bivarlogitnorm
The order of observations to join the variance-covariance array data and the DHS survey observations for the proportion of modern contraceptives supplied by the public and private sectors at the national levelnational_varcov_order_bivarlogitnormal
Wrapper function to plot the JAGS estimatesplot_estimates
Function to pull method-supply share median estimates and credible intervals for a given year and country.pull_estimates
Wrapper function to run the jags model for estimating the proportion of modern contraceptive methods supplied by the public & private Sectors using a Bayesian hierarchical penalized spline model for the national and subnational administration levelsrun_jags_model
DHS survey observations for the proportion of modern contraceptives supplied by the public and private sectors at the subnational administration level.subnat_FPsource_data
A checklist for ensuring subnational-level custom data is appropriate to be used for estimationsubnat_FPsource_format
The median estimates of the subnational-level country, sector-, method-specific intercepts in the multi-country subnational model. This array is used to inform the Normal prior of the subnational-level intercept in the single-country subnational model.subnational_alpha_cms_hat
The estimated subnational-level correlations between the rates of change in methodssubnational_estimated_correlations
The median estimate for the subnational-level precision matrix of the delta.k terms in the multi-country subnational model. This array is used to inform the multi-variate normal prior in the single-country subnational model.subnational_inv.sigma_delta_hat
subnational_tau_alpha_pms_hat The median estimates of the precision for the subnational-level country, sector-, method-specific intercepts in the multi-country subnational model. This vector is used to inform the precision in the Normal prior of the subnational-level intercept in single-country subnational models.subnational_tau_alpha_pms_hat