Home > wafo > wstats > wkurtosis.m

wkurtosis

PURPOSE ^

Computes sample kurtosis

SYNOPSIS ^

k = wkurtosis(X,dim)

DESCRIPTION ^

 WKURTOSIS Computes sample kurtosis
 
  CALL:  k = wkurtosis(X,dim);
 
         k = sample kurtosis (fourth central moment divided by squared second)
         X = data vector or matrix
       dim = dimension to sum across. (default 1'st non-singleton 
                                               dimension of X)
 
  Example:  
    R=wgumbrnd(2,2,100,2);
    wkurtosis(R)
 
  See also  wskewness, mean, var

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

001 function k = wkurtosis(X,dim)
002 %WKURTOSIS Computes sample kurtosis
003 %
004 % CALL:  k = wkurtosis(X,dim);
005 %
006 %        k = sample kurtosis (fourth central moment divided by squared second)
007 %        X = data vector or matrix
008 %      dim = dimension to sum across. (default 1'st non-singleton 
009 %                                              dimension of X)
010 %
011 % Example:  
012 %   R=wgumbrnd(2,2,100,2);
013 %   wkurtosis(R)
014 %
015 % See also  wskewness, mean, var
016 
017 % Tested on: Matlab 5.3
018 % History:
019 % revised pab 24.10.2000
020 % - made it more general: accepts any size of X
021 % - added dim, nargchk
022 % added ms 16.06.2000
023 
024 error(nargchk(1,2,nargin))
025 sz = size(X);
026 if nargin<2|isempty(dim)
027   % Use 1'st non-singleton dimension or dimension 1
028   dim = min(find(sz~=1)); 
029   if isempty(dim), dim = 1; end
030 end
031 rsz = ones(size(sz)); rsz(dim)=sz(dim);
032 mu  = mean(X);
033 mu  = repmat(mu,rsz);
034 k   = mean((X-mu).^4,dim)./mean((X-mu).^2,dim).^2;
035 
036 
037 
038 
039 
040 
041 
042

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