7.6 Beta Distribution

R script for beta distribution

Dbeta
## function (x, alph, bet) 
## {
##     if (alph <= 0 | bet <= 0) {
##         warning("bad alph, bet for a beta distribution")
##         return(NULL)
##     }
##     if (x < 0 | x > 1) {
##         warning("bad x for a beta distribution")
##         return(NULL)
##     }
##     if (x == 0) 
##         return(0)
##     if (x == 1) 
##         return(1)
##     return(exp((alph - 1) * log(x) + (bet - 1) * log(1 - x) + 
##         gammln(alph + bet) - gammln(alph) - gammln(bet)))
## }
## <bytecode: 0x000001e2a89afa18>
## <environment: namespace:math>
Pbeta
## function (x, alph, bet) 
## {
##     if (alph <= 0 | bet <= 0) {
##         warning("bad alph, bet for a beta distribution")
##         return(NULL)
##     }
##     if (x < 0 | x > 1) {
##         warning("bad x for a beta distribution")
##         return(NULL)
##     }
##     return(betai(alph, bet, x))
## }
## <bytecode: 0x000001e2a8928b50>
## <environment: namespace:math>
Qbeta
## function (p, alph, bet) 
## {
##     if (alph <= 0 | bet <= 0) {
##         warning("bad alph, bet for a beta distribution")
##         return(NULL)
##     }
##     if (p < 0 | p > 1) {
##         warning("bad p for a beta distribution")
##         return(NULL)
##     }
##     return(invbetai(p, alph, bet))
## }
## <bytecode: 0x000001e2a851ac28>
## <environment: namespace:math>