Skip to contents

This function estimates pivot balance coordinates for each compositional part by either "rotate" the sequential binary partition using the same brmcoda object or "refit" the brmcoda object.

Usage

pivot_coord(
  object,
  summary = TRUE,
  method = c("rotate", "refit"),
  parts = 1,
  ...
)

Arguments

object

An object of class brmcoda.

summary

Should summary statistics be returned instead of the raw values? Default is TRUE.

method

A character string. Should the pivot balance coordinates be estimated by "rotate" the sequential binary partition using the same brmcoda object or "refit" the brmcoda object? Default is "rotate".

parts

A optional character string specifying names of compositional parts that should be considered in the substitution analysis. This should correspond to a single set of names of compositional parts specified in the complr object. Default to the first composition in the complr object.

...

Further arguments passed to posterior_summary.

Value

Estimated pivot balance coordinates representing the effect of increasing one compositional part relative to the remaining compositional parts.

Examples

# \donttest{
if(requireNamespace("cmdstanr")){
  x <- complr(data = mcompd, sbp = sbp,
                 parts = c("TST", "WAKE", "MVPA", "LPA", "SB"), idvar = "ID",
                 total = 1440)
  
  # inspects ILRs before passing to brmcoda
  names(x$between_logratio)
  names(x$within_logratio)
  names(x$logratio)
  
  # model with compositional predictor at between and within-person levels
  m <- brmcoda(complr = x,
                formula = Stress ~ bz1_1 + bz2_1 + bz3_1 + bz4_1 +
                                   wz1_1 + wz2_1 + wz3_1 + wz4_1 + (1 | ID),
                chain = 1, iter = 500,
                backend = "cmdstanr")
  
  m_pivot_coord <- pivot_coord(m)
  summary(m_pivot_coord)
  }# }
#> Error: CmdStan path has not been set yet. See ?set_cmdstan_path.