generalized_gaussian_inverse_cdf
Evaluates the inverse cumulative distribution function (CDF) of the generalized Gaussian distribution.
Synopsis
#include <imsls.h>
float imsls_f_generalized_gaussian_inverse_cdf (float p, float mu, float alpha, float beta)
The type double function is imsls_d_generalized_gaussian_inverse_cdf.
Required Arguments
float p (Input)
Argument for which the inverse cdf is to be evaluated. p must be in the open interval, (0,1).
float mu (Input)
Location parameter of the generalized Gaussian distribution. mu can be any real number.
float alpha (Input)
The scale parameter. alpha must be positive.
float beta (Input)
The shape parameter. beta must be positive.
Return Value
The quantile x satisfying F(x) = p where p is a probability and F is the generalized Gaussian CDF with the specified parameters.
Description
The generalized Gaussian distribution GGD is a generalization of the Gaussian normal distribution. With β = 2, the GGD(μ, α, β) is equivalent to the normal distribution N(µ,σ) with mean μ=μ, and variance . The shape parameter β allows for distributions with heavier (0 < β < 2) or lighter (β >2) tails than the bell-shaped curve of the normal distribution.
The inverse cumulative distribution or quantile function is the function Q(p) =F-1 (F(x)) = x, where x satisfies
For the generalized Gaussian distribution, with μ ∈R, α> 0, β>0, the CDF is
where Γ(a), γ(a, b) are the complete and incomplete gamma functions, respectively.
Solving for x in F(x; μ, α, β)=p, it can be shown that the solution is
where g-1 (a, u) is the inverse gamma cumulative distribution function with shape parameter evaluated at u.
Example
This example illustrates calling the generalized Gaussian pdf, cdf, and inverse cdf with mu = 0, alpha = 5, beta = 3.
#include <imsls.h>
#include <stdio.h>
int main()
{
int i;
float mu = 0.0, alpha = 5.0, beta = 3.0;
float x[] = {-10.0, -5.0, -1.0, 0.0, 1.0, 5.0, 10.0};
float pdf, cdf, quantile;
printf("mu: %4.1f\n", mu);
printf("alpha: %4.1f\n", alpha);
printf("beta: %4.1f\n\n", beta);
printf(" x pdf cdf quantile \n");
for (i = 0; i < 7; i++) {
pdf = imsls_f_generalized_gaussian_pdf(x[i], mu, alpha, beta);
cdf = imsls_f_generalized_gaussian_cdf(x[i], mu, alpha, beta);
quantile = imsls_f_generalized_gaussian_inverse_cdf(cdf, mu, alpha, beta);
printf(" %10.1f %12.8f %12.8f %10.4f \n", x[i], pdf, cdf, quantile);
}
}
Output
mu: 0.0
alpha: 5.0
beta: 3.0
x pdf cdf quantile
-10.0 0.00003757 0.00001456 -10.0000
-5.0 0.04119685 0.04785571 -5.0000
-1.0 0.11109235 0.38823881 -1.0000
0.0 0.11198465 0.50000000 0.0000
1.0 0.11109235 0.61176119 1.0000
5.0 0.04119685 0.95214429 5.0000
10.0 0.00003757 0.99998544 10.0000
Warning Errors
IMSLS_SHAPE_TOO_LARGE |
The shape parameter "beta" = # is too large. The uniform limiting distribution is used. |
IMSLS_INFINITE_RESULT |
The probability "p" = #. The function returns #. |
IMSLS_P_ZERO_OR_ONE |
The arguments "p" = #,"mu" = #, "alpha" = #, and "beta" = # result in #. |
Fatal Errors
IMSLS_BAD_ARGS |
The arguments "p" = #,"mu" = #, "alpha" = #, and "beta" = # result in NaN's (not a number) in the calculations. The function returns NaN. |