Hi all,
I think this a bit of a basic question regarding working with InferenceData returned from pm.sample(), but here goes:
I’m combining chains and draws using the “extract” function in ArviZ (as described here) in order to simplify some manipulations I want to perform on the posterior variables.
For example, let’s say the variables in my posterior originally have dimensionality (4, 1000). Using “extract”, the dimensionality (in the normal Numpy sense, not xarray sense) of the returned variables is what I expect (i.e., (4000,). I perform some computations with the lower dimensional data and everything is good so far. However, rather than being treated as 4000 “draws” from a single chain, which would work nicely with ArviZ plotting functions like “plot_posterior”, they are now 4000 “samples”, which plot_posterior doesn’t like (it tries to create a figure panel for each sample). The simplest workaround I’ve found is to use the “unstack” function to return the manipulated variables to their original dimensionality (4, 1000) and then input them into plot_posterior. While this works fine, it seems pretty clumsy and like there must be a simpler way to plot the combined (stacked) version of the posterior variables.
Appreciate any advice you may have.