简体   繁体   中英

R - Gamma Cumulative Distribution Function

I want to calculate the Gamma CDF for an array of data that I have. I have calculated the alpha and beta parameters, however I am not sure of how to calculate the CDF in R,(Is there something like Matlab's gamcdf?).

I have seen some people use fitdistr , or pgamma , but I do not understand how to put the alpha and beta values or I do not need them at all?

Thanks.

A gamma distribution is defined by the two parameters, and given those two parameters, you can calculate the cdf for an array of values using pgamma.

# 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)

伽玛CDF

Note that the Gamma has different ways it can be parameterized. Check ?pgamma for specifics to ensure your 2 parameters match.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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