Skip to contents

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

# \donttest{
if(requireNamespace("cmdstanr")){
sbp2 <- 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
}
#> Error: CmdStan path has not been set yet. See ?set_cmdstan_path.
# }