Intercept in model summary different to geom_line from posterior draws

I’ve fit the model and played with it a bit, and I believe the issue is that you fit the model and created the predictions based on the centered variable version weight_mc while in your plot you are sometimes calling for it to plot the original variable weight.

I’ve modified your plotting code to this:

ggplot() +
  geom_abline(intercept=154.61, slope=0.9, color="red")+
  geom_ribbon(
    aes(ymin = .lower, ymax = .upper, x = weight_mc),
    data = predicted_slopes_qi,
    alpha = .25
  ) +
  geom_line(
    aes(x = weight_mc, y = .prediction),
    data = predicted_slopes_qi
  ) +
  geom_point(
    aes(x = weight_mc, y = .prediction),color="skyblue2",pch="*", size=3,
    data = pdraw%>%sample_n(100)
  ) +
  
  geom_point(
    aes(x = weight_mc, y = height),
    data = data,
    alpha = .25
  ) +
  geom_ribbon(
    aes(ymin = .lower, ymax = .upper, x = weight_mc),color="salmon",
    data = linpred,
    alpha = .5
  )+ 
  labs(x = "Weight (centered)", y = "Height")

Which outputs the following plot where the oringal geom_abline() matches up with the model predictions.

2 Likes