Hi, sorry the question slipped through the cracks. I recently fixed a bug in plot_lm but I think it was a different one, and the notebook no longer uses it. Do you have a minimal example that shows the issue? data organization and facetting in plot_lm is quite convoluted but it might be fixable, I can take a look given the example to quickly play around and test it
Hi, I’ve experienced the same issue and what solved it for me was to drop unwanted dimensions. It seems that
idata.posterior["y_model"]
is, e.g. of shape (1, 1000, 1, 393, 1), containing (‘chain’, ‘draw’, ‘predictors’, ‘dim_0’, ‘dim_1’). az.plot_lm says that y_model needs to be of the same shape as y, plus added chains and draws. So, we want to drop some dimensions, namely ‘predictors’ and ‘dim_1’.
That is very useful, thanks! It would probably be better to modify the code within plot_lm and add an squeeze for dimensions (other than chain and draw) that are in y_model or y_hat but not in observed data, or at least check and raise a more informative warning/error.