stan-dev / stan-dev/rstan

convenient posterior simulation

Open
#390 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
R
Stars
1.1k
Forks
266
Avg merge
2h 56m
Merged PRs (30d)
1

Description

Summary:

Add a function to rstan which enables seamless simulation from the posterior draws.

Description:

Its a bit cumbersome to evaluate a function per draw of the posterior at the moment. I am proposing to include a function which takes away lots of the usual boiler plate code needed usually.

Reproducible Steps:

The the attached files. The basic syntax to simulate over a posterior with some function calc_mean will then be:

## the posterior simulate function is clever enough to infer from the
## R function definition of calc_mean what it needs and it will
## automatically grab alpha and beta from the posterior and x from the
## global NS
post_sim1 <- posterior_simulate(post, calc_mean)
Current Output:

If applicable, any relevant output from RStan.
posterior_simulate_example.zip

Expected Output:

If applicable, the output you expected from RStan.

RStan Version:

2.14

R Version:

3.2.3

Operating System:

RHEL 6.7

Contributor guide

No contributing guide indexed for this repository

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

Begin with the attached posterior_simulate_example.zip and the proposed posterior_simulate(post, calc_mean) call. Use that example to define the supported posterior-draw simulation behavior and verify that the resulting function removes the described per-draw boilerplate; no repository file or test is named in the issue.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.