generalized_gaussian_pdf

Evaluates the generalized Gaussian probability density function (PDF).

Synopsis

#include <imsls.h>

float imsls_f_generalized_gaussian_pdf (float x, float mu, float alpha, float beta)

The type double function is imsls_d_random_generalized_gaussian_pdf.

Required Arguments

float x (Input)
Argument for which the probability density function is to be evaluated. x can be any real number.

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 probability density of the specified generalized Gaussian distribution evaluated at x.

Description

The probability density function of a generalized Gaussian random variable X is

where x, μR, α > 0, β >0, and Γ(a) is the complete gamma function evaluated at a.

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.

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 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.