stan-dev / stan-dev/posterior

Applying a function to each chain

Open
#353 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
171
Forks
26
Avg merge
2d 18h
Merged PRs (30d)
3

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the existing automatic thinning via ess and the operations used for draws and rvar objects. Compare the example using extract_variable_matrix(), apply(), and ess_bulk() with the rvar workflow, then check the relationship to summarise draws in issue #184. Done means the intended per-chain function application is defined and its interaction with automatic thinning is addressed.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.