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.

1
0

circ_var.m 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. function [S s] = circ_var(alpha, w, d, dim)
  2. % s = circ_var(alpha, w, d, dim)
  3. % Computes circular variance for circular data
  4. % (equ. 26.17/18, Zar).
  5. %
  6. % Input:
  7. % alpha sample of angles in radians
  8. % [w number of incidences 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. % [dim compute along this dimension, default is 1]
  13. %
  14. % If dim argument is specified, all other optional arguments can be
  15. % left empty: circ_var(alpha, [], [], dim)
  16. %
  17. % Output:
  18. % S circular variance 1-r
  19. % s angular variance 2*(1-r)
  20. %
  21. % PHB 6/7/2008
  22. %
  23. % References:
  24. % Statistical analysis of circular data, N.I. Fisher
  25. % Topics in circular statistics, S.R. Jammalamadaka et al.
  26. % Biostatistical Analysis, J. H. Zar
  27. %
  28. % Circular Statistics Toolbox for Matlab
  29. % By Philipp Berens, 2009
  30. % berens@tuebingen.mpg.de - www.kyb.mpg.de/~berens/circStat.html
  31. if nargin < 4
  32. dim = 1;
  33. end
  34. if nargin < 3 || isempty(d)
  35. % per default do not apply correct for binned data
  36. d = 0;
  37. end
  38. if nargin < 2 || isempty(w)
  39. % if no specific weighting has been specified
  40. % assume no binning has taken place
  41. w = ones(size(alpha));
  42. else
  43. if size(w,2) ~= size(alpha,2) || size(w,1) ~= size(alpha,1)
  44. error('Input dimensions do not match');
  45. end
  46. end
  47. % compute mean resultant vector length
  48. r = circ_r(alpha,w,d,dim);
  49. % apply transformation to var
  50. S = 1 - r;
  51. s = 2 * S;