The Rayleigh Test of Uniformity

10.4.2 The Rayleigh Test of Uniformity

Let ρ denote the population mean resultant length, i.e., the population concentration, whose sample estimate is r . The null hypothesis, H 0 , for the Rayleigh’s test of uniformity is: ρ = 0 (zero concentration). For circular data the Rayleigh test statistic is:

z=n r 2 =r 2 /n.

Critical values of the sampling distribution of z can be computed using the following approximation (Wilkie D, 1983):

For spherical data, the Rayleigh test statistic is:

z = 3n 2 r = 3r 2 /n.

Using the modified test statistic:

10 Directional Data z * = ( 1 −

1 2 /( 2 n )) z + z /( 10 n ) , 10.19

it can be proven that the distribution of z *

is asymptotically 2 χ with an error

decreasing as 1/n (Mardia KV, Jupp PE, 2000). The Rayleigh test is implemented in MATLAB and R function rayleigh (see Commands 10.5)

Example 10.11

Q: Apply the Rayleigh test to the wind direction WDF data of the Weather dataset and to the measurement data M1 of the Soil Pollution dataset.

A: Denoting by wdf and m1 the matrices for the datasets, the probability values under the null hypothesis are obtained in MATLAB as follows:

» p=rayleigh(wdf) p=

» p=rayleigh(m1) p=

Thus, we accept the null hypothesis of uniformity at the 5% level for the WDF data, and reject it for the soil pollution M1 data (see Figure 10.9).

Figure 10.9. Measurement set M1 (negative gradient of Pb-tetraethyl concen- tration in the soil) of the Soil Pollution dataset.

10.4 Assessing the Distribution of Directional Data 391

Commands 10.5. MATLAB and R functions for computing statistical tests of directional data.

p=rayleigh(a) [u2,uc]=watson(a,f,alphal)

MATLAB [u2,uc]=watsonvmises(a,alphal) [fo,fc,k1,k2]=watswill(a1,a2,alpha) [w,wc]=unifscores(a,alpha) [gw,gc]=watsongw(a,alpha)

R rayleigh(a) unifscores(a,alpha)

Function rayleigh(a) implements the Rayleigh test of uniformity for the data matrix a (circular or spherical data).

Function watson implements the Watson goodness-of-fit test, returning the test statistic u2 and the critical value uc computed for the data vector a (circular data) with theoretical distribution values in

f. Vector a must be previously sorted in ascending order (and f accordingly). The valid values of alphal are 1, 2, 3, 4 and 5 for α = 0.1, 0.05, 0.025, 0.01 and 0.005, respectively.

The watsonvmises function implements the Watson test assessing von Misesness at alphal level. No previous sorting of the circular data a is necessary.

Function watswill implements the Watson-Williams two-sample test for von Mises populations, using samples a1 and a2 (circular or spherical data), at a significance level alpha. The observed test statistic and theoretical value are returned in fo and fc, respectively; k1 and k2 are the estimated concentrations.

Function unifscores implements the uniform scores test at alpha level, returning the observed statistic w and the critical value wc. The first column of input matrix a must contain the circular data of all independent groups; the second column must contain the group codes from 1 through the highest code number.

Function watsongw implements the Watson test of equality of means for independent spherical data samples. The first two columns of input matrix a contain the longitudes and colatitudes. The last column of a contains group codes, starting with 1. The function returns the observed test statistic gw and the critical value

gc at alpha significance value. The R functions behave in the same way as their equivalent MATLAB functions. For instance, Example 10.11 is solved in R with:

> rayleigh(wdf) [1] 0.1906450

> rayleigh(m1) [1] 1.242340e-13

10 Directional Data