简体   繁体   English

R中的广义逆Gamma分布

[英]Generalized Inverse Gamma Distribution in R

Mathematica has a four-parameter generalized inverse gamma distribution: Mathematica有一个四参数广义逆伽马分布:

http://reference.wolfram.com/mathematica/ref/InverseGammaDistribution.html http://reference.wolfram.com/mathematica/ref/InverseGammaDistribution.html

and gives its PDF on that page too. 并在该页面上提供PDF。 Has anyone implemented the density, distribution, quantile, and sampling-from functions for that in R? 是否有人为R中的函数实现了密度,分布,分位数和采样函数?

I did make a quick start (the PDF is just the equations on that page translated into R) but if its done already I'll not bother with implementing the CDF and the quantile function. 我确实快速启动(PDF只是该页面上的公式转换为R),但如果它已经完成,我将不会为实现CDF和分位数函数而烦恼。

Does a general function for computing the CDF (by integration of PDF) and the Quantile (by inversion of the CDF) of any distribution given the PDF exist? 是否存在用于计算CD的任何分布的CDF(通过PDF的集成)和分位数(通过CDF的反转)的一般函数?

[Note this is not the generalized inverse Gaussian] [注意这不是广义逆高斯]

Note also the 'Properties and Relations' dropdown on the Mathematica page, which seems to imply its not a special case or generalisation of anything (apart from the inverse gamma). 另请注意Mathematica页面上的“属性和关系”下拉列表,这似乎暗示它不是特殊情况或任何事物的概括(除了反伽玛)。

I started a package to implement this: 我启动了一个包来实现这个:

https://github.com/barryrowlingson/geninvgamma https://github.com/barryrowlingson/geninvgamma

Its only using simple inversion and integration of the density, so nothing clever. 它只使用简单的反转和密度的集成,所以没有什么聪明。 Currently random samples from the distribution are done by generating a U(0,1) and getting the quantile, which isn't very efficient or very accurate it seems.. 目前来自分布的随机样本是通过生成U(0,1)并获得分位数来完成的,这似乎不是非常有效或非常准确。

Anyway, its a start. 无论如何,这是一个开始。

根据这个小插图 (附录C2),反伽马分布是广义双曲分布的特例,它由ghyp包实现。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM