posterior
posterior copied to clipboard
Applying a function to each chain
Are there simple ways (can be internal functions) to apply a function to each chain of a draws or rvar object?
For a draws object, I can do:
example_draws() |>
extract_variable_matrix("mu") |>
apply(MARGIN = 2, FUN = ess_bulk)
But the equivalent for an rvar is not immediately clear to me.
This is related to the automatic thinning via ess, which uses this method but if rvars become the default for summarise draws (#184 ), will need to be updated.
I would do draws_of(x, with_chains = TRUE) then use apply()
It's a good question if we should export something - my thinking so far has been to keep that stuff internal unless/until a good internal API for it solidifies from repeated experience, then think about exporting.