Replies: 10 comments 4 replies
-
Hi Kelson ( @KelsonGs ), Thanks for your email. I'll take a look asap (I'm traveling at the moment and don't have very good connectivity). Or you can make a PR. Best |
Beta Was this translation helpful? Give feedback.
-
Just to confirm we're talking about the same method, if I run:
I get:
|
Beta Was this translation helpful? Give feedback.
-
Hi Rob,
Great to hear from you. The output you provided is correct in that it is
the output from the stan_summary method. Curiously, your output gives theta
with quite a few sig-figs, my output (picture below) has all the r_hat
values for the parameters of interest given to 1dp. I've found that
stan_summary always gives me param r_hat values to 1dp. Some of my models
(with lower draws & warmups) give r_hat of 1.1, but the value never gets
more precise than 1dp.
Given that your output does not have the same problem, might this be a
version issue?
I am running CmdStan 2.3.2 using Miniconda, and the StanSample v7.4.2.
Best,
Kelson
[image: image.png]
…On Thu, 31 Aug 2023 at 17:11, Rob J Goedman ***@***.***> wrote:
Just to confirm we're talking about the same method, if I run:
include("/Users/rob/.julia/dev/StanSample/example/bernoulli.jl");
I get:
In [3]: read_summary(sm)
8×10 DataFrame
Row │ parameters mean mcse std 5% 50% 95% ess n_eff/s r_hat
│ Symbol Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64
─────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
1 │ lp__ -8.16742 0.0187357 0.760978 -9.66123 -7.87367 -7.64004 1649.7 48520.6 1.00034
2 │ accept_stat__ 0.915255 0.00193465 0.127225 0.639421 0.970274 1.0 4324.56 127193.0 1.00107
3 │ stepsize__ 1.01558 0.0657878 0.0931778 0.85911 1.05703 1.10394 2.00602 59.0005 2.22175e13
4 │ treedepth__ 1.3655 0.0080534 0.48163 1.0 1.0 2.0 3576.59 105194.0 0.999351
5 │ n_leapfrog__ 2.3995 0.0191298 1.07642 1.0 3.0 3.0 3166.25 93125.0 1.0049
6 │ divergent__ 0.0 NaN 0.0 0.0 0.0 0.0 NaN NaN NaN
7 │ energy__ 8.66522 0.0263062 1.04349 7.69044 8.34701 10.7545 1573.47 46278.6 1.00074
8 │ theta 0.333709 0.00355884 0.130675 0.131946 0.326891 0.561284 1348.25 39654.3 1.00231
—
Reply to this email directly, view it on GitHub
<#73 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AJG2IS2UQY2WQFNV7NLGPXDXYAMIJANCNFSM6AAAAAA4EF2RLE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Thanks, got them earlier while biking. Will try to generate simulated input and see how far I can get. If you have the pre-computed data, that would be even better. Thanks, |
Beta Was this translation helpful? Give feedback.
-
Hi Kelson ( @KelsonGs ), Had a quick look at the summary result and HB_Stan.jl. In HB_Stan.jl you use:
The second DataFrame conversion is not doing anything I think, but also would not lead to rounding. I am surprised by the estimation control settings for MCMC, these seem very high, and combined with the fact that the summary output seems to indicate that most estimated values are smaller than the standard deviation I wonder if there is a (much) smaller generative model for your data, something like (if that makes sense!):
to check the model. But you might already have done all of that. In that case, I would probably try to post the model with needed data on the Stan mailing list. Or as an interim step I could try to run it. But my real experience with these kind of models is limited. Best, |
Beta Was this translation helpful? Give feedback.
-
Hi @KelsonGs As I also mentioned in my direct email, this morning I ran your model and was able to reproduce similar Rhat values for your model. Looking at some chain plots and the summary results I didn't see anything clearly wrong. So I decided to experiment a bit with a slightly simpler model (see below pdf file) and what I found is that as soon as the Stan model combines coefficients, Rhat is reported as 1.0. In below file this is demonstrated with 3 models estimating coefficients [a, b, sigma], [a, b[1], b[2], sigma] and [a, b, c, sigma]. In particular models 2 and 3 estimate similar values for b[1]==b and b[2]==c (as expected), but report Rhat differently. The Rhat values are not visible, so I've copied them below: ms_02.r_hat = [1.00044 ms_03_r_hat = [1.00192 |
Beta Was this translation helpful? Give feedback.
-
This is a script that can be used in the REPL:
|
Beta Was this translation helpful? Give feedback.
-
Another option would be to use MCMCChains.jl:
This is after running above MWE. |
Beta Was this translation helpful? Give feedback.
-
Hi Kelson ( @KelsonGs ), This is as far I think I can get. Not shown here, I tried the same with your model and get similar results (Rhat values close to 1). I'm still a bit concerned about the sigma estimates in your model (e.g. using plot_chains()) We could ask about the Rhat issue on the Stan mailing list. Rob |
Beta Was this translation helpful? Give feedback.
-
Hi @KelsonGs Can I close this discussion? Thanks, |
Beta Was this translation helpful? Give feedback.
-
Hey there,
In the following discussion "Rhat" refers to the Rhat value for posterior means as presented in the summary output file. The issue I raise relates to how Rhat values are reported in the StanSample.jl summary output file (given by read_summary method). The models I am using have Rhat values in the interval (1.0,1.1), these values appear to be rounded to 1dp, hence for any Rhat < 1.05 the corresponding summary file presents the value as 1.0. The motivation for this choice of rounding Rhat to 1.0 appears to follow from the discussion on Rhat given in the CmdStan user guide (linked below) which suggests Rhat values less than 1.05 are desirable, therefore rounding to 1dp is sufficient for assessing Rhat under this criterion.
The issue I have is that I am going by the Rhat criterion presented in Vehtari et al. (2020), this criterion suggests Rhat values be < 1.01. Therefore, to assess whether my Rhat values fulfil this criterion I need more precise Rhat values, i.e. Rhat values rounded to >= 2dp. Alternatively, is there some existing method or workaround that would allow me to generate Rhat values with higher precision?
Thanks!
Refs:
Vehtari et al. (2020), https://arxiv.org/abs/1903.08008 - Accessed: http://www.stat.columbia.edu/~gelman/research/published/rhat.pdf
CmdStan user guide; stansummary discussion. Accessed: https://mc-stan.org/docs/cmdstan-guide/stansummary.html#model-parameters-and-quantities-of-interest
I am using CmdStan version 2.32.2 and Julia version 1.9.1.
Beta Was this translation helpful? Give feedback.
All reactions