# Stan files for models in PosteriorDB

**URL:** <https://discourse.mc-stan.org/t/stan-files-for-models-in-posteriordb/40936>\
**Category:** General\
**Created:** [February 20, 2026, 10:25pm UTC](https://discourse.mc-stan.org/t/stan-files-for-models-in-posteriordb/40936 "2026-02-20T22:25:44Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![charlesm93](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/charlesm93/32/4634_2.png) [@charlesm93](https://discourse.mc-stan.org/u/charlesm93)\
**Post date:** [February 20, 2026, 10:25pm UTC](https://discourse.mc-stan.org/t/stan-files-for-models-in-posteriordb/40936/1 "2026-02-20T22:25:44Z")

</div>

I want to take a look at models in PosteriorDB ( [GitHub - stan-dev/posteriordb: Database with posteriors of interest for Bayesian inference](https://github.com/stan-dev/posteriordb) ). First, I tried to find a list of all available models. In R

```no-highlight
library("posteriordb")
my_pdb <- pdb_local(path = "~/Code/posteriordb/")
pos <- posterior_names(my_pdb)
head(pos)
# [1] "arK-arK" "arma-arma11"                    
# [3] "bball_drive_event_0-hmm_drive_0" "bball_drive_event_1-hmm_drive_1"
# [5] "bones_data-bones_model" "butterfly-multi_occupancy"  

```

In the full list, I spotted `“prostate-logistic_regression_rhs”` and `“ovarian-logistic_regression_rhs”`, which I’m guessing are models with horseshoe priors. But I couldn’t find the specific Stan files under [posteriordb/posterior\_database/models/stan at master · stan-dev/posteriordb · GitHub](https://github.com/stan-dev/posteriordb/tree/master/posterior_database/models/stan) . Am I looking at the wrong repo?

---

<div class="post-metadata">

**Author:** ![avehtari](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/avehtari/32/5935_2.png) [@avehtari](https://discourse.mc-stan.org/u/avehtari)\
**Post date:** [February 21, 2026, 1:19pm UTC](https://discourse.mc-stan.org/t/stan-files-for-models-in-posteriordb/40936/2 "2026-02-21T13:19:43Z")

</div>

Maybe easier to use `posteriordb` package functions?

```r
"prostate-logistic_regression_rhs" |>
  posterior(my_db) |>
  stan_code_file_path()

```

---

<div class="post-metadata">

**Author:** ![charlesm93](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/charlesm93/32/4634_2.png) [@charlesm93](https://discourse.mc-stan.org/u/charlesm93)\
**Post date:** [February 23, 2026, 4:45pm UTC](https://discourse.mc-stan.org/t/stan-files-for-models-in-posteriordb/40936/3 "2026-02-23T16:45:33Z")

</div>

Thanks Aki. The command returns the following:

```no-highlight
"/var/folders/ty/36ws994x4l33ksszcdwjtrv40000gp/T//RtmpwsryKD/posteriordb_cache/models/stan/logistic_regression_rhs.stan"

```

But I couldn’t locate the `var` folder. That said, I did find the stan model locally.

```no-highlight
posteriordb/posterior_database/models/stan/logistic_regression_rhs.stan

```

---

<div class="post-metadata">

**Author:** ![avehtari](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/avehtari/32/5935_2.png) [@avehtari](https://discourse.mc-stan.org/u/avehtari)\
**Post date:** [February 23, 2026, 5:16pm UTC](https://discourse.mc-stan.org/t/stan-files-for-models-in-posteriordb/40936/4 "2026-02-23T17:16:49Z")

</div>

> [@charlesm93](#):
>
> But I couldn’t locate the `var` folder.

It must be your operating system confusing you. You don’t actually need to see anything about the path as you can just assign the file path string to a variable without seeing it (with ← or -\>), and use that variable to refer to the file. Or if you want to edit it, just keep piping to get the file in your working directory

```no-highlight
"prostate-logistic_regression_rhs" |>
  posterior(my_db) |>
  stan_code_file_path() |>
  file.copy(".")

```

> [@charlesm93](#):
>
> That said, I did find the stan model locally.

Great

---

<div class="post-metadata">

**Author:** ![ahartikainen](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/ahartikainen/32/321_2.png) [@ahartikainen](https://discourse.mc-stan.org/u/ahartikainen)\
**Post date:** [February 24, 2026, 7:00am UTC](https://discourse.mc-stan.org/t/stan-files-for-models-in-posteriordb/40936/5 "2026-02-24T07:00:50Z")

</div>

> [@charlesm93](#):
>
> prostate-logistic\_regression\_rhs

So check this posterior json

> <https://github.com/stan-dev/posteriordb/blob/master/posterior_database/posteriors/prostate-logistic_regression_rhs.json>

And notice the model you should look at is

> <https://github.com/stan-dev/posteriordb/blob/master/posterior_database/models/stan/logistic_regression_rhs.stan>

and data used there is

> <https://github.com/stan-dev/posteriordb/blob/master/posterior_database/data/data/prostate.json.zip>

---

<div class="post-metadata">

**Author:** ![avehtari](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/avehtari/32/5935_2.png) [@avehtari](https://discourse.mc-stan.org/u/avehtari)\
**Post date:** [February 25, 2026, 8:28pm UTC](https://discourse.mc-stan.org/t/stan-files-for-models-in-posteriordb/40936/6 "2026-02-25T20:28:47Z")

</div>

> [@ahartikainen](#):
>
> So check this posterior json

Happy to get feedback on the user interface and vignette so that we can make it easier to find model code and data without need to look at json.

---

<div class="post-metadata">

**Author:** ![Bob\_Carpenter](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/bob_carpenter/32/9230_2.png) [@Bob\_Carpenter](https://discourse.mc-stan.org/u/Bob_Carpenter)\
**Post date:** [March 10, 2026, 12:41am UTC](https://discourse.mc-stan.org/t/stan-files-for-models-in-posteriordb/40936/7 "2026-03-10T00:41:04Z")

</div>

> [@avehtari](#):
>
> Happy to get feedback on the user interface

I’ve found it easier to just grab the model/data pairs I need directly, either on GitHub or after cloning.

One thing I’d recommend is a naming convention where the data for a model has the same prefix as the model. As is, I find it a bit challenging to figure out which data goes with which model.

---

<div class="post-metadata">

**Author:** ![avehtari](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/avehtari/32/5935_2.png) [@avehtari](https://discourse.mc-stan.org/u/avehtari)\
**Post date:** [March 10, 2026, 7:35am UTC](https://discourse.mc-stan.org/t/stan-files-for-models-in-posteriordb/40936/8 "2026-03-10T07:35:37Z")

</div>

> [@Bob\_Carpenter](#):
>
> One thing I’d recommend is a naming convention where the data for a model has the same prefix as the model. As is, I find it a bit challenging to figure out which data goes with which model.

Good point. We have to be more careful with the prefixes. The origin for not having the same prefix for models and data is that a single model can be used with data from different sources and vice versa. In posteriordb it is likley that a single data is used only with variations of a model, so we could use the same prefix for all common model variations and all data sets that are used with those variations. Also, the posterior object in the database knows both the model name and data name, so there would be a benefit of using the database instead of directly looking at model and data directories.

---

<div class="post-metadata">

**Author:** ![Niko](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/niko/32/12409_2.png) [@Niko](https://discourse.mc-stan.org/u/Niko)\
**Post date:** [March 10, 2026, 10:55am UTC](https://discourse.mc-stan.org/t/stan-files-for-models-in-posteriordb/40936/9 "2026-03-10T10:55:46Z")

</div>

The posterior’s name (as eg listed in [posteriordb/posterior\_database/posteriors at master · stan-dev/posteriordb · GitHub](https://github.com/stan-dev/posteriordb/tree/master/posterior_database/posteriors) ) is just always {dataset}-{model} though, right? I find this pretty unambiguous.

---

<div class="post-metadata">

**Author:** ![ahartikainen](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/ahartikainen/32/321_2.png) [@ahartikainen](https://discourse.mc-stan.org/u/ahartikainen)\
**Post date:** [March 10, 2026, 12:00pm UTC](https://discourse.mc-stan.org/t/stan-files-for-models-in-posteriordb/40936/10 "2026-03-10T12:00:53Z")

</div>

I think even something similar like this would be a nice addition to posteriordb.

Quick example made with ChatGPT (I think reference posteriors is still broken)

> **[PosteriorDB Explorer](https://ahartikainen.github.io/posteriordb/)**

edit. Yes I think the color theme is horrific

---

<div class="post-metadata">

**Author:** ![avehtari](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/avehtari/32/5935_2.png) [@avehtari](https://discourse.mc-stan.org/u/avehtari)\
**Post date:** [March 11, 2026, 7:57am UTC](https://discourse.mc-stan.org/t/stan-files-for-models-in-posteriordb/40936/11 "2026-03-11T07:57:44Z")

</div>

Ping @mans_magnusson

---

<div class="post-metadata">

**Author:** ![mans\_magnusson](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/mans_magnusson/32/7093_2.png) [@mans\_magnusson](https://discourse.mc-stan.org/u/mans_magnusson)\
**Post date:** [April 4, 2026, 9:55am UTC](https://discourse.mc-stan.org/t/stan-files-for-models-in-posteriordb/40936/12 "2026-04-04T09:55:43Z")

</div>

I really like the posterior explorer idea @ahartikainen to quickly find the right stuff. Is there an easy way to set it up so it can be deployed as we update the posteriordb?

---

<div class="post-metadata">

**Author:** ![ahartikainen](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/ahartikainen/32/321_2.png) [@ahartikainen](https://discourse.mc-stan.org/u/ahartikainen)\
**Post date:** [April 6, 2026, 7:20am UTC](https://discourse.mc-stan.org/t/stan-files-for-models-in-posteriordb/40936/13 "2026-04-06T07:20:37Z")

</div>

The setup I have there is to create a static html +js page that reads “local” files which are created by the CI when master branch is merged. This way there is no need to use github API or download anything parse the result.

> **[GitHub - ahartikainen/posteriordb: Database with posteriors of interest for Bayesian...](https://github.com/ahartikainen/posteriordb)**
>
> Database with posteriors of interest for Bayesian inference

[Static HTML](https://github.com/ahartikainen/posteriordb/blob/master/docs/index.html)

[Build Index](https://github.com/ahartikainen/posteriordb/blob/master/scripts/build_index.py)

[Build Pages](https://github.com/ahartikainen/posteriordb/blob/master/.github/workflows/build-pages.yml)

I think some developer hours should be used to fix the UI and maybe iron out some of the bugs.

But that could work with straight from github.
