4.44444

4.4 | 9 ratings Rate this file 365 downloads (last 30 days) File Size: 37.52 KB File ID: #10676

Circular Statistics Toolbox (Directional Statistics)

by Philipp Berens

 

08 Apr 2006 (Updated 05 Nov 2009)

Code covered by BSD License  

Compute descriptive and inferential statistics for circular or directional data.

Editor's Notes:

This file was selected as MATLAB Central Pick of the Week

Download Now | Watch this File

File Information
Description

CircStat for Matlab
=======================

Toolbox for circular statistics with Matlab.

Authors: Philipp Berens & Marc J. Velasco
Email: berens@tuebingen.mpg.de
Homepage: http://www.kyb.tuebingen.mpg.de/~berens/circStat.html

Contributors:
Tal Krasovsky

Reference:
P. Berens, CircStat: A Matlab Toolbox for Circular Statistics, Journal of Statistical Software, Volume 31, Issue 10, 2009
http://www.jstatsoft.org/v31/i10

Please cite this paper when the provided code is used. See licensing terms for details.

Contents:
circ_r Resultant vector length
circ_mean Mean direction of a sample of circular data
circ_axial Mean direction for axial data
circ_median Median direction of a sample of circular data
circ_std Dispersion around the mean direction (std, mardia)
circ_var Circular variance
circ_skewness Circular skewness
circ_kurtosis Circular kurtosis
circ_moment Circular p-th moment
circ_dist Distances around a circle
circ_dist2 Pairwise distances around a circle
circ_confmean Confidence intervals for mean direction
circ_stats Summary statistics

circ_rtest Rayleigh's test for nonuniformity
circ_otest Hodges-Ajne test (omnibus test) for nonuniformity
circ_raotest Rao's spacing test for nonuniformity
circ_vtest V-Test for nonuniformity with known mean direction
circ_medtest Test for median angle
circ_mtest One-sample test for specified mean direction
circ_wwtest Multi-sample test for equal means, one-factor ANOVA
circ_hktest Two-factor ANOVA
circ_ktest Test for equal concentration parameter
circ_symtest Test for symmetry around median angle
circ_kuipertest Test whether two distributions are identical (like KS test)

circ_corrcc Circular-circular correlation coefficient
circ_corrcl Circular-linear correlation coefficient

circ_kappa Compute concentration parameter of a vm distribution

circ_plot Visualization for circular data
circ_clust Simple clustering for circular data
circ_samplecdf Evaluate CDF of a sample of angles

rad2ang Convert radian to angular values
ang2rad Convert angular to radian values

All functions take arguments in radians (expect for ang2rad). For a detailed description of arguments and outputs consult the help text in the files.

References:
- E. Batschelet, Circular Statistics in Biology, Academic Press, 1981
- N.I. Fisher, Statistical analysis of circular data, Cambridge University Press, 1996
- S.R. Jammalamadaka et al., Topics in circular statistics, World Scientific, 2001
- J.H. Zar, Biostatistical Analysis, Prentice Hall, 1999

The implementation follows in most cases 'Biostatistical Analysis' and all referenced equations and tables are taken from this book, if not otherwise noted. In some cases, the other two books were preferred for implementation was more straightforward for solutions presented there.

If you have suggestions, bugs or feature requests or want to contribute code, please email us.

Disclaimer:
All functions in this toolbox were implemented with care and tested on the examples presented in 'Biostatistical Analysis' were possible. Nevertheless, they may contain errors or bugs, which may affect the outcome of your analysis. We do not take responsibility for any harm coming from using this toolbox, neither if it is caused by errors in the software nor if it is caused by its improper application. Please email us any bugs you find.

By Philipp Berens and Marc J. Velasco, 2009
berens@tuebingen.mpg.de , velasco@ccs.fau.edu - www.kyb.mpg.de/~berens/circStat.html
Distributed under Open Source BSD License

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
Circular Cross Correlation

Required Products Statistics Toolbox
MATLAB release MATLAB 7.5 (R2007b)
Zip File Content  
Other Files
circ_ang2rad.m,
circ_axial.m,
circ_axialmean.m,
circ_clust.m,
circ_cmtest.m,
circ_confmean.m,
circ_corrcc.m,
circ_corrcl.m,
circ_dist.m,
circ_dist2.m,
circ_hktest.m,
circ_kappa.m,
circ_ktest.m,
circ_kuipertest.m,
circ_kurtosis.m,
circ_mean.m,
circ_median.m,
circ_medtest.m,
circ_moment.m,
circ_mtest.m,
circ_otest.m,
circ_plot.m,
circ_r.m,
circ_rad2ang.m,
circ_raotest.m,
circ_rtest.m,
circ_samplecdf.m,
circ_skewness.m,
circ_stats.m,
circ_std.m,
circ_symtest.m,
circ_var.m,
circ_vmpar.m,
circ_vmpdf.m,
circ_vmrnd.m,
circ_vtest.m,
circ_wwtest.m,
Contents.m,
kuipertable.mat,
license.txt,
readme.txt
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (18)
29 Jan 2007 sanjay sane

thanks.

18 May 2007 Sooho Park

Exactly what I needed

08 Oct 2008 Lyle Muller

Would include skewness and kurtosis!

15 Oct 2008 Adrian Bartlett

I believe I have found an error in one of your functions:
circ_rtest.m
Line 51: z = R^2 / n;
should be
Line 51: z = R^2 * n;

15 Oct 2008 Adrian B

I take that back -- guilty of confusing 'r' and 'R'

19 Feb 2009 Lorenzo Guerrasio

I wish I saw it before :)
Very nicely done.

19 Feb 2009 Lorenzo Guerrasio

PS:
I think there is an error in the circ_dist function

I think this

r = angle(repmat(exp(1i*x(:)'),length(y),1) ...
       ./ repmat(exp(1i*y(:)),1,length(x)));

Let me know if it's correct

30 Apr 2009 Richard Heitz

this is a great toolbox

29 Jun 2009 Tal Krasovsky

Excellent toolbox, helped me a lot. Greatly appreciated!

01 Jul 2009 Richard Courtemanche

This is a great submission, filling an obvious gap in the statistical world out there. Easy to use, well done, and the author provides great feedback.

Great!

23 Sep 2009 Richard Heitz

Sorry, but I think circ_var returns s = (1-r) when it should be s = 2*(1-r).

for this reason, circ_std and circ_var will not agree

29 Sep 2009 Philipp Berens

Both definitions are around... I will optionally add computing both with the next update.

06 Oct 2009 Flurin Honegger

Good work! So far it helped me a lot. But there are some
errors arround!

1.) function circ_hktest

Line 55 found -> qm = zeros(p,1); qr = qm; qn = pm;
   corrected? -> qm = zeros(p,1); qr = qm; qn = qm;

Line 94 found -> eff_2 = sum(qr.^2 ./ sum(cn,2)) - tr.^2/n;
   corrected? -> eff_2 = sum(qr.^2 ./ sum(cn,1)') - tr.^2/n;

Line 107 found -> beta = 1/(1-1/(5*kk)-1/(10*(kk^2)));
       comment -> beta overloads the beta function (help beta)
                  An other name like betaF should be used

Line 144 found -> F1 = beta * ms_1 / ms_r;
       comment -> if inter is set to 0/false beta is not defined!
       
       
2.) function circ_std

The documentation in the paper

  In CircStat , theangular deviation is computed as
  >>s=circ_std(alpha);
  and the circular standard deviation as
  >>s0=circ_std(alpha,[],[],'mardia');
  
does not fit with neither - paper and Matlab Central - implementation.

12 Oct 2009 Philipp Berens

Dear Florin,

thanks for the error report.

With regards to 1: Fixed all bugs. I tested the output on the example in Harrison & Kanji.

With regards to 2: This is unfortunate. The current (and more recent) toolbox version returns both, angular deviation and circular standard deviation as first and second return argument.

Appreciate your feedback,

Philipp

17 Oct 2009 Shiquan Wang

This is great work! Thanks.

30 Oct 2009 Shiquan Wang

bug report:
function stats = circ_stats(alpha, w, d)
line50:stats.std_mardia = circ_std(alpha,w,d,'mardia');
the function circ_std(alpha, w, d) doesn't accept parameter 'mardia'.

05 Nov 2009 omzaz

Encountering same issue as Shiquan

05 Nov 2009 Philipp Berens

Issue is fixed in the upload of 11/5/09.

Please login to add a comment or rating.
Updates
01 Jul 2009

Changed licensing

20 Jul 2009

A number of small bug fixes.

21 Sep 2009

Added reference.

Removed some bugs.

Added new, more complicated tests (ANOVA like testing).

23 Sep 2009

Updated reference for paper

09 Oct 2009

Two new tests

14 Oct 2009

Bug fix.

26 Oct 2009

Bug fix in circ_dist and circ_clust.

04 Nov 2009

Bug fix in circ_skewness and circ_kurtosis. Thanks to Shiquan Wang.

05 Nov 2009

Bug fix in circ_stats.

Tag Activity for this File
Tag Applied By Date/Time
statistics Philipp Berens 22 Oct 2008 08:21:43
probability Philipp Berens 22 Oct 2008 08:21:43
circular statistic Philipp Berens 22 Oct 2008 08:21:43
rayleigh Philipp Berens 22 Oct 2008 08:21:43
angular Philipp Berens 22 Oct 2008 08:21:43
ang Philipp Berens 22 Oct 2008 08:21:43
watson Philipp Berens 22 Oct 2008 08:21:43
williams Philipp Berens 22 Oct 2008 08:21:43
circular Philipp Berens 22 Oct 2008 08:21:43
data analysis Philipp Berens 19 Feb 2009 15:27:30
circle Philipp Berens 19 Feb 2009 15:27:30
directional statistics Philipp Berens 19 Feb 2009 15:27:30
anova Philipp Berens 28 Apr 2009 09:56:33
circular statistics Philipp Berens 01 Jul 2009 11:52:02
circle Saurabh Srivastava 30 Sep 2009 03:01:23
potw Shari Freedman 16 Oct 2009 09:35:42
circular statistics Shiquan Wang 17 Oct 2009 09:23:32
directional statistics Shiquan Wang 17 Oct 2009 09:23:35
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com