normal.quantile
normal.quantile, function
def pure normal.quantile(mu: number, sigma: number, p: number): number
Returns the quantile of probability p for the normal distribution with mean
mu and standard deviation sigma.
mu: the mean of the normal distribution.sigma: the standard deviation of the normal distribution, which must be non-negative.p: the cumulative probability, which must be strictly between 0 and 1.
Examples
table T = with
[| as Mu, as Sigma, as P |]
[| 0, 1, 0.15865526 |]
[| 0, 1, 0.8413447 |]
[| 10, 2, 0.8413447 |]
[| 10, 0, 0.25 |]
show table "normal.quantile" with
T.Mu
T.Sigma
T.P
normal.quantile(T.Mu, T.Sigma, T.P) as "Quantile"
This outputs the following table:
| Mu | Sigma | P | Quantile |
|---|---|---|---|
| 0 | 1 | 0.15865526 | -1 |
| 0 | 1 | 0.8413447 | 0.9999999 |
| 10 | 2 | 0.8413447 | 12 |
| 10 | 0 | 0.25 | 10 |
Remarks
When sigma is zero, normal.quantile(mu, 0, p) always returns mu for any
valid p.
For sigma > 0, normal.quantile is the inverse of normal.cdf
up to numerical precision.
Errors
Calling normal.quantile with a negative sigma results in an error message:
’normal.quantile()’: sigma must be non-negative, but found -1.
Calling normal.quantile with p <= 0 or p >= 1 results in an error
message:
’normal.quantile(mu,sigma,p)’ : invalid value 1 for p, should be in ]0, 1[.