Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stan should accumulate the mean and variance for all unknowns #2361

Open
bgoodri opened this issue Jul 25, 2017 · 13 comments
Open

Stan should accumulate the mean and variance for all unknowns #2361

bgoodri opened this issue Jul 25, 2017 · 13 comments
Labels
Milestone

Comments

@bgoodri
Copy link
Contributor

bgoodri commented Jul 25, 2017

Summary:

RStan has for a long time calculated the mean for all unknowns, even those that are not returned to R. But this (and the variance) should not be the responsibility of the interfaces.

Description:

At each unthinned iteration after warmup, the (constrained) parameters, transformed parameters, and generated quantities should be run through Welford accumulators to build up the posterior means and variances.

I am not sure how best to pass these means and variances back to the calling function when the sampling is done but we can figure that out later.

Reproducible Steps:

Cannot be done currently

Current Output:

Cannot be done currently

Expected Output:

A std::vector<double> of means and a std::vector<double> of variances.

Additional Information:

None

Current Version:

v2.16.0

@bgoodri bgoodri added this to the v3 milestone Jul 25, 2017
@syclik
Copy link
Member

syclik commented Jul 25, 2017

@bgoodri, do you envision this as a method on the Stan program class? or something that's reported by the sampler?

Now that I think about it, it seems like it should be reported by the sampler. Thoughts?

@bgoodri
Copy link
Contributor Author

bgoodri commented Jul 25, 2017 via email

@maverickg
Copy link
Contributor

maverickg commented Jul 25, 2017 via email

@bob-carpenter
Copy link
Contributor

bob-carpenter commented Jul 25, 2017 via email

@betanalpha
Copy link
Contributor

betanalpha commented Jul 25, 2017 via email

@syclik
Copy link
Member

syclik commented Jul 25, 2017 via email

@syclik
Copy link
Member

syclik commented Jul 25, 2017 via email

@bob-carpenter
Copy link
Contributor

@syclik What do you mean by inversion of control in this case? More callbacks passed in to handle accumulation of means and variances or something like that?

And yes, we can't be doing r-hat online---that's way too expensive. And I don't see any reason to return the accumulated means and variances as the program runs. There'll also be the issue that we don't even want to start collecting these things until after warmup.

@syclik
Copy link
Member

syclik commented Jul 25, 2017 via email

@bgoodri
Copy link
Contributor Author

bgoodri commented Jul 25, 2017 via email

@sakrejda
Copy link
Contributor

sakrejda commented Jul 25, 2017 via email

@bob-carpenter
Copy link
Contributor

@bgoodri: Are you suggesting that we calculate the means and variances before thinning?

I realize that would provide higher ESS in general, but I think it'll be very misleading in the context of thinning where analyzing the thinned posterior that a user actually saved would provide a different answer than what we report.

@bgoodri
Copy link
Contributor Author

bgoodri commented Jul 26, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants