rand_gamma

版本 1.0.0.0 (14.9 KB) 作者: Matthew Roughan
Generates Gamma randomc variables.
583.0 次下载
更新时间 2011/4/4

查看许可证

Generate a Gamma random variable
"Statistical Distributions", Evans, Hastings, Peacock, 2nd Edition,
Wiley, 1993, p.75-81

INPUTS:
(N,M) = size of array of random variables to generate
b = scale parameter > 0
c = shape parameter > 0

probability density function (pdf)
p(x) = (x/b)^(c-1) * exp(-x/b) / (b * gamma(c))

where gamma(c) is the gamma function (http://en.wikipedia.org/wiki/Gamma_function)

Basic stats of the gamma distribution
mean = b c
variance = b^2 c

generation method comes from
http://en.wikipedia.org/wiki/Gamma_distribution#Generating_gamma-distributed_random_variables
notation: theta = b
k = c
the algorithm exploits several properties of the gamma
(1) Gamma(b,1) ~ Exp(b) (an exponential random variable)
(2) sum_{i=1}^{n} Gamma(b,c_i) ~ Gamma(b,c) where c=sum_{i=1}^{n} c_i
plus acceptance-rejectance sampling

引用格式

Matthew Roughan (2024). rand_gamma (https://www.mathworks.com/matlabcentral/fileexchange/30966-rand_gamma), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2007b
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Gamma Functions 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.0.0.0