------------------------------------------------------------------------------- help forcircdiff-------------------------------------------------------------------------------

Difference between circular variables

circdifftheta phi[ifexp] [inrange] [,generate(newvar)absolute]

Description

circdiffcalculates the circular difference between two argumentsthetaandphi, and puts it in a new variablenewvar. The difference is the shorter of the two rotations takingphitotheta, increasing azimuth or clockwise being positive.Either or both arguments may be circular variables between 0 and 360 degrees or numeric constants.

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

theta,phi| for the absolute value of this difference and points out that it is also arccos(cos(theta-phi)). Another scale on which to measure difference is thus 1 - cos(theta-phi). Yet another is chord length 2 * sin((theta-phi) / 2). The latter two scales both yield results which are 0 whentheta=phiand 2 whenthetaandphiare 180 degrees apart, but results coincide only at those two endpoints.

Options

generate()specifies the name of the new variable and is not optional.

absolutespecifies thatnewvarshould contain absolute values. By defaultnewvaris signed.

Examples

. circdiff axisasp wallasp, gen(diffasp)

. circdiff axisasp 48.25

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 circcentre