# Composite priors in bayesian linear regression?

I'm not certain that "composite" is the right word for this; I've seen blogs tutorials and books that seem to link prior beliefs together. Consider MTCARS data, where miles per gallon (mpg) has a linear relationship with engine displacement, depicted by the equation m = B*x +a where m represents mpg, B the slope, x the input variable displacement, and a (or B0) the y-intercept.

I'm following this blog by Jesse Fagan, Suppose that:

mpg ~Normal(mu=m,sigma=s)
B ~Normal(mu=0,sigma=2)
a ~Normal(mu=18,sigma=3)
s ~Unif(start=0,stop=20)


I'm not an R programmer, however, I'm quite familiar with python. Due to the R code, I'm not certain what's happening in each step. Big picture, I understand that this code accomplishes a grid search. However, I'd like to know explicitly which PDFs are priors and which are likelihoods.

It's my understanding that mpg is the likelihood whereas B, a, and s are the priors. Likewise, I understand the "composite prior" to use my vocabulary, to be the product of B,s, and a. Again, due to the R code, I'm not 100% confident in this belief and would like affirmation or correction.

Thank you!

$$y_i \sim Normal(\mu_i, \sigma) \tag{1}$$ $$\mu_i = \alpha + \beta x_i \tag{2}$$ $$\alpha \sim Normal(10,10) \tag{3}$$ $$\beta \sim Normal(0,10) \tag{4}$$ $$\sigma \sim Uniform(0,50) \tag{5}$$
Equation (1) corresponds to the first line in your code (mpg ~Normal(mu=m,sigma=s)) and called likelihood (as you said). Equation (2) is the linear model (i.e., m = B*x +a in your question). And finally, equations (3), (4), and (5) are priors of the parameter values to be estimated. Note that $$\mu_i$$ is not a parameter to be estimated, but rather constructed from other parameters. I guess this is the part that causes confusion regarding "composite priors" which, as far as I understand, have a different, technical use (e.g., see this dissertation).
• I see, thanks! One last question, how should the likelihood be evaluated? My understanding is that I would take the product of each likelihood, where x=u(i) and mu=y(i). As opposed to all u(i) observations being compared to the average of y. (In practice, I'd probably sum the log likelihoods.) – jbuddy_13 Sep 14 '20 at 14:09
• @jbuddy_13 If I get the first part of the question right, yes. The likelihood of $y_1, \ldots, y_n$ is the product of each likelihood, because we assume each outcome is independent from each other. But I am not clear about the second part of the question. – T.E.G. Sep 14 '20 at 15:33