coef_diff_by_group: Tabulates breath test parameter differences of groups from...

Description Usage Arguments Value Examples

Description

Given a Stan fit with grouping to 13C breath test curves, computes point estimated and Bayesian credible intervals for all group pair differences, for examples of the half emptying time t50.

Usage

1
2
coef_diff_by_group.breathteststangroupfit(fit, mcp_group = NULL,
  reference_group = NULL, ...)

Arguments

fit

Object of class breathteststangroupfit from stan_fit

mcp_group

Not used, always all pairs are compared

reference_group

Not used

...

Not used

Value

A tibble of class coef_diff_by_group_stan with columns

parameter

Parameter of fit, e.g. beta, k, m, t50

method

Method used to compute parameter. exp_beta refers to primary fit parameters beta, k, m.

groups

Which pairwise difference, e.g solid - liquid

estimate

Point estimate (chain mean) of the difference

cred.low, cred.high

Lower and upper 95 percent credible interval of difference.

The chains of pairwise differences are returned as a attribute chain for use in plotting. See example below how to use these to display difference histograms.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
library(dplyr)
library(breathtestcore)
data("usz_13c", package = "breathtestcore")
data = usz_13c %>%
  dplyr::filter( patient_id %in%
    c("norm_001", "norm_002", "norm_003", "norm_004", "pat_001", "pat_002","pat_003")) %>%
  cleanup_data()
fit = stan_group_fit(data, iter = 300, chains = 1) # Use more iterations!
cf = coef_diff_by_group(fit)
cc = attr(cf, "chain") %>%
   filter(key == "t50_maes_ghoos", abs(diff) < 200) %>%
   mutate(
     groups = paste(group2, group1, sep = " - ")
   )
str(cc)
if (require(ggplot2)) {
  ggplot(cc, aes(x = diff)) + geom_histogram() + facet_wrap(~groups)
}
# For comparison
fit = nlme_fit(data)
coef_diff_by_group(fit)

breathteststan documentation built on April 26, 2018, 5:04 p.m.