Home > atmlab > circular > circ_skewness.m

circ_skewness

PURPOSE ^

[b b0] = circ_skewness(alpha,w,dim)

SYNOPSIS ^

function [b b0] = circ_skewness(alpha, w, dim)

DESCRIPTION ^

 [b b0] = circ_skewness(alpha,w,dim)
   Calculates a measure of angular skewness.

   Input:
     alpha     sample of angles
     [w        weightings in case of binned angle data]
     [dim      statistic computed along this dimension, 1]

     If dim argument is specified, all other optional arguments can be
     left empty: circ_skewness(alpha, [], dim)

   Output:
     b         skewness (from Pewsey)
     b0        alternative skewness measure (from Fisher)

   References:
     Pewsey, Metrika, 2004
     Statistical analysis of circular data, Fisher, p. 34

 Circular Statistics Toolbox for Matlab

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

circ_skewness.m

SOURCE CODE ^

0001 function [b b0] = circ_skewness(alpha, w, dim)
0002 
0003 % [b b0] = circ_skewness(alpha,w,dim)
0004 %   Calculates a measure of angular skewness.
0005 %
0006 %   Input:
0007 %     alpha     sample of angles
0008 %     [w        weightings in case of binned angle data]
0009 %     [dim      statistic computed along this dimension, 1]
0010 %
0011 %     If dim argument is specified, all other optional arguments can be
0012 %     left empty: circ_skewness(alpha, [], dim)
0013 %
0014 %   Output:
0015 %     b         skewness (from Pewsey)
0016 %     b0        alternative skewness measure (from Fisher)
0017 %
0018 %   References:
0019 %     Pewsey, Metrika, 2004
0020 %     Statistical analysis of circular data, Fisher, p. 34
0021 %
0022 % Circular Statistics Toolbox for Matlab
0023 
0024 % By Philipp Berens, 2009
0025 % berens@tuebingen.mpg.de
0026 
0027 if nargin < 3
0028   dim = 1;
0029 end
0030 
0031 if nargin < 2 || isempty(w)
0032   % if no specific weighting has been specified
0033   % assume no binning has taken place
0034     w = ones(size(alpha));
0035 else
0036   if size(w,2) ~= size(alpha,2) || size(w,1) ~= size(alpha,1) 
0037     error('Input dimensions do not match');
0038   end 
0039 end
0040 
0041 
0042 % compute neccessary values
0043 R = circ_r(alpha,w,[],dim);
0044 theta = circ_mean(alpha,w,dim);
0045 [foo rho2 mu2] = circ_moment(alpha,w,2,true,dim);
0046 
0047 % compute skewness
0048 theta2 = repmat(theta, size(alpha)./size(theta));
0049 b = sum(w.*(sin(2*(circ_dist(alpha,theta2)))),dim)./sum(w,dim);
0050 b0 = rho2.*sin(circ_dist(mu2,2*theta))./(1-R).^(3/2);    % (formula 2.29)
0051 
0052

Generated on Mon 15-Sep-2014 13:31:28 by m2html © 2005