最高后密度区和中央可信区 [英] Highest Posterior Density Region and Central Credible Region
问题描述
给定一些参数 Θ 的后验 p(Θ|D),可以 ?
对于常见的参数分布(例如 Beta、Gaussian 等),是否有任何内置程序或库可以使用 SciPy 或 statsmodels?>
你可以利用 pymc3 来计算 HPD,这是一个例子
导入pymc3从 scipy.stats 导入规范a = norm.rvs(大小=10000)pymc3.stats.hpd(a)
Given a posterior p(Θ|D) over some parameters Θ, one can define the following:
Highest Posterior Density Region:
The Highest Posterior Density Region is the set of most probable values of Θ that, in total, constitute 100(1-α) % of the posterior mass.
In other words, for a given α, we look for a p* that satisfies:
and then obtain the Highest Posterior Density Region as the set:
Central Credible Region:
Using the same notation as above, a Credible Region (or interval) is defined as:
Depending on the distribution, there could be many such intervals. The central credible interval is defined as a credible interval where there is (1-α)/2 mass on each tail.
Computation:
For general distributions, given samples from the distribution, are there any built-ins in to obtain the two quantities above in Python or PyMC?
For common parametric distributions (e.g. Beta, Gaussian, etc.) are there any built-ins or libraries to compute this using SciPy or statsmodels?
To calculate HPD you can leverage pymc3, Here is an example
import pymc3
from scipy.stats import norm
a = norm.rvs(size=10000)
pymc3.stats.hpd(a)
这篇关于最高后密度区和中央可信区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!