stan-dev / stan-dev/posterior

storing superchain_ids for rhat_nested

Open
#450 3 comments 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

I have been working a bit with many short chains, and using nested R-hat as a convergence diagnostic. rhat_nested has an additional argument superchain_ids which is a vector specifying which superchain each chain belongs to. My current workflow is to add the superchain_ids as an attribute to a posterior::draws object, and then do something like

summarise_draws(draws, rhat_nested = ~rhat_nested(.x, superchain_ids = attr(draws, "superchain_ids"))

This is a bit cumbersome, and maybe it could be improved with:

  • a new function add_superchain_ids, which will then add the superchain_ids to the draws object (as an attribute?)
  • have summarise_draws automatically use the stored superchain_ids for rhat_nested

Any thoughts on this? I could make a PR if this seems reasonable

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 reading rhat_nested and summarise_draws to understand how superchain_ids are currently passed. The issue needs a decision on whether to add an add_superchain_ids function, store the values as an attribute, and have summarise_draws use them automatically. Done means the API and automatic behavior are agreed and implemented consistently.

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
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.