Centered and non-centered predictor give non-consistent hierarchical-level findings

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)

1 Like

@mike-lawrence

I suspect this is related to the seeming use of brms’ default priors. If I recall correctly the prior for the intercept is either student_t(3,0,1) or student_t(3,Z,1), where Z is the empirical mean of the data. When you center the predictor, the intercept is placed in the middle of the data, which is somewhat consistent with the prior, but if you leave the predictor uncentered, the intercept is far to the left of the data, and by eyeball would be quite negative, so very much conflicting with the prior. I might be wrong though, so best to check what the priors actually are.

2 Likes