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_vtest.m 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. function [pval v] = circ_vtest(alpha, dir, w, d)
  2. %
  3. % [pval, v] = circ_vtest(alpha, dir, w, d)
  4. % Computes V test for non-uniformity of circular data with a specified
  5. % mean direction dir.
  6. % H0: the population is uniformly distributed around the circle
  7. % HA: the population is not distributed uniformly around the circle but
  8. % has a mean of dir.
  9. %
  10. % Note: Not rejecting H0 may mean that the population is uniformly
  11. % distributed around the circle OR that it has a mode but that this mode
  12. % is not centered at dir.
  13. %
  14. % The V test has more power than the Rayleigh test and is preferred if
  15. % there is reason to believe in a specific mean direction.
  16. %
  17. % Input:
  18. % alpha sample of angles in radians
  19. % dir suspected mean direction
  20. % [w number of incidences in case of binned angle data]
  21. % [d spacing of bin centers for binned data, if supplied
  22. % correction factor is used to correct for bias in
  23. % estimation of r, in radians (!)]
  24. %
  25. % Output:
  26. % pval p-value of V test
  27. % v value of the V statistic
  28. %
  29. % PHB 7/6/2008
  30. %
  31. % References:
  32. % Biostatistical Analysis, J. H. Zar
  33. %
  34. % Circular Statistics Toolbox for Matlab
  35. % By Philipp Berens, 2009
  36. % berens@tuebingen.mpg.de - www.kyb.mpg.de/~berens/circStat.html
  37. if size(alpha,2) > size(alpha,1)
  38. alpha = alpha';
  39. end
  40. if nargin<3
  41. % if no specific weighting has been specified
  42. % assume no binning has taken place
  43. w = ones(size(alpha));
  44. else
  45. if size(w,2) > size(w,1)
  46. w = w';
  47. end
  48. if length(alpha)~=length(w)
  49. error('Input dimensions do not match.')
  50. end
  51. end
  52. if nargin<4
  53. % per default do not apply correct for binned data
  54. d = 0;
  55. end
  56. % compute some ingredients
  57. r = circ_r(alpha,w,d);
  58. mu = circ_mean(alpha,w);
  59. n = sum(w);
  60. % compute Rayleigh's R (equ. 27.1)
  61. R = n * r;
  62. % compute the V statistic (equ. 27.5)
  63. v = R * cos(mu-dir);
  64. % compute u (equ. 27.6)
  65. u = v * sqrt(2/n);
  66. % compute p-value from one tailed normal approximation
  67. pval = 1 - normcdf(u);