stan-dev / stan-dev/posterior

Feature request: summarise specific variables with specific functions in summarise_draws

Open
#105 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Currently summarise_draws applies the summary functions to all variables. In some cases it could be useful to summarise specific variables with specific functions, akin to dplyr:summarise. This would also allow for summary functions to take multiple variables as functions.

A simple example usecase might be calculating the KL-divergence between the distributions of two parameters in the draws object, e.g.:

# draws has variables 'x' and 'y'

# currently doesn't work because it tries to apply the summary function to all variables
summarise_draws(draws, kl_xy = kl_div(x, y))

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 at the summarise_draws entry point and trace how summary functions are applied to variables. Define how variable-specific functions and functions accepting multiple variables should be expressed, using the KL-divergence example as the target behavior. Done means the requested syntax works without applying the function to unrelated variables and is covered by tests.

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.