stan-dev / stan-dev/posterior

Implement as_draws generics in other packages?

Open
#183 13 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

(Note: I'm opening this here for discussion first rather than opening a bunch of essentially duplicate issues in several packages)

Now that posterior is on CRAN, would it make sense to have as_draws() / as_draws_XXX() implementations for objects in brms, rstanarm, rstan, cmdstanr, etc? I think it would help fulfill part of the promise of {posterior}; that is, users don't have to remember what particular function for a given model type gets them draws in what format, they can just chuck the object into as_draws_XXX() for whatever format they want.

E.g. with cmdstanr, rather than doing this:

model$draws(format = "XXX")

People could (optionally) do:

model %>% as_draws_XXX()

The advantage of the latter code is that as more packages also implement these generics it becomes easier for users to move between packages. @paul-buerkner @jgabry thoughts? I dunno if this was already the plan anyway.

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 comparing posterior's existing as_draws/as_draws_XXX generics with conversion APIs in brms, rstanarm, rstan, and cmdstanr. Define which object classes and draw formats each integration should support, then confirm the proposal with maintainers before implementation; done means an agreed cross-package interface.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.