Fits gastric emptying time series from MRI or scintigraphic measurements using nonlinear mixed-model population fits with 'nlme' and Bayesian methods with Stan; computes derived parameters such as t50 and AUC.
A package and a Shiny web application to create simulated gastric emptying data, and to analyze gastric emptying from clinical studies using a population fit with R and package
nlme. In addition,Bayesian fits with Stan to handle critical cases are implemented.
Part of the work has been supported by section GI MRT, Klinik für Gastroenterologie und Hepatologie, Universitätsspital Zürich; thanks to Werner Schwizer and Andreas Steingötter for their contributions. The package is available from CRAN and github (source, documentation). To install, use:
Compilation of the Stan models needs several minutes.
The web interface can be installed on your computer, or run as web app.
Two models are implemented in the web interface
linexp, vol = v0 * (1 + kappa * t / tempt) * exp(-t / tempt):Recommended for gastric emptying curves with an initial volume overshoot from secretion. With parameter kappa > 1, there is a maximum after t=0. When all emptying curves start with a steep drop, this model can be difficult to fit.
powexp, vol = v0 * exp(-(t / tempt) ^ beta):The power exponential function introduced by Elashof et. al. to fit scintigraphic emptying data; this type of data does not have an initial overshoot by design. Compared to the
powexpis more reliable and rarely fails to converge in the presence of noise and outliers. The power exponential can be useful with MRI data when there is an unusual late phase in emptying.
nlmein package R
Program with simulated data (needs about 40 seconds till plot shows):
library(gastempt) dd = simulate_gastempt(n_records = 6, seed = 471) d = dd$data ret = stan_gastempt(d) print(ret$coef) print(ret$plot)