7.4 Gamma Distribution
R script for gamma distribution
Dgamma
## function (x, alph, bet = 1)
## {
## if (alph <= 0 | bet <= 0) {
## warning("bad alph, bet for a gamma distribution")
## return(NULL)
## }
## if (x <= 0) {
## warning("bad x for a gamma distribution")
## return(NULL)
## }
## return(exp(-bet * x + (alph - 1) * log(x) + alph * log(bet) -
## gammln(alph)))
## }
## <bytecode: 0x000001e2a475f018>
## <environment: namespace:math>
Pgamma
## function (x, alph, bet = 1)
## {
## if (alph <= 0 | bet <= 0) {
## warning("bad alph, bet for a gamma distribution")
## return(NULL)
## }
## if (x <= 0) {
## warning("bad x for a gamma distribution")
## return(NULL)
## }
## return(gammp(alph, bet * x))
## }
## <bytecode: 0x000001e2a45cc680>
## <environment: namespace:math>
Qgamma
## function (p, alph, bet = 1)
## {
## if (alph <= 0 | bet <= 0) {
## warning("bad alph, bet for a gamma distribution")
## return(NULL)
## }
## if (p < 0 | p >= 1) {
## warning("bad p for a gamma distribution")
## return(NULL)
## }
## return(invgammp(p, alph)/bet)
## }
## <bytecode: 0x000001e2a44a7470>
## <environment: namespace:math>