Open jmcurran opened 6 years ago
Okay - I know why this happens now. bayes.lin.reg
calls bayes.lm
after trying to work out what the values for the prior mean and prior variance/covariance matrix should be. It should, at the very least, turn off the centering of the explanatory variables (and will do this shortly). It should also just set prior = NULL
when both the slope and the intercept have a flat prior. The issue how should we sensibly deal with mixed priors, e.g. flat for intercept, normal for slope, or vice versa?
I'm obviously doing something wrong in using the R function bayes.lin.reg, using question 2 from the assignment.
My data frame (q2) is simple:
When I do an ordinary regression, I get a reasonable result:
But I'm getting a strange intercept when I use
bayes.lin.reg
, no matter what I try. Here's a very simple call, assuming flat priors:Actually, that slope isn't right, either. I get similar results for the intercept if I use the parameters specified in question 2, but I wanted to show here the simplest call I could (which, or course, lead to poor predictions for x=3). Here, with more complicated priors, I get a good slope but still a poor intercept and predictions: