stats = circ_stats(alpha, w) Computes descriptive statistics for circular data. Input: alpha sample of angles in radians [w weightings 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] Output: stats structure containing descriptive statistics References: Statistical analysis of circular data, N. I. Fisher Topics in circular statistics, S. R. Jammalamadaka et al. Biostatistical Analysis, J. H. Zar Circular Statistics Toolbox for Matlab
0001 function stats = circ_stats(alpha, w, d) 0002 % 0003 % stats = circ_stats(alpha, w) 0004 % Computes descriptive statistics for circular data. 0005 % 0006 % Input: 0007 % alpha sample of angles in radians 0008 % [w weightings in case of binned angle data] 0009 % [d spacing of bin centers for binned data, if supplied 0010 % correction factor is used to correct for bias in 0011 % estimation of r] 0012 % 0013 % Output: 0014 % stats structure containing descriptive statistics 0015 % 0016 % References: 0017 % Statistical analysis of circular data, N. I. Fisher 0018 % Topics in circular statistics, S. R. Jammalamadaka et al. 0019 % Biostatistical Analysis, J. H. Zar 0020 % 0021 % Circular Statistics Toolbox for Matlab 0022 0023 % By Philipp Berens, 2009 0024 % berens@tuebingen.mpg.de 0025 0026 alpha = alpha(:); 0027 if nargin<2 0028 w = ones(size(alpha)); 0029 end 0030 0031 if nargin < 3 0032 d = 0; 0033 end 0034 0035 % mean 0036 stats.mean = circ_mean(alpha,w); 0037 0038 % median 0039 if sum(w)==length(alpha) 0040 if numel(alpha) > 1000 0041 idx = randperm(numel(alpha)); 0042 idx = idx(1:1000); 0043 else 0044 idx = 1:numel(alpha); 0045 end 0046 stats.median = circ_median(alpha(idx)); 0047 else 0048 stats.median = NaN; 0049 end 0050 0051 % variance 0052 stats.var = circ_var(alpha,w,d); 0053 0054 % standard deviation 0055 [stats.std stats.std0] = circ_std(alpha,w,d); 0056 0057 0058 % skewness 0059 [stats.skewness stats.skewness0] = circ_skewness(alpha,w); 0060 0061 % kurtosis 0062 [stats.kurtosis stats.kurtosis0] = circ_kurtosis(alpha,w); 0063 0064 0065 0066