Home > wafo > wstats > wgumbtest.m

# wgumbtest

## PURPOSE

Tests whether the shape parameter in a GEV is equal to zero

## SYNOPSIS

p = wgumbtest(x,a)

## DESCRIPTION

``` WGUMBTEST Tests whether the shape parameter in a GEV is equal to zero

CALL:  p = wgumbtest(x,a)

p = p-value in the test
x = the sample
a = significance level (default a=0.05)

The Gumbel distribution (see wgumbcdf) is a GEV distribution (see
wgevcdf) with shape parameter k = 0. To test if a given set of data
is generated by a Gumbel distribution, a test of the hypothesis k = 0
may be based on the PWM  estimator of k. On the null hypothesis k = 0,
the estimator is asymptotically distributed as N(0,0.5633/n) (where  n
is the number of observations).

Example:
x1 = wgevrnd(0.02,2,7.5,50,1);
wgumbtest(x1);
x2 = wgevrnd(0.20,2,7.5,50,1);
wgumbtest(x2);

## CROSS-REFERENCE INFORMATION

This function calls:
 wgevfit Parameter estimates for GEV data wnormcdf Normal cumulative distribution function num2str Convert number to string. (Fast version)
This function is called by:

## SOURCE CODE

```001 function p = wgumbtest(x,a)
002 %WGUMBTEST Tests whether the shape parameter in a GEV is equal to zero
003 %
004 % CALL:  p = wgumbtest(x,a)
005 %
006 %        p = p-value in the test
007 %        x = the sample
008 %        a = significance level (default a=0.05)
009 %
010 % The Gumbel distribution (see wgumbcdf) is a GEV distribution (see
011 % wgevcdf) with shape parameter k = 0. To test if a given set of data
012 % is generated by a Gumbel distribution, a test of the hypothesis k = 0
013 % may be based on the PWM  estimator of k. On the null hypothesis k = 0,
014 % the estimator is asymptotically distributed as N(0,0.5633/n) (where  n
015 % is the number of observations).
016 %
017 % Example:
018 %   x1 = wgevrnd(0.02,2,7.5,50,1);
019 %   wgumbtest(x1);
020 %   x2 = wgevrnd(0.20,2,7.5,50,1);
021 %   wgumbtest(x2);
022 %
024
025 % References
026 %  Hosking, J.R.M, Wallis, J.R. and Wood E.F. (1985)
027 %  Estimation of the generalized extreme-value distribution by the
028 %  method of probability-weighted moments
029 %  Technometrics (27), pp. 251-261
030
031 % Tested on; Matlab 5.3
032 % History:
033 % Revised by jr 31.08.1999
034 % revised ms 15.06.2000
035 % - updated header info
036 % - changed name to wgumbtest (from gumbtest)
037 % - added optional significance level
038 % - added w* to used WAFO-files
039
040 if nargin < 2
041   a=.05;
042 end
043
044 [r] = wgevfit(x,'pwm',[],0);
045
046 z = r(1)*(length(x)/0.5633)^0.5;
047 disp(' ')
048 disp(' Null hypothesis: Parent distribution is GEV with k = 0.')
049 disp(' ')
050 p = 1-wnormcdf(abs(z),0,1);
051 if (p>a),
052   disp(' The null hypothesis cannot be rejected.')
053 else
054   disp([' Reject the null hypothesis with p-value p = ',num2str(p)])
055   if z > 0
056     disp(' in favour of the alternative hypothesis: k > 0.')
057   else
058     disp(' in favour of the alternative hypothesis: k < 0.')
059   end
060 end
061 disp(' ')
062```

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