Scheduled service maintenance on November 22


On Friday, November 22, 2024, between 06:00 CET and 18:00 CET, GIN services will undergo planned maintenance. Extended service interruptions should be expected. We will try to keep downtimes to a minimum, but recommend that users avoid critical tasks, large data uploads, or DOI requests during this time.

We apologize for any inconvenience.

circ_stats.m 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. function stats = circ_stats(alpha, w, d)
  2. %
  3. % stats = circ_stats(alpha, w)
  4. % Computes descriptive statistics for circular data.
  5. %
  6. % Input:
  7. % alpha sample of angles in radians
  8. % [w weightings in case of binned angle data]
  9. % [d spacing of bin centers for binned data, if supplied
  10. % correction factor is used to correct for bias in
  11. % estimation of r]
  12. %
  13. % Output:
  14. % stats structure containing descriptive statistics
  15. %
  16. % References:
  17. % Statistical analysis of circular data, N. I. Fisher
  18. % Topics in circular statistics, S. R. Jammalamadaka et al.
  19. % Biostatistical Analysis, J. H. Zar
  20. %
  21. % Circular Statistics Toolbox for Matlab
  22. % By Philipp Berens, 2009
  23. % berens@tuebingen.mpg.de
  24. alpha = alpha(:);
  25. if nargin<2
  26. w = ones(size(alpha));
  27. end
  28. if nargin < 3
  29. d = 0;
  30. end
  31. % mean
  32. stats.mean = circ_mean(alpha,w);
  33. % median
  34. if sum(w)==length(alpha)
  35. if numel(alpha) > 1000
  36. idx = randperm(numel(alpha));
  37. idx = idx(1:1000);
  38. else
  39. idx = 1:numel(alpha);
  40. end
  41. stats.median = circ_median(alpha(idx));
  42. else
  43. stats.median = NaN;
  44. end
  45. % variance
  46. stats.var = circ_var(alpha,w,d);
  47. % standard deviation
  48. [stats.std stats.std0] = circ_std(alpha,w,d);
  49. % skewness
  50. [stats.skewness stats.skewness0] = circ_skewness(alpha,w);
  51. % kurtosis
  52. [stats.kurtosis stats.kurtosis0] = circ_kurtosis(alpha,w);