baker: Bayesian Analysis Kit for Etiology Research

An R Package for Fitting Bayesian Nested Partially Latent Class Models

R build status

Maintainer: Zhenke Wu, zhenkewu@umich.edu

Source Code: Please click here for source code on GitHub.

Issues: Please click here to report reproducible issues.

Vignette: Please click here to read the latest long-version vignette; a short version can be found here.

Package website: Please click here for a website generated by pkgdown, which contains html format of the package manual (“Refence”).

References: If you are using baker for population and individual estimation from case-control data, please cite the following papers:

Citation
partially Latent Class Models (pLCM) Wu, Z., Deloria-Knoll, M., Hammitt, L. L., Zeger, S. L. and the Pneumonia Etiology Research for Child Health Core Team (2016), Partially latent class models for case–control studies of childhood pneumonia aetiology. J. R. Stat. Soc. C, 65: 97–114.
nested pLCM Wu, Z., Deloria-Knoll, M., Zeger, S.L.; Nested partially latent class models for dependent binary data; estimating disease etiology. Biostatistics 2017; 18 (2): 200-213.
nested pLCM regression Wu, Z., Chen, I (2021). Probabilistic Cause-of-disease Assignment using Case-control Diagnostic Tests: A Hierarchical Bayesian Approach. Statistics in Medicine 40(4):823-841.
Application Maria Deloria Knoll, Wei Fu, Qiyuan Shi, Christine Prosperi, Zhenke Wu, Laura L. Hammitt, Daniel R. Feikin, Henry C. Baggett, Stephen R.C. Howie, J. Anthony G. Scott, David R. Murdoch, Shabir A. Madhi, Donald M. Thea, W. Abdullah Brooks, Karen L. Kotloff, Mengying Li, Daniel E. Park, Wenyi Lin, Orin S. Levine, Katherine L. O’Brien, Scott L. Zeger; Bayesian Estimation of Pneumonia Etiology: Epidemiologic Considerations and Applications to the Pneumonia Etiology Research for Child Health Study, Clinical Infectious Diseases, Volume 64, Issue suppl_3, 15 June 2017, Pages S213–S227
Primary PERCH Analysis The PERCH Study Group (2019). Aetiology of severe hospitalized pneumonia in HIV-uninfected children from Africa and Asia: the Pneumonia Aetiology Research for Child Health (PERCH) Case-Control Study. The Lancet 394(10200): 757-779.
Software paper Chen I, Shi Q, Zeger SL, Wu Z (2022+) baker: An R package for Nested Partially-Latent Class Models.

There are a number of scientific papers on global health and infectious diseases that have used the model and some the software (in its earlier versions). Some notable examples are listed below:

Notable References using baker (model and/or software)
1 Kubale et al. (2023). Etiology of acute lower respiratory illness hospitalizations among infants in four countries. Open Forum Infectious Diseases, ofad580.
2 Saha SK et al. (2018). Causes and incidence of community-acquired serious infections among young children in south Asia (ANISA): an observational cohort study. The Lancet 392(10142):145-159.

Table of content

Installation

Note:

Vignettes

Graphical User Interface (GUI)

For developers interested in low-level details, here is a pretty awesome visualization of the function dependencies within the package:

You will get a dynamic figure. A snapshot is below:

Analytic Goal

  • To study disease etiology from case-control data from multiple sources that have measurement errors. If you are interested in estimating the population etiology pie (fraction), and the probability of each cause for individual case, try baker.

Comparison to Other Existing Solutions

  • Acknowledges various levels of measurement errors and combines multiple sources of data for optimal disease diagnosis.
  • Main function: nplcm() that fits the model with or without covariates.

Details

  1. Implements hierarchical Bayesian models to infer disease etiology for multivariate binary data. The package builds in functionalities for data cleaning, exploratory data analyses, model specification, model estimation, visualization and model diagnostics and comparisons, catalyzing vital effective communications between analysts and practicing clinicians.
  2. baker has implemented models for dependent measurements given disease status, regression analyses of etiology, multiple imperfect measurements, different priors for true positive rates among cases with differential measurement characteristics, and multiple-pathogen etiology.
  3. Scientists in Pneumonia Etiology Research for Child Health (PERCH) study usually refer to the etiology distribution as “population etiology pie” and “individual etiology pie” for their compositional nature, hence the name of the package.

Platform

  • The baker package is compatible with OSX, Linux and Windows systems, each requiring a slightly different setup as described below. If you need to speed up the installation and analysis, please contact the maintainer or chat by clicking the gitter button at the top of this README file.

Connect R to JAGS

Mac OSX (10.11+)

  1. Use Just Another Gibbs Sampler (JAGS)
  2. Install JAGS 4.3.2 (or 4.2.0 - currently it is slightly slower for 4.3.2, which was updated to be compatible with R 4.3.x); Download here
  3. Install R; Download from here
  4. Fire up R, run R command install.packages("rjags")
  5. Run R command library(rjags) in R console; If the installations are successful, you’ll see some notes like this:
  • Run R command library(baker). If the package ks cannot be loaded due to failure of loading package rgl, first install X11 by going here, followed by

Unix (Build from source without administrative privilege)

Here we use JHPCE as an example. The complete installation guide offers extra information.

  1. Download source code for JAGS 4.2.0; The workflow would be similar for later versions of JAGS.

  2. Suppose you’ve downloaded it in ~/local/jags/4.2.0. Follow the bash commands below:

  3. Also check out the INSTALLATION file for rjags package.

Submitting Jobs to Computing Cluster via a shell script

Again, I use JHPCE as an example.

Windows

  • JAGS 4.2.0 (also applicable to later versions)
  1. Install R; Download from here
  2. Install JAGS 4.2.0; Add the path to JAGS 4.2.0 into the environmental variable (essential for R to find the jags program). See this for setting environmental variables;
  • alternatives are brew install -v jags for OSX, sudo apt-get install jags for Ubuntu/Debian
  1. Fire up R, run R command install.packages("rjags")
  2. Install Rtools (for building and installing R packages from source); Add the path to Rtools (e.g., C:\Rtools\) into your environmental variables so that R knows where to find it.

Example data sets

We provide two simulated data sets in the package:

data(data_nplcm_noreg)

data(data_nplcm_reg_nest)