# \#posterior-package

**URL:** https://discourse.mc-stan.org/tag/posterior-package/201.md

[Latest](https://discourse.mc-stan.org/latest.md) · [Categories](https://discourse.mc-stan.org/categories.md) · [Tags](https://discourse.mc-stan.org/tags.md)

---

## [New posterior::extract\_list\_of\_variable\_arrays()](https://discourse.mc-stan.org/t/new-posterior-extract-list-of-variable-arrays/40838)

<div class="topic-metadata">

**Author:** [@avehtari](https://discourse.mc-stan.org/u/avehtari)\
**Replies:** 3\
**Last updated:** [January 25, 2026, 2:44pm UTC](https://discourse.mc-stan.org/t/new-posterior-extract-list-of-variable-arrays/40838 "2026-01-25T14:44:43Z")

</div>

Recently people have been refering to @andrjohns’ post saying github version of posterior package has now variant of the code existing extract\_variable\_array(), which extracts just one variable, has now argument with…

---

## [Turn off caching in rvar](https://discourse.mc-stan.org/t/turn-off-caching-in-rvar/39480)

<div class="topic-metadata">

**Author:** [@karimn](https://discourse.mc-stan.org/u/karimn)\
**Replies:** 3\
**Last updated:** [May 14, 2025, 7:14pm UTC](https://discourse.mc-stan.org/t/turn-off-caching-in-rvar/39480 "2025-05-14T19:14:04Z")

</div>

I’m using {posterior} 1.6.0 and I’m seeing the cache for a column of rvars in a data.frame ballooning to something like 400G! The actual data is a few MB. Is there anyway to turn off caching? I tried setting the cache at…

---

## [Parallelized loading of csv files](https://discourse.mc-stan.org/t/parallelized-loading-of-csv-files/36512)

<div class="topic-metadata">

**Author:** [@mippeqf](https://discourse.mc-stan.org/u/mippeqf)\
**Replies:** 3\
**Last updated:** [September 6, 2024, 8:14pm UTC](https://discourse.mc-stan.org/t/parallelized-loading-of-csv-files/36512 "2024-09-06T20:14:18Z")

</div>

I have 20 csv files that each take around 15mins to load into R, which adds up to 5h when done sequentially with either as\_cmdstan\_fit, or read\_cmdstan\_csv. Since 5h is really a lot, I’ve parallelized the the process lik…

---

## [Why does serialization of rvars take so much disk space?](https://discourse.mc-stan.org/t/why-does-serialization-of-rvars-take-so-much-disk-space/35198)

<div class="topic-metadata">

**Author:** [@dholstius](https://discourse.mc-stan.org/u/dholstius)\
**Replies:** 6\
**Last updated:** [May 22, 2024, 3:25pm UTC](https://discourse.mc-stan.org/t/why-does-serialization-of-rvars-take-so-much-disk-space/35198 "2024-05-22T15:25:44Z")

</div>

Using tidybayes::add\_epred\_rvars() is super convenient, as @wds15 and @mjskay were discussing. Love it! Unfortunately, the efficiency seems to take a huge hit when writing the result to disk. Compared to using add\_epre…

---

## [Mediation with brms, as\_draws function](https://discourse.mc-stan.org/t/mediation-with-brms-as-draws-function/33207)

<div class="topic-metadata">

**Author:** [@Hugo\_Pereira](https://discourse.mc-stan.org/u/Hugo_Pereira)\
**Replies:** 1\
**Last updated:** [November 1, 2023, 9:43am UTC](https://discourse.mc-stan.org/t/mediation-with-brms-as-draws-function/33207 "2023-11-01T09:43:13Z")

</div>

Dear all, Sorry if this is somehow a simple question but I have been stuck on this for a while. I am trying to do a simple mediation analysis. First I fitted a multilevel model in brms (“structural equation model”): #…

---

## [Extracting draw summaries prohibitively slow for massive models](https://discourse.mc-stan.org/t/extracting-draw-summaries-prohibitively-slow-for-massive-models/31204)

<div class="topic-metadata">

**Author:** [@huffyhenry](https://discourse.mc-stan.org/u/huffyhenry)\
**Replies:** 2\
**Last updated:** [May 2, 2023, 4:20pm UTC](https://discourse.mc-stan.org/t/extracting-draw-summaries-prohibitively-slow-for-massive-models/31204 "2023-05-02T16:20:29Z")

</div>

I’m working with a model with ~ 2 million parameters (~4 million together with transformed parameters). The workflow is: library(cmdstanr) model \<- cmdstan\_model(...) fit \<- model$sample(...) fit$cmdstan\_diagnose() s \<-…

---

## [Merging / grouping rvars](https://discourse.mc-stan.org/t/merging-grouping-rvars/27582)

<div class="topic-metadata">

**Author:** [@ma-riviere](https://discourse.mc-stan.org/u/ma-riviere)\
**Replies:** 9\
**Last updated:** [June 16, 2022, 4:29pm UTC](https://discourse.mc-stan.org/t/merging-grouping-rvars/27582 "2022-06-16T16:29:37Z")

</div>

I’m trying to use rvars instead of draws in my workflow (since it makes the post-processing of posterior draws much faster), but I ran into an issue I was unable to solve: how to group/merge rvars after “drawing” them. L…

---

## [Combining posterior data from multiple chains when saving .csv output from CmdStanR inference object](https://discourse.mc-stan.org/t/combining-posterior-data-from-multiple-chains-when-saving-csv-output-from-cmdstanr-inference-object/26168)

<div class="topic-metadata">

**Author:** [@xiehw](https://discourse.mc-stan.org/u/xiehw)\
**Replies:** 2\
**Last updated:** [February 1, 2022, 9:47pm UTC](https://discourse.mc-stan.org/t/combining-posterior-data-from-multiple-chains-when-saving-csv-output-from-cmdstanr-inference-object/26168 "2022-02-01T21:47:22Z")

</div>

Hi All, Some colleagues of mine are looking to plot posteriors from an inference I ran in CmdStanR in Python. I figured the best way to do it would be to generate a csv output. Initially I did the following: CON\_stan\_f…

---

## [Issue with variable names staying when using as\_draws\_df](https://discourse.mc-stan.org/t/issue-with-variable-names-staying-when-using-as-draws-df/24048)

<div class="topic-metadata">

**Author:** [@LockyW](https://discourse.mc-stan.org/u/LockyW)\
**Replies:** 1\
**Last updated:** [August 20, 2021, 9:39am UTC](https://discourse.mc-stan.org/t/issue-with-variable-names-staying-when-using-as-draws-df/24048 "2021-08-20T09:39:36Z")

</div>

Hi, I am having an issue using the function as\_draws\_df from the posterior package on my institute’s HPC, where the output draws\_df output does not contain the variable names. I have used this function successfully in …

---

## [Rvars - distinguishing between a scalar and array of size 1](https://discourse.mc-stan.org/t/rvars-distinguishing-between-a-scalar-and-array-of-size-1/23726)

<div class="topic-metadata">

**Author:** [@martinmodrak](https://discourse.mc-stan.org/u/martinmodrak)\
**Replies:** 3\
**Last updated:** [July 30, 2021, 5:04am UTC](https://discourse.mc-stan.org/t/rvars-distinguishing-between-a-scalar-and-array-of-size-1/23726 "2021-07-30T05:04:15Z")

</div>

Hi, it appears that the rvar interface in posterior cannot distinguish between a scalar and array of size 1, i.e. scalar \<- draws\_matrix("y" = 1:10) array1 \<- draws\_matrix("y\[1\]" = 1:10) all.equal(scalar, array1) # Co…

---

## [Extract draws object for the posterior package from a stanreg object?](https://discourse.mc-stan.org/t/extract-draws-object-for-the-posterior-package-from-a-stanreg-object/20440)

<div class="topic-metadata">

**Author:** [@robertvoogdgeert](https://discourse.mc-stan.org/u/robertvoogdgeert)\
**Replies:** 1\
**Last updated:** [January 30, 2021, 12:28pm UTC](https://discourse.mc-stan.org/t/extract-draws-object-for-the-posterior-package-from-a-stanreg-object/20440 "2021-01-30T12:28:05Z")

</div>

I’d like to extract a draws object from a stanreg object created with Rstanarm for use with the posterior package’s functions. But I don’t know how to do this, read the posterior functions reference but still have no clu…

---

## [Beta release of our 'posterior' R package](https://discourse.mc-stan.org/t/beta-release-of-our-posterior-r-package/15949)

<div class="topic-metadata">

**Author:** [@paul.buerkner](https://discourse.mc-stan.org/u/paul.buerkner)\
**Replies:** 2\
**Last updated:** [June 15, 2020, 10:22am UTC](https://discourse.mc-stan.org/t/beta-release-of-our-posterior-r-package/15949 "2020-06-15T10:22:33Z")

</div>

Dear Stan community, @jonah, @mjskay, @mans\_magnusson, @avehtari, @rok\_cesnovar and I have been working on the beta release of our R package ‘posterior’ in the last couple of weeks. It is intended to provide useful tool…

---

## [Naming help on function in CmdStanR and CmdStanPy to get variable from sample](https://discourse.mc-stan.org/t/naming-help-on-function-in-cmdstanr-and-cmdstanpy-to-get-variable-from-sample/15410)

<div class="topic-metadata">

**Author:** [@mitzimorris](https://discourse.mc-stan.org/u/mitzimorris)\
**Replies:** 25\
**Last updated:** [June 9, 2020, 6:22pm UTC](https://discourse.mc-stan.org/t/naming-help-on-function-in-cmdstanr-and-cmdstanpy-to-get-variable-from-sample/15410 "2020-06-09T18:22:59Z")

</div>

Now that folks are using CmdStanR and CmdStanPy to run real models, it’s clear that we need an accessor function to retrieve the named variables in the sampler output structured according to the Stan program variable dec…

---

## [Specifying variables when summarising with posterior package](https://discourse.mc-stan.org/t/specifying-variables-when-summarising-with-posterior-package/14479)

<div class="topic-metadata">

**Author:** [@atechnicolorskye](https://discourse.mc-stan.org/u/atechnicolorskye)\
**Replies:** 3\
**Last updated:** [April 24, 2020, 5:50pm UTC](https://discourse.mc-stan.org/t/specifying-variables-when-summarising-with-posterior-package/14479 "2020-04-24T17:50:06Z")

</div>

Does anyone know if I can select specific variables when using the posterior package in conjunction with cmdstan? Currently I’m just converting outputs from cmdstan into a stanfit datatype and then summarising with rstan…

---

## [Alpha release of our new 'posterior' R package](https://discourse.mc-stan.org/t/alpha-release-of-our-new-posterior-r-package/11864)

<div class="topic-metadata">

**Author:** [@paul.buerkner](https://discourse.mc-stan.org/u/paul.buerkner)\
**Replies:** 6\
**Last updated:** [November 12, 2019, 3:53pm UTC](https://discourse.mc-stan.org/t/alpha-release-of-our-new-posterior-r-package/11864 "2019-11-12T15:53:46Z")

</div>

Dear Stan community, @jonah, @mjskay, and I have been working on a new R package in the last couple of weeks, which we call ‘posterior’. It is intended to provide useful tools for both users and developers of packages f…
