substition_coef: Calculate "coefficients" based on substitutions for each...

View source: R/coef.R

substition_coefR Documentation

Calculate "coefficients" based on substitutions for each compositional part

Description

Calculate "coefficients" based on substitutions for each compositional part

Usage

substition_coef(object, level = c("between", "within"), h = 10)

Arguments

object

An object of class brmcoda.

level

A character string specifying the level of the coefficients to be calculated. Either “between” or “within”.

h

A numeric value specifying the step size for the substitution.

Value

A data table of results.

Examples


if(requireNamespace("cmdstanr")){
sbp2 <- copy(sbp)
sbp2[1, ] <- c(-1, 1, -1, -1, -1)
sbp2[2, ] <- c( 1, 0, -1, -1, -1)
sbp2[3, ] <- c( 0, 0,  1, -1, -1)
sbp2[4, ] <- c( 0, 0,  0,  1, -1)

cilr <- complr(data = mcompd, sbp = sbp2, 
  parts = c("TST", "WAKE", "MVPA", "LPA", "SB"),
  idvar = "ID")

m1 <- brmcoda(complr = cilr,
              formula = Stress ~ bilr1 + bilr2 + bilr3 + bilr4 +
                                 wilr1 + wilr2 + wilr3 + wilr4 + (1 | ID),
              chain = 4, iter = 1000, cores = 4L,
              backend = "cmdstanr")
substition_coef(m1, level = "between", h = 10)
substition_coef(m1, level = "within", h = 10)
rm(sbp2, cilr, m1) ## cleanup
}


florale/multilevelcoda documentation built on Sept. 26, 2024, 11:35 p.m.