R - Gamma累积分布函数

时间:2018-05-11 21:07:04

标签: r statistics cdf gamma-distribution

我想为我拥有的数据数据计算Gamma CDF。我已经计算了alpha和beta参数,但是我不知道如何计算R中的CDF,(有没有像Matlab这样的gamcdf?)。

我看到有些人使用fitdistrpgamma,但我不明白如何设置alpha和beta值,或者我根本不需要它们?

感谢。

1 个答案:

答案 0 :(得分:5)

伽马分布由两个参数定义,给定这两个参数,您可以使用pgamma计算值数组的cdf。

# Let's make a vector
x = seq(0, 3, .01)
# Now define the parameters of your gamma distribution
shape = 1
rate = 2
# Now calculate points on the cdf
cdf = pgamma(x, shape, rate)
# Shown plotted here
plot(x,cdf)

Gamma CDF

请注意,Gamma具有不同的参数化方式。检查?pgamma以了解具体信息,以确保您的2个参数匹配。