Error in GLM: Linear Regression Example

Error in the code:
idata.posterior[“y_model”] = idata.posterior[“Intercept”] + idata.posterior[“x”] * xr.DataArray(x)

the correct should be: “idata.posterior[“y_model”] = idata.posterior[“Intercept”] + idata.posterior[“slope”] * xr.DataArray(x)”

Are you running the bambi cell? That one seems to be sampling x from the cell output, so it’s correct to select it. If you skip that cell the idata from the previous model has a variable called slope instead.

No, I have skipped the Bambi Cell to do the analysis in more conventional manner .
Even if bambi Cell is running, it should distinguish between variable x and Slope parameter ‘x’ as in “each regressor (Intercept and slope x in this case)”.

Also how is sigma and y_Sigma are different?

Bambi samples variables with the names showed in the cell output: NUTS: [y_sigma, Intercept, x]

If you skip that cell the idata you get is from the pymc model before which has different names: NUTS: [sigma, Intercept, slope], so you need to change the idata calculations.

I suppose the variables are equivalent but have slightly different names. However bambi tends to do data-informed priors and automatic standardizations that may yield different posteriors.

Just to say I don’t think there’s an error in the notebook (we run them in the testing suite), but you’re not supposed to skip the bambi cell. Anyway that notebook is just a very light example, did you need something out of it?

Thanks for information.. I have just started learning Bayesian Inference.. Now it is clear..