Compare slope values of different brms models
compare_slopes(..., Slope)
Returns a table of values with the log(slope model 1/slope model 2)
if (FALSE) { # \dontrun{
md = dplyr::starwars
# Centering variables
md = md %>%
dplyr::select(mass, sex, height, species) %>%
dplyr::mutate(mass = log(mass),
sex = dplyr::recode(sex, "male" = 1,
"female" = -1,
"hermaphroditic" = 0,
"none" = as.numeric(NA)))
mod1 = brms_model(Chainset = 2,
Response = "mass",
FixedEffect = "sex",
Family = "gaussian",
Data = md)
mod2 = brms_model(Chainset = 2,
Response = "mass",
FixedEffect = "sex",
RandomSlope = c("sex","species"),
Family = "gaussian",
Data = md)
compare_slopes(mod1, mod2, Slope = "sex")
} # }