Functions to analyse compositional data and produce confidence intervals for relative increases and decreases in the compositional components
Please see Dumuid et al. (2017) for details.
library(devtools) # see http://cran.r-project.org/web/packages/devtools/README.html
devtools::install_github('tystan/deltacomp')
library(deltacomp)
### see help file to run example
?get_plus_minus_changes
get_plus_minus_changes(
dataf = fat_data,
y = "fat",
comps = c("sl", "sb", "lpa", "mvpa"),
covars = c("sibs", "parents", "ed"),
deltas = seq(-60, 60, by = 5) / (24 * 60),
comparisons = "one-v-one",
alpha = 0.05,
verbose = FALSE
)
# OR
get_plus_minus_changes(
dataf = fat_data,
y = "fat",
comps = c("sl", "sb", "lpa", "mvpa"),
covars = c("sibs", "parents", "ed"),
deltas = seq(-60, 60, by = 5) / (24 * 60),
comparisons = "one-v-all",
alpha = 0.05,
verbose = FALSE
)
Output is a data.frame
that can be turned into the plot below: