Closed asong-code closed 1 year ago
We should probably add a note on this. The model uses bambi to take advantage of the formula defined model. In such cases, as there can be multiple slopes, bambi names each slope with the name of the variable in the formula it multiplies, here x
. Thus idata.posterior["x"]
contains the posterior samples for the slope that multiplies x
.
ok. I first thought that the bambi part was optional so I just skipped that.
Notebook title: GLM: Linear regression Notebook url: https://www.pymc.io/projects/docs/en/stable/learn/core_notebooks/GLM_linear.html
Issue description
The formula here seems to be wrong.![image](https://user-images.githubusercontent.com/26295681/193202673-16402e9d-b1a2-42ce-a051-1a9bf5efdbb5.png)
Proposed solution
I think the correct formula should be:
idata.posterior["y_model"] = idata.posterior["Intercept"] + idata.posterior["slope"] * xr.DataArray(x)