Model samples perfect correlation between intercept and slope

Hi Everyone,

I could really use your thought here. I have a within-subject design were participants made a choice, under two conditions (really - as simple as it gets). I’m using brms to model response but keep getting high r_hat, and corr of ~1 between slope and intercept…

We have ~140 participants, ~800 observation for each subject. The independent has two levels and is coded as a factor. The dep is 0/1.

This is the model we used:
image

and this is the bad output with the high slope-intercept corr:

This is the raw data (yellow are means calculated outside the model), and posterior_predict from the bad sampled model:
image

This is the corr in the raw data (with no model included) between level1 of the ind variable and the difference between level2 and level1 - which is as close as I could get to an “ïntercept-slope” corr inspection in the empirical data without using any modeling. If anything, this is actually negative:

image

I have tried to play with the priors, and ran prior pred checks - all seems to be fine.
Any clues?? What can I look into to try and figure out why this is happening?

BTW - taking out the corr estimate actually helps in terms of r_hat and ess (i.e., doing (reveal ||subject)), but this feel worng - I really want to understand why this is happening…

Thank you!
Nitzan

I know very little about brms, but from the little I have used packages with that kind of notation doesn’t something like y ~ 0 + x denote a model without an intercept parameter?
Is it possible you have no intercept and two slopes, which may be indistinguishable and therefore nearly completely correlated?

Sorry if I’m saying something outrageous, but if that’s the case at least maybe someone outraged will correct me and give you a proper explanation.

In brms, the 0 + Intercept +... notation simply allows one to place a prior on the real intercept. If you just use the usual 1 + ... notation, then from the brms manual: "By default, the population-level intercept (if incorporated) is estimated separately and not as part of population-level parameter vector b. As a result, priors on the intercept also have to be specified separately. Furthermore, to increase sampling efficiency, the population-level design matrix X is centered around its column means X_means if the intercept is incorporated.” Using the 0 + Intercept + ... avoids this behavior.

1 Like

Without seeing the data, I’m not sure what is going on here, but I notice that you have specified a very low number for iter given that your warmup is still 1,000. iter includes warmup, so you have only specified 500 post-warmup samples.