It is hard to tell whether your prior prediction matches the model exactly when I don’t have a fully working code however what you are doing is in the right direction, you extract the samples for your prior and then recombine them exactly as you did in the model. I won’t be able to tell exactly though, I don’t have the running code and variable names are different between the model and the prior prediction. On the other hand I noticed one thing in the prior prediction:
prior_b[0, :, location, :][k]
prior_b has shape 1,49,150,4 as per your comment where second dimension is normally indexed by ‘LocationDesc_encoded’ in your model. However in the prediction you are indexing location into the third dimension which is the samples dimension (unless you have transposed prior_b somewhere and have not shown the code). Moreover with your notation, you index k into the first dimension of the remaining 2D matrix where as you should really index it into the last (predictor variables dimension). You may want to recheck this. Because you are doing matrix multiplications via for loops, you are less likely to catch shape errors (you will basically catch them if you have index out of bounds but not for shape incompatibility) so you may want to vectorise your multiplications.
Also, if you don’t need to change cleaned_data, then you can do the prior_predictive_check in a more simpler manner. After doing sample_prior_predictive, you can check idata[“prior_predictive”][“Y_obs”] to get the sample counts (using prior distributions) and check if they make sense directly. This will prevent any errors and perhaps better for starters to get acquainted to the results you obtain.
As for what to make of the results you obtain, your case is a bit different than what is in the page because you are doing multivariate regression (or something similar to it, since I still don’t understand why you have a separate intercept for each predictor variable). I am not sure scatter plotting x values against y is the right thing to do. If it was two predictor variables for instance, what you would have done is plot hyperplanes using coordinates x1,x2. In this case you seem to have four predictor variables so I don’t even understand what a scatter of x vs y does but what I would only do in this case is either
1- fix some of the other three variables and plot some lines using the remaining predictor and do this multiple times
2- plot an histogram values of the predicted values to see if they are within reasonable range.
The most important task of prior prediction is to see if the predictions using the default priors are sensible and ultimately it is you who can only tell since you know what you want to model. Its’ requirements are not as strict as posterior predictive checks. One can even say, it is more a debugging tool if your model behaves unexpectedly (for instance if you have more complicated models, you may have chosen a prior that easily creates divergences in your observed values and prior predictive checks may reveal this).