I found an interesting anomaly. Raw data and exploratory data analysis show that hierarchical levels, ‘groups’ in my case, have varying temporal trends. However, a model confirm’s it only when ‘year’ is used as a centered predictor. Basically all hierarchical level slopes seem to be the same when ‘year’ is non-centered. Why is this happening?
Using ‘year’ as a centered predictor
library(tidyverse)
data = read.csv("https://www.dropbox.com/s/522vhw9c8vrco3c/data.csv?dl=1")
library(brms)
centered_m = brm(y ~ year_centered + (year_centered | group),
family = lognormal(),
data = data)
conditions = data %>% make_conditions(vars = c("group"))
centered_m %>% conditional_effects(effects = "year_centered",
conditions = conditions,
re_formula = NULL)
Using ‘year’ as a non-centered predictor
noncentered_m = brm(y ~ year + (year | group),
family = lognormal(),
data = data)
noncentered_m %>% conditional_effects(effects = "year",
conditions = conditions,
re_formula = NULL)