------------------------------------------------------------------------------- help forcircmedian-------------------------------------------------------------------------------

Median and mean deviation for circular variables

circmedianvarlist[ifexp] [inrange]

circmedianvarname[ifexp] [inrange] [,by(byvar)]

Description

circmediancalculates the circular median and mean deviation from the median for circular variables with scales between 0 and 360 degrees.Circular data have no natural origin; whatever origin is used is a matter of convention. There is thus no natural ordering of circular data from smallest to largest. This is a blow to the idea of a circular median, but by no means a fatal one. We could measure the difference between two angles clockwise or counterclockwise (anticlockwise); measure both, treating both differences as positive, and record the smaller. Thus the difference between 45 and 55 degrees is min(10,350) = 10; the difference between 350 and 10 degrees is min(20, 340) = 20; or more generally

d(theta,phi) = min(|theta-phi|, 360 - |theta-phi|). Then define the circular median by the fact that it minimisesSUM

d(value, median)or, equivalently,

MEAN

d(value, median),the latter being called here the mean deviation (from the median). In the event of ties in these measures the median is defined as the vector mean of all angles minimising either. See help on circsummarize.

RemarksBatschelet (1981, p.242) uses the notation |

theta,phi| ford(theta,phi) and points out that it is also arccos(cos(theta-phi)). Another scale on which to measure difference is thus 1 - cos(theta-phi).

Options

by()specifies that results are to be shown for each group defined by values ofbyvar. This option is only available if a singlevarnameis specified.

Examples

. circmedian axisasp wallasp

. circmedian axisasp, by(geology)

AuthorNicholas J. Cox, University of Durham, U.K. n.j.cox@durham.ac.uk

ReferencesBatschelet, E. 1981.

Circular statistics in biology.London: Academic Press.

Also seeOn-line: help for circsummarize, circdiff