diff --git a/LICENSE b/LICENSE index eb243a2..f7b1809 100644 --- a/LICENSE +++ b/LICENSE @@ -3,6 +3,7 @@ MIT License Copyright (c) 2021 Brian J Smith, the Turing team and contributors: https://github.com/brian-j-smith/Mamba.jl/contributors +https://github.com/TuringLang/MCMCChains.jl/contributors https://turing.ml/dev/team/ diff --git a/src/rafterydiag.jl b/src/rafterydiag.jl index 6a8fe72..3357054 100644 --- a/src/rafterydiag.jl +++ b/src/rafterydiag.jl @@ -1,10 +1,10 @@ -""" +@doc raw""" rafterydiag(x::AbstractVector{<:Real}; q=0.025, r=0.005, s=0.95, eps=0.001, range=1:length(x)) -Compute the Raftery and Lewis diagnostic [^Raftery1992]. +Compute the Raftery and Lewis diagnostic [^rafterydiag]. This diagnostic is used to determine the number of iterations required to estimate a specified quantile `q` within a desired degree of accuracy. -The diagnostic is designed to determine the number of autocorrelated samples required to estimate a specified quantile \$\theta_q\$, such that \$\\Pr(\\theta \\le \\theta_q) = q\$, within a desired degree of accuracy. -In particular, if \$\\hat{\\theta}_q\$ is the estimand and \$\\Pr(\\theta \\le \\hat{\\theta}_q) = \\hat{P}_q\$ the estimated cumulative probability, then accuracy is specified in terms of `r` and `s`, where \$\\Pr(q - r < \\hat{P}_q < q + r) = s\$. +The diagnostic is designed to determine the number of autocorrelated samples required to estimate a specified quantile $\theta_q$, such that $\Pr(\theta \le \theta_q) = q$, within a desired degree of accuracy. +In particular, if $\hat{\theta}_q$ is the estimand and $\Pr(\theta \le \hat{\theta}_q) = \hat{P}_q$ the estimated cumulative probability, then accuracy is specified in terms of `r` and `s`, where $\Pr(q - r < \hat{P}_q < q + r) = s$. Thinning may be employed in the calculation of the diagnostic to satisfy its underlying assumptions. However, users may not want to apply the same (or any) thinning when estimating posterior summary statistics because doing so results in a loss of information. Accordingly, sample sizes estimated by the diagnostic tend to be conservative (too large). @@ -13,7 +13,7 @@ Furthermore, the argument `r` specifies the margin of error for estimated cumula `eps` specifies the tolerance within which the probabilities of transitioning from initial to retained iterations are within the equilibrium probabilities for the chain. This argument determines the number of samples to discard as a burn-in sequence and is typically left at its default value. -[^Raftery1992]: A L Raftery and S Lewis. Bayesian Statistics, chapter How Many Iterations in the Gibbs Sampler? Volume 4. Oxford University Press, New York, 1992. +[^rafterydiag]: A L Raftery and S Lewis. Bayesian Statistics, chapter How Many Iterations in the Gibbs Sampler? Volume 4. Oxford University Press, New York, 1992. """ function rafterydiag( x::AbstractVector{<:Real}; q=0.025, r=0.005, s=0.95, eps=0.001, range=1:length(x)