Learn R Programming

sae4health

Small Area Estimation for Key Health and Demographic Indicators from Household Surveys

Overview

The ‘sae4health’ package enables small area estimation (SAE) of health and demographic indicators in low- and middle-income countries (LMICs). It powers an R Shiny app that helps public health analysts, policymakers, and researchers generate subnational estimates and prevalence maps for 150+ binary indicators from Demographic and Health Surveys (DHS). Basing its core SAE analysis workflow on the ‘surveyPrev’ package, the app ensures methodological rigor through guided model selection, automated fitting, and interactive visualization. For more details, visit our official website for detailed documentation.

This software is for research purpose only and is licensed under the terms specified in the LICENSE file.

The Github repo maintains the source code for this R Shiny application and it is structured as an R package. There are two primary venues to utilize this application:

  1. Web-Based Version:
  • Location: Deployed on an online server.
  • Requirements: Internet access and a web browser.
  • Usage: Ideal for users who prefer quick access without local setup.
  1. Local R Package Installation:
  • Location: on user’s machine, launched by RStudio.
  • Requirements: R environment and dependent packages.
  • Usage: Suitable for users who wish to run the application directly within their local R environment. This method allows for enhanced customization.

Web-based R Shiny app

The R Shiny app is readily accessible via https://rsc.stat.washington.edu/surveyPrevRShiny/. The only requirement is a stable internet connection. This web-based deployment supports full functionality and serves as the primary distribution channel.

One advantage of the online version is that it includes preloaded shapefiles, reducing the need for manual uploads. While all versions require users to upload their own DHS survey datasets for analysis, currently the online version internally hosts the 2018 Nigeria DHS, 2022 Kenya DHS, and 2023 Senegal DHS (without the need for data upload!), with more datasets planned for future inclusion.

Installation of the R Shiny app as a R package

Some non-CRAN dependencies can be installed using the following command. We strongly recommend installing the most recent version of SUMMER and surveyPrev package from Github.

# install.packages("devtools")
devtools::install_github("richardli/SUMMER")
devtools::install_github("richardli/surveyPrev")

install.packages("INLA",repos=c(getOption("repos"),
                        INLA="https://inla.r-inla-download.org/R/testing"),dep=TRUE)

You can then install the development version of sae4health with:

devtools::install_github("wu-thomas/sae4health")

Processing the analysis dataset for indicators, using specific coding schemes and handling labels, requires the following libraries to be preloaded before running the app:

library(labelled)
library(naniar)
library(sjlabelled)
library(dplyr)
library(data.table)
library(haven)

You can launch the R Shiny app with the following command, and we recommend opening a new browser tab from within the launched R Shiny app for better accessing web links.


library(sae4health)
sae4health::run_app()

If the colors in the interactive Leaflet maps appear inverted relative to the legend (e.g., regions with high values in the legend are shown in low-value colors), you can run the app with the following option. This issue arises due to differences in R and Leaflet package versions and is beyond our control.


sae4health::run_app(legend_color_reverse=T)

For WHO workshop attendees only:
If you have received the WHO shapefile distributed by WHO officials for this technical workshop and are using the WHO version of the app, please run the following version:


sae4health::run_app(version='DHS-WHO')

Copy Link

Version

Install

install.packages('sae4health')

Monthly Downloads

550

Version

1.2.2

License

AGPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Yunhan Wu

Last Published

April 25th, 2025

Functions in sae4health (1.2.2)

ref_tab_new

Newly Added Indicators Reference Table
sae4health-package

R Shiny App for Small Area Estimation of Health and Demographic Indicators
ref_tab_all

Combined Indicators Reference Table
DHS.dataset.meta

DHS Dataset Metadata
num_to_admin

Convert Numeric Code to Administrative Level String
natl.WHO.shp

WHO National-Level Shapefile
match_all_result

Matching Results Between DHS and GitHub Indicators, Imported from surveyPrev
DHS.country.meta

DHS Country Metadata
DHS_api_est

DHS API Estimates
DHS.survey.meta

DHS Survey Metadata
adm2.link.all

WHO Administrative Level 2 Linkage
DHS_ind_dictionary

DHS Indicator Dictionary
run_app

Run the Shiny Application
ref_tab_22

Reference Table for Original 22 Indicators
admin_to_num

Convert Administrative Level String to Numeric Code