7.2 Normal Distribution
R script for normal distribution
Dnorm
## function (x, mu = 0, sig = 1)
## {
## if (sig <= 0) {
## warning("bad sig for a normal distribution")
## return(NULL)
## }
## return(0.398942280401433/sig * exp(-0.5 * (x - mu) * (x -
## mu)/sig/sig))
## }
## <bytecode: 0x000001e2ac8932b8>
## <environment: namespace:math>
Pnorm
## function (x, mu = 0, sig = 1)
## {
## if (sig <= 0) {
## warning("bad sig for a normal distribution")
## return(NULL)
## }
## return(0.5 * erfc(-0.707106781186548 * (x - mu)/sig))
## }
## <bytecode: 0x000001e2ac776b50>
## <environment: namespace:math>
Qnorm
## function (p, mu = 0, sig = 1)
## {
## if (sig <= 0) {
## warning("bad sig for a normal distribution")
## return(NULL)
## }
## if (p <= 0 | p >= 1) {
## warning("bad p for a normal distribution")
## return(NULL)
## }
## return(-1.4142135623731 * sig * inverfc(2 * p) + mu)
## }
## <bytecode: 0x000001e2ac6c2330>
## <environment: namespace:math>