7.5 Chi-Square Distribution
R script for chi-square distribution
Dchisq
## function (x2, nu)
## {
## if (nu <= 0) {
## warning("bad nu for a Chi-square distribution")
## return(NULL)
## }
## if (x2 <= 0) {
## warning("bad x2 for a Chi-square distribution")
## return(NULL)
## }
## return(exp(-0.5 * (x2 - (nu - 2) * log(x2)) - 0.693147180559945 *
## (0.5 * nu) - gammln(0.5 * nu)))
## }
## <bytecode: 0x000001e2a3fb9b40>
## <environment: namespace:math>
Pchisq
## function (x2, nu)
## {
## if (nu <= 0) {
## warning("bad nu for a Chi-square distribution")
## return(NULL)
## }
## if (x2 <= 0) {
## warning("bad x2 for a Chi-square distribution")
## return(NULL)
## }
## return(gammp(0.5 * nu, 0.5 * x2))
## }
## <bytecode: 0x000001e2a3f53ae0>
## <environment: namespace:math>
Qchisq
## function (p, nu)
## {
## if (nu <= 0) {
## warning("bad nu for a Chi-square distribution")
## return(NULL)
## }
## if (p < 0 | p >= 1) {
## warning("bad p for a Chi-square distribution")
## return(NULL)
## }
## return(2 * invgammp(p, 0.5 * nu))
## }
## <bytecode: 0x000001e2a3eee5d8>
## <environment: namespace:math>