Skip to content

Commit

Permalink
Label HPD intervals properly.
Browse files Browse the repository at this point in the history
  • Loading branch information
brian-j-smith committed Apr 9, 2015
1 parent 6840977 commit 1dac90d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion doc/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ Once convergence has been assessed, sample statistics may be computed on the MCM
## Highest Posterior Density Intervals
>>> hpd(sim1)
2.5% 97.5%
95% Lower 95% Upper
s2 0.0746761 4.6285413
beta[1] -1.9919011 3.0059020
beta[2] 0.1162965 1.6180369
Expand Down
3 changes: 2 additions & 1 deletion src/output/stats.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ end

function hpd(c::Chains; alpha::Real=0.05)
cc = combine(c)
labels = [string(100 * alpha / 2) * "%", string(100 * (1 - alpha / 2)) * "%"]
pct = first(showoff([100.0 * (1.0 - alpha), 0.0]))
labels = ["$(pct)% Lower", "$(pct)% Upper"]
vals = mapslices(x -> hpd(x, alpha=alpha), cc, 1)'
ChainSummary(vals, c.names, labels, header(c))
end
Expand Down

0 comments on commit 1dac90d

Please sign in to comment.