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

Making MCSE for constant arrays consistent #122

Open
sethaxen opened this issue Mar 13, 2024 · 0 comments
Open

Making MCSE for constant arrays consistent #122

sethaxen opened this issue Mar 13, 2024 · 0 comments
Labels
good first issue Good for newcomers

Comments

@sethaxen
Copy link
Member

Currently mcse behaves inconsistently for constant arrays depending on the estimator and method:

julia> using MCMCDiagnosticTools, Statistics

julia> x = ones(100);

julia> mcse(x; kind=mean)
NaN

julia> mcse(x; kind=std)
NaN

julia> mcse(x; kind=median) # hangs because ESS is NaN, which prevents `betainvcdf` from terminating
^CERROR: InterruptException:
...

julia> mcse(x; kind=x -> mean(x))  # using sbm
0.0

julia> mcse(x; kind=x -> std(x))  # using sbm
0.0

julia> mcse(x; kind=x -> median(x))  # using sbm
0.0

We could either:

  • return 0.0 for constant arrays
  • return NaN for constant arrays

I feel that returning NaN makes more sense. Constant arrays are most likely to occur either when a sampled parameter has some fixed entries (e.g. the diagonal of a correlation matrix) or when all transitions that perturbed the parameter were rejected; this often indicates failed sampling. Since MCSE is primarily useful as a convergence diagnostic, I think returning NaN makes the most sense here.

@sethaxen sethaxen added the good first issue Good for newcomers label Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant