plot_delta_comp: Get predictions from compositional ilr multiple linear...

View source: R/plot_delta_comp.R

plot_delta_compR Documentation

Get predictions from compositional ilr multiple linear regression model

Description

Provided the data (containing outcome, composiitional compoents and covariates), fit a ilr multiple linear regression model and provide predictions from reallocating compositional values pairwise amunsnst the components model.

Usage

plot_delta_comp(dc_obj, comp_total = NULL, units_lab = NULL)

Arguments

dc_obj

A deltacomp_obj object returned from the function predict_delta_comps

comp_total

A numeric scalar that is the original units of the composition to make the x-axis the original scale instead of in the range [min(delta), max(delta)] in (-1, 1).

units_lab

Character string of the units of the compositions relating to comp_total to add to the x-axis label

Author(s)

Ty Stanford <tystan@gmail.com>

Examples

data(fairclough)

deltacomp_df <-
  predict_delta_comps(
    dataf = fairclough,
    y = "z_bmi",
    comps = c("sleep","sed","lpa","mvpa"),
    covars = c("decimal_age","sex"),
    deltas =  seq(-20, 20, by = 5) / (24 * 60), 
    comparisons = "prop-realloc",
    alpha = 0.05
  )
class(deltacomp_df)

plot_delta_comp(
  dc_obj = deltacomp_df,
  comp_total = 24 * 60,
  units_lab = "min"
)

deltacomp_df <-
  predict_delta_comps(
    dataf = fairclough,
    y = "z_bmi",
    comps = c("sleep","sed","lpa","mvpa"),
    covars = c("decimal_age","sex"),
    deltas =  seq(-20, 20, by = 5) / (24 * 60), 
    comparisons = "one-v-one",
    alpha = 0.05
  )

plot_delta_comp(
  dc_obj = deltacomp_df,
  comp_total = 24 * 60,
  units_lab = "min"
)

tystan/deltacomp documentation built on Oct. 26, 2022, 7:24 a.m.