Fit gastric emptying curves with Stan
stan_gastempt(d, model_name = "linexp_gastro_2b", lkj = 2, student_df = 5L, init_r = 0.2, chains = 4, ...)
| d | A data frame with columns
|
|---|---|
| model_name | Name of predefined model in
|
| lkj | LKJ prior for kappa/tempt correlation, only required for model linexp_gastro_2b. Values from 1.5 (strong correlation) to 50 (almost independent) are useful. See http://www.psychstatistics.com/2014/12/27/d-lkj-priors/ for examples. |
| student_df | Student-t degrees of freedom for residual error; default 5. Use 3 for strong outliers; values above 10 are close to gaussian residual distribution. |
| init_r | for stan, default = 0.2; Stan's own default is 2, which often results in stuck chains. |
| chains | for stan; default = 4. For debugging, use 1. |
| ... | Additional parameter passed to |
A list of class stan_gastempt with elements coef, fit, plot
coef is a data frame with columns:
rec Record descriptor, e.g. patient ID
v0 Initial volume at t=0
tempt Emptying time constant
kappa Parameter kappa for
model = linexp
beta Parameter beta for model = powexp
t50 Half-time of emptying
slope_t50 Slope in t50; typically in units of ml/minute
On error, coef is NULL
fit Result of class `stanfit`
plot A ggplot graph of data and prediction. Plot of raw data is
returned even when convergence was not achieved.
# NOT RUN { dd = simulate_gastempt(n_records = 6, seed = 471) d = dd$data ret = stan_gastempt(d) print(ret$coef) # }