Choose Language Hide Translation Bar

## Support for Circular (Directional) Statistics

I have diurnal data (time-of-day data for a daily recurring process). I'd like to have access to some plots and techniques from the realm of so-called circular (directional) statistics (see Pewsey A, Neuhauser, M Ruxton G. Circular Statistics in R. Oxford, OUP. 2013).

I was thinking that since there is an R package for circular statistics, I could probably access some of these functions by calling R from JSL. But it would be nice to have JMP built-ins. Even just the basic graphics (circular plots, rose diagrams, etc.).

### Defect ID: S1568571

I encountered several books on directional statistics in the Library of Congress online catalog: https://lccn.loc.gov/99033679 - "Directional Statistics" Counter Presents new and up-dated material on both the underlying theory and the practical methodology of directional statistics, helping the reader to utilise and develop the techniques appropriate to their work. The book is divided into three parts. The first part concentrates on statistics on the circle. Topics covered include tests of uniformity, tests of good-of-fit, inference on von Mises distributions and non-parametric methods. The second part considers statistics on spheres of arbitrary dimension, and includes a detailed account of inference on the main distributions on spheres. Recent material on correlation, regression time series, robust techniques, bootstrap methods, density estimation and curve fitting is presented. The third part considers statistics on more general sample spaces, in particular rotation groups, Stiefel manifolds, Grassmann manifolds and complex projective spaces. Shape analysis is considered from the perspective of directional statistics. Written by leading authors in the field, this text will be invaluable not only to researchers in probability and statistics interested in the latest developments in directional statistics, but also to practitioners and researchers in many scientific fields, including astronomy, biology, computer vision, earth sciences and image analysis. https://lccn.loc.gov/72077853 - "Statistics of directional data" https://lccn.loc.gov/2012933773 - "Bayesian methods in structural bioinformatics" The first two books are more general, while the third book happens to contain a section discussing "Directional statistics for biomolecular structure." I hope you find these links useful.

I second this. I just went to try and analyze larval release data and found that I could not do a Watson's or Rayleigh's test. I wonder if there is something similar? https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6060829/

I just want to let you know that there are lots of circular stats packages in Python, and I have been able to create JSL functions that wrap several of the Python circular stats functions and work quite well. Below an example of wrapping the Rayleigh Test function from the Python astropy package. I've also wrapped some circular descriptive stats functions, and working on getting circular bar graphs from Python into JMP.

If you want more details, send me a private message and we can discuss details.

``````Add Custom Functions(
New Custom Function(
"x",
"Rayleigh Test",
Function( {samples, high = 2 * Pi(), low = 0},
{arg, rslt, span},
If( Is List( samples ),
samples = Matrix( samples )
);
samples = Shape( samples, N Col( samples ) * N Row( samples ) );
span = high - low;
samples = 2 * Pi() / span * Modulo( samples - Matrix( low ), span );
arg = Eval Insert(
"\[
from astropy import stats as ast;
import numpy as np;
data = np.array(^samples^)
rslt = ast.circstats.rayleightest(data)
]\"
);
Python Init();
Python Submit( arg );
rslt = Python Get( rslt );
Python Term();
rslt;
)
)

<<Formula Category( "Statistical" ) //
<<Scripting Index Category( "Statistical+" ) //
<<Description( "Returns p-value from Rayleigh test for uniformity of circular data. Small p-values suggest the population is distributed non-uniformly around the circle." ) //
<<Prototype( "x:Rayleigh Test( sample, high, low )" ) //
<<Parameter( {"List", "Matrix"}, "sample" ) //
<<Parameter( "Number", "high" ) //
<<Parameter( "Number", "low" )
);``````

Wow! Thanks so much for doing this. I have used JSL to link up with R to run R scripts, so let me download Astropy and try it out. Since anything involving scripting confuses me, you'll almost surely get a private email from me soon enough!