Home > wafo > wstats > wggamcdf.m

# wggamcdf

## PURPOSE

Generalized Gamma cumulative distribution function

## SYNOPSIS

F = wggamcdf(x,a,b,c);

## DESCRIPTION

``` WGGAMCDF Generalized Gamma cumulative distribution function

CALL:  F = wggamcdf(x,a,b,c);

F = distribution function evaluated at x
a,b,c = parameters

The generalized Gamma distribution is defined by its pdf

f(x;a,b,c)=c*x^(a*c-1)/b^(a*c)*exp(-(x/b)^c)/gamma(a), x>=0, a,b,c>0

Example:
x = linspace(0,7,200);
p1 = wggamcdf(x,1,2,1); p2 = wggamcdf(x,3,1,1);
plot(x,p1,x,p2)```

## CROSS-REFERENCE INFORMATION

This function calls:
 comnsize Check if all input arguments are either scalar or of common size. error Display message and abort function. gammainc Incomplete gamma function. nan Not-a-Number.
This function is called by:
 dist2dfun is an internal function to dist2dcdf dist2dprb. jhsnlpdf Joint (Scf,Hd) PDF for nonlinear waves with a JONSWAP spectra. jhspdf Joint (Scf,Hd) PDF for linear waves with JONSWAP spectra. ohhcdf Marginal wave height, Hd, CDF for Ochi-Hubble spectra. thcdf Marginal wave height, Hd, CDF for Torsethaugen spectra. wggambfit Is an internal routine for wggamfit wggamfit Parameter estimates for Generalized Gamma data.

## SOURCE CODE

```001 function F = wggamcdf(x,a,b,c);
002 %WGGAMCDF Generalized Gamma cumulative distribution function
003 %
004 % CALL:  F = wggamcdf(x,a,b,c);
005 %
006 %        F = distribution function evaluated at x
007 %    a,b,c = parameters
008 %
009 % The generalized Gamma distribution is defined by its pdf
010 %
011 % f(x;a,b,c)=c*x^(a*c-1)/b^(a*c)*exp(-(x/b)^c)/gamma(a), x>=0, a,b,c>0
012 %
013 % Example:
014 %   x = linspace(0,7,200);
015 %   p1 = wggamcdf(x,1,2,1); p2 = wggamcdf(x,3,1,1);
016 %   plot(x,p1,x,p2)
017
018 % Reference: Cohen & Whittle, (1988) "Parameter Estimation in Reliability
019 % and Life Span Models", p. 220 ff, Marcel Dekker.
020
021 % Tested on; Matlab 5.3
022 % History:
023 % revised pab 23.10.2000
024 %  - added comnsize, nargchk+ default values on b c.
026
027
028 error(nargchk(2,4,nargin))
029 if nargin<3|isempty(b),  b=1; end
030 if nargin<4|isempty(c),  c=1; end
031 [errorcode x a b c] = comnsize(x,a,b,c);
032
033 if errorcode > 0
034   error('x, a, b and c must be of common size or scalar.');
035 end
036
037 F = zeros(size(x));
038 ok= ((a >0) & (b> 0) & (c>0));
039
040
041 k=find(x >= 0 & ok);
042 if any(k),
043   F(k)= gammainc((x(k)./b(k)).^c(k),a(k));
044 end
045
046 %   Return NaN if the arguments are outside their respective limits.
047 k3 = find(~ok);
048 if any(k3)
049   tmp = NaN;
050   F(k3) = tmp(ones(size(k3)));
051 end
052
053
054
055
056
057```

Mathematical Statistics
Centre for Mathematical Sciences
Lund University with Lund Institute of Technology

Comments or corrections to the WAFO group

Generated on Thu 06-Oct-2005 02:21:16 for WAFO by m2html © 2003