-
Notifications
You must be signed in to change notification settings - Fork 7
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
Negative ESS #40
Comments
Maybe I can inspect it later today but I don't have time right now. Some quick thoughts:
|
OK, so I did some experiments. It's basically as I expected, it seems. The
In general, we want to add the other improvements in the Vehtari paper as well (see #22). I wonder if that would be helpful for this example as well. |
I looked into this a little as well. The comparable method in julia> using MCMCDiagnosticTools, MCMCChains, ArviZ, RCall, DelimitedFiles, PyCall, Plots
julia> R"require('posterior')";
julia> chns = MCMCChains.Chains(readdlm("badsamples.dat")');
julia> ess_df = ess_rhat(chns);
julia> ess_mcmcdt = [only(ess_df[k].nt.ess) for k in keys(chns)];
julia> ess_ds = ArviZ.ess(chns; method=:mean);
julia> ess_arviz = [ess_ds[k].values[] for k in keys(chns)];
julia> ess_post = [R"ess_basic($(chns[k]))"[1] for k in keys(chns)];
julia> maximum(abs, ess_post - ess_arviz) # posterior and ArviZ completely agree
7.275957614183426e-12
julia> scatter(ess_mcmcdt, ess_arviz; xlabel="MCMCDT", ylabel="ArviZ", legend=false)
The julia> ess_ds_bulk = ArviZ.ess(chns; method=:bulk);
julia> ess_arviz_bulk = [ess_ds_bulk[k].values[] for k in keys(chns)];
julia> ess_post_bulk = [R"ess_bulk($(chns[k]))"[1] for k in keys(chns)];
julia> maximum(abs, ess_post_bulk - ess_arviz_bulk) # ArviZ and posterior also identical
4.547473508864641e-12
julia> scatter(ess_mcmcdt, ess_arviz; xlabel="MCMCDT", ylabel="ArviZ", label="basic", msw=0, alpha=0.5)
julia> scatter!(ess_mcmcdt, ess_arviz_bulk; label="bulk", xlims=(0, Inf), msw=0, alpha=0.5, legend=:bottomright)
Yeah, it's unfortunate how outdated the texts get as improvements are made to the methods. ArviZ made these changes when adding the other ESS approaches referenced in #22, and I'm pretty sure is just a straight port from posterior:
I agree we should see if these make a difference here. |
Looks like this was already contained in the initial commit of the GitHub code by @paul-buerkner |
It seems several of these may have first appeared in this Stan PR: stan-dev/stan#2774 I'll look through the discussion later. |
Ah yes, sorry for the confusion - my comment above was incorrect: actually when I implemented |
I ran down the original sources for the modifications in #40 (comment). The original source is actually the Rank-normalized ESS/R-hat paper: These were first introduced to rstan in stan-dev/rstan#618, patterned after the reference implementation in the paper repo: https://github.com/avehtari/rhat_ess/blob/44d5b15173d724bfc028065877183d16961fd2f3/code/monitornew.R Based on this, I believe we should make the corresponding modifications to our implementations. |
In this example something seems to go wrong (check ESS parameter 4): (data at https://gist.github.com/mschauer/96ffd226d91160b1c9288200c13a77d5)
The text was updated successfully, but these errors were encountered: