A colleague asked me how to present the results of a study in gastric emptying. As you have seen multiple time here, the emptying time t50 is the target variable. But read on even if you work with blood pressure (also often misused as example), rehabilitation, or pharmacology. The methods are the sa...

Using vectors for indexed access to ragged arrays in Stan

```
volume ~ normal(
v0[record] .* (1+ kappa[record] .* (minute ./ tempt[record])) .*
exp(-minute ./ tempt[record]), sigma);
```

Gastric volume times serie measured by MRI techniques can have an initial volume overshoot due to secretion. To estimate half-times and the degree of overshoot, the author of this blog has introduced the *linexp* function [@Fruehauf2011] with three parameters to complement the power exponential function used in earlier research [@Elashoff1982, @Elashoff1983b] with scintigraphic data.

*linexp*:

`v = v0* (1+t*kappa/tempt)*exp(-t/t_{empt})`

Time series from ^{13}C breath test recordings are used as a surrogate indicator for gastric emptying. Gastric emptying half time t50 is computed by fitting the series with an exponential beta or a Gamma function. Often, records are too short to obtain stable estimates of the trailing part. One can easily get unrealistic emptying times when single curves are fitted (Ghoos et al. (1993), Maes et al. (1998)).

Population methods can come to the rescue. When these fail, Bayesian methods provide a robust approach to non-linear curve fitting.

The coefficients of *linexp* fits to gastric emptying curves are generally used in mixed-models to analyze group and meal difference. The distribution of the extracted parameters is often highly skewed, so before using linear models or estimates of reference ranges with functions in package `referenceInterval`

or `Hmisc`

, a transformation might be required.

From a large corpus of gastric emptying curves analyzed with nonlinear fits of the *linexp* function, the following recommendations for transformation were obtained using the `boxcox`

and the `logtrans`

function in package `MASS`

:

Gastric emptying can be recorded by scintigraphy or by MRI techniques. Scintigraphy returns times series data of the meal volume, MRI gives the total content of the stomach, which includes meal and secretion. To quantify secretion and emptying in clinical studies, non-linear curves are fitted to the time series, which can give strange results. When the ballot fails, the bazaar comes to the rescue.