# A tibble: 10 × 4
variable mean sd rhat
<chr> <dbl> <dbl> <dbl>
1 mu 4.18 3.40 1.02
2 tau 4.16 3.58 1.01
3 theta[1] 6.75 6.30 1.01
4 theta[2] 5.25 4.63 1.02
5 theta[3] 3.04 6.80 1.01
6 theta[4] 4.86 4.92 1.02
7 theta[5] 3.22 5.08 1.01
8 theta[6] 3.99 5.16 1.02
9 theta[7] 6.50 5.26 1.00
10 theta[8] 4.57 5.25 1.02
1 Working with draws objects in R
The posterior package provides the draws object type. These are used for draws generated from sampling. The benefit of these objects is that chains, iterations and variables are all kept. The objects mirror common base R objects: draws_df, draws_list, draws_array, draws_matrix. You can transform from one type to another with as_draws_* functions. While the package is called “posterior”, the draws objects can contain draws from prior or posterior.
Useful functions for summarising and manipulating draws are:
summarise_draws(): generate a summary of the draws based on some functionssubset_draws(): subset draws by variable, chain, iteration, drawmutate_variables(): create new variables, which can reference existing ones
summarise_draws() takes as arguments summary functions, such as mean, median or covergence diagnostics such as rhat or ess_bulk. For example:
For further details, see the documentation for the package.