Skip to contents

Performs a Rayleigh test of uniformity (or randomness), assessing the significance of the mean resultant length. The alternative hypothesis is an unimodal distribution with unknown mean direction and unknown mean resultant length if mu is NULL. If mu is specified the alternative hypothesis is a unimodal distribution with a specified mean direction and unknown mean resultant length.

Usage

rayleigh_test(x, mu = NULL, axial = TRUE)

Arguments

x

numeric vector. Values in degrees

mu

(optional) The specified or known mean direction (in degrees) in alternative hypothesis

axial

logical. Whether the data are axial, i.e. \(\pi\)-periodical (TRUE, the default) or directional, i.e. \(2 \pi\)-periodical (FALSE).

Value

a list with the components:

statistic

mean resultant length

p.value

significance level of the test statistic

p.value2

modified significance level (Cordeiro and Ferrari, 1991)

Details

If statistic > p.value, the null hypothesis is rejected, i.e. the length of the mean resultant differs significantly from zero. If not, randomness (uniform distribution) cannot be excluded.

Note

Although the Rayleigh test is consistent against (non-uniform) von Mises alternatives, it is not consistent against alternatives with p = 0 (in particular, distributions with antipodal symmetry, i.e. axial data). Tests of non-uniformity which are consistent against all alternatives include Kuiper<U+2019>s test (kuiper_test()) and Watson<U+2019>s \(U^2\) test (watson_test()).

References

Mardia and Jupp (2000). Directional Statistics. John Wiley and Sons.

Wilkie (1983): Rayleigh Test for Randomness of Circular Data. Appl. Statist. 32, No. 3, pp. 311-312

Jammalamadaka, S. Rao and Sengupta, A. (2001). Topics in Circular Statistics, Sections 3.3.3 and 3.4.1, World Scientific Press, Singapore.

Examples

# Example data from Mardia and Jupp (2001), pp. 93
pidgeon_homing <- c(55, 60, 65, 95, 100, 110, 260, 275, 285, 295)
rayleigh_test(pidgeon_homing, axial = FALSE)
#> Do Not Reject Null Hypothesis
#> $statistic
#> [1] 0.2228717
#> 
#> $p.value
#> [1] 0.6201354
#> 
#> $p.value2
#> [1] 0.631502
#> 

# Example data from Davis (1986), pp. 316
finland_stria <- c(
  23, 27, 53, 58, 64, 83, 85, 88, 93, 99, 100, 105, 113,
  113, 114, 117, 121, 123, 125, 126, 126, 126, 127, 127, 128, 128, 129, 132,
  132, 132, 134, 135, 137, 144, 145, 145, 146, 153, 155, 155, 155, 157, 163,
  165, 171, 172, 179, 181, 186, 190, 212
)
rayleigh_test(finland_stria, axial = FALSE)
#> Reject Null Hypothesis
#> $statistic
#> [1] 0.8003694
#> 
#> $p.value
#> [1] 6.479397e-15
#> 
#> $p.value2
#> [1] 4.768544e-17
#> 
rayleigh_test(finland_stria, mu = 105, axial = FALSE)
#> Reject Null Hypothesis
#> $statistic
#> [1] 0.7300887
#> 
#> $p.value
#> [1] 2.130845e-13
#> 

# Example data from Mardia and Jupp (2001), pp. 99
atomic_weight <- c(
  rep(0, 12), rep(3.6, 1), rep(36, 6), rep(72, 1),
  rep(108, 2), rep(169.2, 1), rep(324, 1)
)
rayleigh_test(atomic_weight, 0, axial = FALSE)
#> Reject Null Hypothesis
#> $statistic
#> [1] 0.7237434
#> 
#> $p.value
#> [1] 5.348331e-08
#> 

# San Andreas Fault Data:
data(san_andreas)
rayleigh_test(san_andreas$azi)
#> Reject Null Hypothesis
#> $statistic
#> [1] 0.6865633
#> 
#> $p.value
#> [1] 3.166033e-222
#> 
#> $p.value2
#> [1] 3.168593e-248
#> 
data("nuvel1")
PoR <- subset(nuvel1, nuvel1$plate.rot == "na")
sa.por <- PoR_shmax(san_andreas, PoR, "right")
rayleigh_test(sa.por$azi.PoR, mu = 135)
#> Reject Null Hypothesis
#> $statistic
#> [1] 0.7050632
#> 
#> $p.value
#> [1] 6.577035e-233
#>