Core Functions to Read and Fit 13c Time Series from Breath Tests

Reads several formats of 13C data (IRIS/Wagner, BreathID) and CSV. Creates artificial sample data for testing. Fits Maes/Ghoos, Bluck-Coward self-correcting formula using 'nls', 'nlme'. Methods to fit breath test curves with Bayesian Stan methods are refactored to package 'breathteststan'. For a Shiny GUI, see package 'dmenne/breathtestshiny' on github.

Travis-CI Build Status Coverage Status CRAN

breathtestcore: 13C breath test to analyze gastric emptying

Dieter Menne
Menne Biomed Consulting Tübingen, Germany

[email protected]

This is a reboot of R package dmenne/d13cbreath which is partially obsolete.

  • Reads several file formats of 13C data: IRIS/Wagner (composite and CSV), BreathID and Excel.
  • Fits Beta-Exponential nonlinear curve fits using nls, which gives successful estimates for 90% of PDR curves.
  • Computes population fits with nlme when data from multiple recordings are available, resulting in much more reliable estimates for studies.
  • Computes prior-constrained Bayesian non-linear fit for single records (refactored to package dmenne/breathteststan)
  • Computes Bayesian non-linear population fit with Stan for multiple records (refactored to package dmenne/breathteststan)
  • Includes three data sets of 13C records from the University Hospital of Zürich
  • A comparison of results with nls, nlme and Bayesian Stan.
  • See the example in the documentation of t50BluckCoward for a comparison with published data.

Sponsors and supporters

The software is being developed in cooperation with the Department of Gastroenterology of the University Hospital of Zürich and Claraspital Basel. Thanks to Benjamin Misselwitz, Mark Fox and Werner Schwizer. Special thanks to Andreas Steingötter for constantly reminding me that better statistics does necessarily make a method physiologically relevant.

How to install

To install the most recent versions of the package, use

devtools::install_github("dmenne/breathtestcore", build_vignettes = TRUE)
# In case you want to use the fancy Stan-based methodes
# And here the web app; this is not yet on CRAN and must be installed from github
devtools::install_github("dmenne/breathtestshiny", build_vignettes = TRUE)

Do not forget to use build_vignettes = TRUE.

Stable version of the packages breathtestcore and breathteststan can also be installed from CRAN. Since packages are under strong development, we recommend to use the github versions.

The Docker image contains RStudio, package gastempt to analyze MRI/scintigraphic gastric emptying data, and the breathtestshiny app.

You can run the [web app online]{}. No data are stored, but you can download all results and a series of tests for studies.

Usage example

This example is from the documentation of function nlme_fit.

d = simulate_breathtest_data(n_records = 3, noise = 0.2, seed = 4711)
data = cleanup_data(d$data)
fit = nlme_fit(data)
plot(fit) # calls plot.breathtestfit

For additional examples, see the documentation and the tests in folder tests/testthat of the source package.


The core fitting functions and the Stan variants are reasonably stable and can be used to analyze your breath test data with R. The Shiny web app with reporting is work in progress; online demo, source code.


  • Ghoos, Y. F., B. D. Maes, B. J. Geypens, G. Mys, M. I. Hiele, P. J. Rutgeerts, and G. Vantrappen. 1993. “Measurement of Gastric Emptying Rate of Solids by Means of a Carbon-Labeled Octanoic Acid Breath Test.” Gastroenterology 104 (6). Department of Medicine, University Hospital Gasthuisberg, Belgium.: 1640–7.

  • Maes, B. D., B. J. Geypens, Y. F. Ghoos, M. I. Hiele, and P. J. Rutgeerts. 1998. “13C-Octanoic Acid Breath Test for Gastric Emptying Rate of Solids.” Gastroenterology 114 (4): 856–59.

  • Bluck LJC (2009) Recent advances in the interpretation of the 13C octanoate breath test for gastric emptying. J. Breath Res. 3,

  • Bluck, LJC, Jackson S, Vlasakakis G, Mander A (2011) Bayesian hierarchical methods to interpret the 13C-octanoic acid breath test for gastric emptying. Digestion 83_96-107.


Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


0.8.1 by Dieter Menne, 8 months ago

Report a bug at

Browse source code at

Authors: Dieter Menne [aut, cre] , Menne Biomed Consulting Tuebingen [cph] , Benjamin Misselwitz [fnd] , Mark Fox [fnd] , Andreas Steingoetter [dtc] , University Hospital of Zurich , Dep. Gastroenterology [fnd, dtc]

Documentation:   PDF Manual  

GPL-3 license

Imports assertthat, dplyr, ggfittext, ggplot2, broom, graphics, grid, MASS, methods, multcomp, nlme, purrr, readr, readxl, signal, stats, stringr, tibble, tidyr, tools, utils, xml2

Suggests base, gridExtra, knitr, rmarkdown, testthat, breathteststan, covr

System requirements: pandoc

Suggested by breathteststan.

See at CRAN