What is the difference between Intercept and b_Intercept?

I noticed that when I set

save_pars = save_pars(all=TRUE)

there is a parameter called b_Intercept and one called Intercept in my model. Intercept does not show up in the summary, but in the $fit. When not all parameters are saved, there is only b_Intercept.
What does Intercept mean? It has a different value than b_Intercept.
Should I set a prior for this? I am working with a custom family where the default priors usually don’t make much sense.
A minimal example on what the Intercept and b_Intercept can look like in a very simple model:

data = data.frame(x = c(1,2,2,1,4,5,6,5), y = c(1,1,1,1,2,2,2,2))


test_fit1 = brm(data = data,
                formula = x ~ y,
                seed = 1,
                save_pars = save_pars(all=TRUE))

summary(test_fit1)

test_fit1$fit

mcmc_plot(test_fit1, pars = c('Intercept', 'y', 'sigma'))

the output of test_fit1$fit

              mean se_mean   sd   2.5%    25%    50%    75%  97.5% n_eff Rhat
b_Intercept  -2.00    0.02 1.03  -4.16  -2.59  -2.00  -1.41   0.08  2536    1
b_y           3.50    0.01 0.66   2.16   3.12   3.49   3.86   4.84  2574    1
sigma         0.90    0.01 0.35   0.48   0.66   0.81   1.04   1.79  1406    1
Intercept     3.24    0.01 0.34   2.53   3.05   3.25   3.44   3.88  2154    1
lp__        -13.30    0.05 1.52 -17.26 -14.02 -12.90 -12.16 -11.56  1083    1

P.S. I am pretty new to this so I apologize if this should be obvious. Any hints are appreciated

1 Like

Is this what you are looking for Difference between b & Intercept classes in brms ?

Thank you for the suggestion, unfortunately reading it did not help me.

If I am not mistaken, the model I specify above is

x ~ N(b_Intercept + b_y * y, sigma)

So what do I need the additional parameter ‘Intercept’ for?

To start with data should be
data = data.frame(x = c(1,2,2,1,4,5,6,5), y = c(1,1,1,1,2,2,2,2))

1 Like

Your are right, of course. I edited my original post.

Thanks for cleaning up the code. That will help other folks who have the same question.

Let me tag in some brms folks. I looked this up once but have since forgotten. @paul.buerkner

Hi Britta,

If you look at the underlying Stan code for the model using:

make_stancode(data = data,
    formula = x ~ y,
    seed = 1,
    save_pars = save_pars(all=TRUE))

You’ll see the respective definitions:

parameters {
  vector[Kc] b;  // population-level effects
  real Intercept;  // temporary intercept for centered predictors
  real<lower=0> sigma;  // residual SD
}
...
generated quantities {
  // actual population-level intercept
  real b_Intercept = Intercept - dot_product(means_X, b);
}

This is referring to the fact that brms mean-centers the predictors prior to analysis, so the Intercept parameter is on the mean-centered scale. The b_Intercept parameter is this mean-centered intercept back-transformed to the original scale of the predictors

4 Likes