stan-dev / stan-dev/posterior

piping weight_draws / resample_draws

Open
#310 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 weight_draws(x, weights, ...) requires weights to be a numeric vector. Would it be possible to have a piping version so that when the draws object already has a variable that contains the log weights e.g. named lw, we could pipe

x <- x |> mutate_varibles(lw = lp__-lp_approx__) |> weight_draws(weights=lw, log=TRUE)

and even better if we can pipe as

x <- x |> weight_draws(weights=lp__-lp_approx__, log=TRUE)

Piping resample_draws would also be useful (with added option for log) so that we could skip the weight_draws

x1 <- x |> resample_draws(weights=lp__-lp_approx__, log=TRUE, ndraws=1)

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 the existing weight_draws and resample_draws implementations and their current weight-handling interfaces. The work is done when the requested piping forms support weights stored in the draws object, log weights, and resampling with ndraws as shown in the examples.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.