Learn R Programming

tectonicr (version 0.4.9)

rayleigh-test: Rayleigh Test of Circular Uniformity

Description

A test to determine whether a sample of circular or directional data is evenly spread out or clustered around a single specific direction. The test assesses the significance of the mean resultant length. rayleight_test_perm() uses permutation to estimate p-values.

Usage

rayleigh_test(x, mu = NULL, axial = TRUE, alpha = 0.05, quiet = FALSE)

rayleigh_test_perm(x, mu = NULL, axial = TRUE, n_perm = 1000L)

Value

a list with the components:

R or C

mean resultant length or the dispersion (if mu is specified). Small values of R (large values of C) will reject uniformity. Negative values of C indicate that vectors point in opposite directions (also lead to rejection).

statistic

test statistic

p.value

significance level of the test statistic

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). In case of axial data, the angles will be doubled for the test.

alpha

Significance level of the test. Valid levels are 0.01, 0.05, and 0.1. This argument may be omitted (NULL, the default), in which case, a range for the p-value will be returned.

quiet

logical. Prints the test's decision.

n_perm

integer. Number of permutations.

Details

Hypotheses

Null Hypothesis \(H_0\): The population is distributed uniformly (randomly) around the circle with no preferred direction.

Alternative Hypothesis \(H_1\): The population is not uniform and has a unimodal (single-peaked) concentration in a preferred direction. When mu is specified), angles are non-uniformly distributed around the specified direction.

Mean Resultant Length (\(\bar{R}\) or R): A value between 0 and 1 that measures how concentrated the data points are.

  • \(\bar{R}\) = 0: The data is completely spread out around the circle

  • \(\bar{R}\) = 1: All data points point in the exact same direction.

p-value The probability of seeing data this clustered purely by chance under the assumption of uniformity.

Interpretation

  • Small p-value (p < 0.05): Reject the null hypothesis. The length of the mean resultant differs significantly from zero, and the angles are not randomly distributed. You have strong evidence that the data points share a significant preferred or mean direction (unimodal clustering).

  • Large p-value (p \(\ge\) 0.05): Fail to reject the null hypothesis. There is not enough evidence to claim a preferred direction, meaning the data looks random or uniform around the circle.

References

Fisher, N. I. (1993) Statistical Analysis of Circular Data, Cambridge University Press.

See Also

mean_resultant_length(), circular_mean()

Other Tests: ar_test(), kuiper_test(), norm_chisq(), watson_test(), watson_two_sample, watson_wheeler_test_perm(), weighted-rayleigh-test

Examples

Run this code
# Example data from Mardia and Jupp (1999), pp. 93
rayleigh_test(homing, axial = FALSE) # Do not reject null hypothesis.
# R = 0.22; stat = 0.497, p = 0.62
rayleigh_test_perm(homing, axial = FALSE)

# Example data from Davis (1986), pp. 316
rayleigh_test(striae, axial = FALSE) # reject null hypothesis
rayleigh_test_perm(striae, axial = FALSE) # reject null hypothesis

rayleigh_test(striae, mu = 105, axial = FALSE) # reject null hypothesis
rayleigh_test_perm(striae, mu = 105, axial = FALSE) # reject null hypothesis

# Example data from Mardia and Jupp (1999), 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

# San Andreas Fault Data:
data(san_andreas)
rayleigh_test(san_andreas$azi) # reject null hypothesis
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
rayleigh_test_perm(sa.por$azi.PoR, mu = 135, n_perm = 1e3) # reject null hypothesis

Run the code above in your browser using DataLab