Home > atmlab > circular > circ_mtest.m

circ_mtest

PURPOSE ^

SYNOPSIS ^

function [h mu ul ll] = circ_mtest(alpha, dir, xi, w, d)

DESCRIPTION ^

 [pval, z] = circ_mtest(alpha, dir, w, d)
   One-Sample test for the mean angle.
   H0: the population has mean dir.
   HA: the population has not mean dir.

   Note: This is the equvivalent to a one-sample t-test with specified
         mean direction.

   Input:
     alpha    sample of angles in radians
     dir   assumed mean direction
     [xi   alpha level of the test]
     [w        number of incidences in case of binned angle data]
     [d    spacing of bin centers for binned data, if supplied 
           correction factor is used to correct for bias in 
           estimation of r, in radians (!)]

   Output:
     h     0 if H0 can not be rejected, 1 otherwise
     mu    mean
     ul    upper (1-xi) confidence level
     ll    lower (1-xi) confidence level

 PHB 7/6/2008

 References:
   Biostatistical Analysis, J. H. Zar

 Circular Statistics Toolbox for Matlab

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

circ_mtest.m

SOURCE CODE ^

0001 function [h mu ul ll] = circ_mtest(alpha, dir, xi, w, d)
0002 %
0003 % [pval, z] = circ_mtest(alpha, dir, w, d)
0004 %   One-Sample test for the mean angle.
0005 %   H0: the population has mean dir.
0006 %   HA: the population has not mean dir.
0007 %
0008 %   Note: This is the equvivalent to a one-sample t-test with specified
0009 %         mean direction.
0010 %
0011 %   Input:
0012 %     alpha    sample of angles in radians
0013 %     dir   assumed mean direction
0014 %     [xi   alpha level of the test]
0015 %     [w        number of incidences in case of binned angle data]
0016 %     [d    spacing of bin centers for binned data, if supplied
0017 %           correction factor is used to correct for bias in
0018 %           estimation of r, in radians (!)]
0019 %
0020 %   Output:
0021 %     h     0 if H0 can not be rejected, 1 otherwise
0022 %     mu    mean
0023 %     ul    upper (1-xi) confidence level
0024 %     ll    lower (1-xi) confidence level
0025 %
0026 % PHB 7/6/2008
0027 %
0028 % References:
0029 %   Biostatistical Analysis, J. H. Zar
0030 %
0031 % Circular Statistics Toolbox for Matlab
0032 
0033 % By Philipp Berens, 2009
0034 % berens@tuebingen.mpg.de - www.kyb.mpg.de/~berens/circStat.html
0035 
0036 if size(alpha,2) > size(alpha,1)
0037     alpha = alpha';
0038 end
0039 
0040 if nargin<3
0041   xi = 0.05;
0042 end
0043 
0044 if nargin<4
0045   % if no specific weighting has been specified
0046   % assume no binning has taken place
0047     w = ones(size(alpha));
0048 else
0049   if size(w,2) > size(w,1)
0050     w = w';
0051   end 
0052   if length(alpha)~=length(w)
0053     error('Input dimensions do not match.')
0054   end
0055 end
0056 
0057 if nargin<5
0058   % per default do not apply correct for binned data
0059   d = 0;
0060 end
0061 
0062 % compute ingredients
0063 mu = circ_mean(alpha,w);
0064 t = circ_confmean(alpha,xi,w,d);
0065 ul = mu + t;
0066 ll = mu - t;
0067 
0068 % compute test via confidence limits (example 27.3)
0069 h = abs(circ_dist2(dir,mu)) > t;

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