help for circwwmardia

Wheeler-Watson-Mardia test for circular data

circwwmardia varlist [if exp] [in range] , by(byvar)


circwwmardia carries out a homogeneity test due to Wheeler and Watson (1964) and Mardia (1972) for circular variables in varlist with scales between 0 and 360 degrees. The values of each varname are grouped according to the r (2 or more) distinct values of byvar. The hypothesis under test is that the distributions so defined are identical. The test statistic is based on the circular ranks of the data, 2 * pi * rank / n, where rank varies from 1 to the number of values n.

The W_r statistic can be compared with a chi-square distribution with 2r - 2 degrees of freedom so long as there are 10 or more values in each group. Randomisation is recommended otherwise to get an estimate of the P-value. However, circwwmardia carries out the chi-square calculation regardless and the onus is on the user to identify examples with small group sizes and take appropriate action. A tabulation of group frequencies should help here.

Note that allowing a varlist is a convenience to allow many tests from a single command: the tests are separate and users searching for significant results are urged to consider carefully what they are doing.


This test is called the Mardia-Watson-Wheeler test by Batschelet (1981) and Kanji (1999).


by() indicating grouping is a required option.


. circwwmardia wallasp, by(grade)


Batschelet, E. 1981. Circular statistics in biology. London: Academic Press.

Fisher, N.I. 1993. Statistical analysis of circular data. Cambridge: Cambridge University Press.

Kanji, G.K. 1999. 100 statistical tests. London: Sage.

Mardia, K.V. 1972. A multi-sample uniform scores test on a circle and its parametric competitor. Journal, Royal Statistical Society Series B 34: 102-113.

Wheeler, S. and Watson, G.S. 1964. A distribution-free two-sample test on a circle. Biometrika 51: 256-257.


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


Leora Vegosen found a bug.

Also see