Home > wafo > wstats > wgumbcdf.m

# wgumbcdf

## PURPOSE

Gumbel cumulative distribution function.

## SYNOPSIS

F = wgumbcdf(x,a,b,trunc)

## DESCRIPTION

``` WGUMBCDF Gumbel cumulative distribution function.

CALL:  F = wgumbcdf(x,a,b,trunc)

F    = Gumbel cdf evaluated at x
a, b  = parameters of the Gumbel distribution.
trunc = 0  regular gumbel distribution (default)
1  truncated gumbel distribution

Gumbel CDF  is given by :
F(x) = exp(-exp(-(x-b)/a))    -inf < x < inf, a>0
or the truncated
F(x) = [exp(-exp(-(x-b)/a))-exp(-exp(b/a))]/(1-exp(-exp(b/a)))
0 < x < inf,  a>0

Example:
x = linspace(-4,6,200);
p1 = wgumbcdf(x,2,0); p2 = wgumbcdf(x,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. nan Not-a-Number.
This function is called by:
 dist2dcdf Joint 2D CDF computed as int F(X1 dist2dfun is an internal function to dist2dcdf dist2dprb. mdist2dcdf Joint 2D CDF due to Plackett mdist2dpdf Joint 2D PDF due to Plackett given as f{x1}*f{x2}*G(x1,x2;Psi). wgumbfit Parameter estimates for Gumbel data.

## SOURCE CODE

```001 function F = wgumbcdf(x,a,b,trunc)
002 %WGUMBCDF Gumbel cumulative distribution function.
003 %
004 % CALL:  F = wgumbcdf(x,a,b,trunc)
005 %
006 %   F    = Gumbel cdf evaluated at x
007 %  a, b  = parameters of the Gumbel distribution.
008 %  trunc = 0  regular gumbel distribution (default)
009 %          1  truncated gumbel distribution
010 %
011 %  Gumbel CDF  is given by :
012 %       F(x) = exp(-exp(-(x-b)/a))    -inf < x < inf, a>0
013 %  or the truncated
014 %       F(x) = [exp(-exp(-(x-b)/a))-exp(-exp(b/a))]/(1-exp(-exp(b/a)))
015 %           0 < x < inf,  a>0
016 %
017 %
018 % Example:
019 %   x = linspace(-4,6,200);
020 %   p1 = wgumbcdf(x,2,0); p2 = wgumbcdf(x,1,1);
021 %   plot(x,p1,x,p2)
022 %
024
025
026
027 %  tested on: matlab 5.2
028 % history
029 % revised pab 8.11.1999
031 %   Per A. Brodtkorb 17.10.98
032 % rewritten ms 19.06.2000
033 % revised pab 25.10.2000
035
036 % Reference:
037 %  Johnson  N.L., Kotz S. and Balakrishnan, N. (1994)
038 %  Continuous Univariate Distributions, Volume 2. Wiley.
039
040
041 error(nargchk(3,4,nargin))
042 if nargin<4|isempty(trunc), trunc=0;end
043
044 [errorcode x a b] = comnsize(x,a,b);
045 if errorcode > 0
046     error('x, a and b must be of common size or scalar.');
047 end
048 F=zeros(size(x));
049 k1 = find(a>0);
050 if any(k1),
051   F(k1)=exp(-exp(-(x(k1) -b(k1))./a(k1)) );
052   if trunc,
053     tmp=exp(-exp(b(k1)./a(k1)));
054     F(k1)=(F(k1)-tmp)./(1-tmp).*(x(k1)>0);
055   end
056 end
057
058 k2=find(a<=0);
059 if any(k2)
060   F(k2)=NaN;
061 end
062
063
064
065```

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