I have some doubts about the example “Bayesian Regression Using NumPyro” using the dataset of the divorce rates in the USA (from the book “Statistical Rethinking” ), shown in the NumPyro Tutorials page https://pyro.ai/numpyro/bayesian_regression.html#Regression-Model-with-Measurement-Error.
Specifically in the section “Regression Model with Measurement Error”, where the measurement error is introduced to the model.
If we observe the figure of the residuals when the errors are introduced, there is a clear decrease in the difference between the predicted and the experimental value. However if we plot “Divorce rate” vs “Median Age” (see figure below), or vs “Marriage Rate” we see a somewhat strange behavior, there is really no linear regression. Is this expected behavior? or am I missing something, if possible I would like to be clarified.
The second question is, when you make the prediction using the “Predictive” function with the “model_se” model, the argument “divorce_sd=dset.DivorceScaledSD.values” is used, which is one of the results to be estimated together with “divorce”, and therefore cannot be used to predict. Is this OK?
rng_key, rng_key_ = random.split(rng_key) predictions_4 = Predictive(model_se, samples_4)(rng_key_, marriage=dset.MarriageScaled.values, age=dset.AgeScaled.values, divorce_sd=dset.DivorceScaledSD.values)['obs']