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

ESS Fix #98

Merged
merged 13 commits into from
May 2, 2019
Merged

ESS Fix #98

merged 13 commits into from
May 2, 2019

Conversation

cpfiffer
Copy link
Member

Fixes #90 by actually doing the math (mostly) right. ESS now also reports Rhat, as below:

ess(chn)
ESS

│ Row │ parameters │ ess     │ r_hat    │
│     │ Symbol     │ Any     │ Any      │
├─────┼────────────┼─────────┼──────────┤
│ 1   │ theta      │ 1558.330.999004

Rhat will also show up in the summary stats block.

src/stats.jl Outdated Show resolved Hide resolved
@goedman
Copy link
Collaborator

goedman commented May 1, 2019

Just out of interest, in addition to the ess plot, a plot for r_hat. Below both plots.

ess__estimates_plot.pdf
rhat__estimates_plot.pdf

For ess the values for 100 simulations (run) came from stansummary, MCMCChains and MCMCDiagnostics.

For r-hat the plotted values came from stansummary and MCMCChains.

The test program is part of StatisticalRethinking ess-rhat_tests.jl.

@itsdfish
Copy link
Contributor

itsdfish commented May 1, 2019

Rob-

I have a quick question about the r-hat plot. If I understand correctly, it seems like Turing produces larger and more variable r-hat than CmdStan for the same model, data and r-hat function. However, it appears that the delta parameter for Turing is .95 and .80 for CmdStan. Is this causing the difference and is that intentional?

@goedman
Copy link
Collaborator

goedman commented May 1, 2019

Yes, both the ess and r-hat show much greater variability, which surprised me as well. Early on I did use runs with the accept target at .65 and .85, and saw no difference for ess. Will run the test with .80, just to make sure.

@itsdfish
Copy link
Contributor

itsdfish commented May 1, 2019

Equating the target acceptance rate seems like a good idea. If the problem persists, it suggests there might be a problem with Turing somewhere.

@goedman
Copy link
Collaborator

goedman commented May 1, 2019

These are the plots with the accept target at .80:

ess__estimates_plot.pdf
rhat__estimates_plot.pdf

@itsdfish
Copy link
Contributor

itsdfish commented May 2, 2019

I've had a suspicion for a while that Turing is not producing the right results, especially for autocorrelation/ESS. It might be worth filing an issue unless you can think of some other explanation for the large divergence.

@goedman
Copy link
Collaborator

goedman commented May 2, 2019

And with delta = 0.65:

ess__estimates_plot.pdf
rhat__estimates_plot.pdf

@goedman
Copy link
Collaborator

goedman commented May 2, 2019

Will do that when back in DC an check on Slack first. Of course I’m the world’s most limited Turing user, just Nuts.

@itsdfish
Copy link
Contributor

itsdfish commented May 2, 2019

That sounds good. Let me know if you want me to file an issue to help out. I just wanted to make sure you couldn't think of any other explanations for the behavior.

@cpfiffer cpfiffer merged commit 72d3e89 into master May 2, 2019
@cpfiffer cpfiffer deleted the csp/ess-fix branch May 2, 2019 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ESS appears to be incorrect
4 participants