Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何生成具有二元伽马分布的随机数。密度为:
F ( X , Y ) ( x , y ) = α p+q x p-1 (yx) q-1 e -αy / [Γ( p ) Γ( q )],
这很简单:
生成 X~ Gamma(p,alpha)(alpha 是公式中的速率参数)
生成 W~ Gamma(q,alpha),与 X 无关
计算 Y=X+W
(X,Y) 具有所需的二元分布。
在 R 中(假设 p、q、alpha 和 n 已经定义):
x <- rgamma(n,p,alpha) y <- x + rgamma(n,q,alpha)
从参数为 p,q,alpha 的二元分布生成 n 个值