How to pass a coordinate to inference data

Got it!

If you have a look at idata.posterior you will see something like the following

Notice the coordinates for p(y, n)_mean is p(y, n)_obs, which is just the row number. This is because Bambi doesn’t know each row is paired with one x_dim (A, B, and C). You can modify the plot after creation though. ArviZ functions usually return an array of matplotlib Axes.

axes = az.plot_forest(idata, var_names='p(y, n)_mean', combined=True)
axes[0].set(yticklabels=["C", "B", "A"], ylabel="Parameter name", xlabel="Posterior distribution");

image

EDIT Another option is to modify the coords in the xarray.Dataset

idata.posterior = idata.posterior.assign_coords({"p(y, n)_obs": ["A", "B", "C"]})
az.plot_forest(idata, var_names='p(y, n)_mean', combined=True);

image