Skip to content

update ESS calculation code to be consistent with bayes-kit #5

@magland

Description

@magland

There are some unresolved questions here about what should be the exact formulae used. (will need to discuss with @bob-carpenter)

Here is the bayes-kit implemention, which may have some issues:

https://github.com/flatironinstitute/bayes-kit/blob/main/bayes_kit/ess.py

Here's is the current mcmc-monitor implementation, which may need to be adjusted:

https://github.com/flatironinstitute/mcmc-monitor/blob/459e8b6814c745bbf7681f3035b409177a540057/src/MCMCMonitorDataManager/stats/ess.ts

The critical functions in question are

first_neg_pair_start

export function first_neg_pair_start(chain: number[]): number {
const N = chain.length
let n = 0
while (n + 1 < N) {
if (chain[n] + chain[n + 1] < 0) {
return n
}
n = n + 1
}
return N
}

and ess_imse
https://github.com/flatironinstitute/bayes-kit/blob/22a3e9ff31f2268f47e13a737dc57c81a26ae917/bayes_kit/ess.py#L99-L135

They way mcmc-monitor does it now, the sigma_sq_hat (I think aka IAT) is never going to be less than 1, which I believe should be a desirable property. But of course we'll want to be consistent with bayes-kit.

tagging: @jsoules @WardBrian

Metadata

Metadata

Assignees

Labels

blocked-by-otherProgress can't be made until something happens outside this issue/project.bugSomething isn't workinghigh-priorityThis is an important issue that should be addressed as soon as current work is complete.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions