Learn R Programming

tectonicr (version 0.4.9)

watson_two_sample: Watson's Two-Sample Test of Homogeneity

Description

Performs Watson's test for homogeneity on two samples of circular data. watson_two_test_perm() uses permutation to estimate p-values.

Usage

watson_two_test(x, y, alpha = NULL, axial = TRUE, quiet = FALSE)

watson_two_test_perm(x, y, axial = TRUE, n_perm = 1000L, alpha = NULL)

Value

list. Watson's two-sample test of homogeneity is performed, and the results are printed. If alpha is specified and non-zero, the test statistic is printed along with the critical value and decision. If alpha is omitted, the test statistic is printed and a range for the p-value of the test is given.

Arguments

x, y

numeric vectors. Angles in degrees

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.

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.

quiet

logical. Prints the test's decision.

n_perm

integer. Number of permutations

Details

A two-sample Watson's \(U^2\) permutation test determines whether two independent groups of circular data (angles or directions) come from the same underlying distribution.

Hypotheses

Null Hypothesis (\(H_0\)): The two samples come from the same circular distribution (the two groups of angles share a common distribution around the circle).

Alternative Hypothesis (\(H_1\)): The two samples come from different circular distributions (the groups are oriented or dispersed differently around the circle).

Interpretation

The Test Statistic (\(U^2\)) measures the distance between the cumulative distribution functions of the two circular samples. A larger \(U^2\) value means the two sets of angles look more different from each other.

The P-Value represents the probability of getting a U² value as large as (or larger than) your observed value purely by chance, assuming the null hypothesis is true. It is calculated by shuffling the group labels across your data many times to build a reference permutation distribution.

Making a Decision

  • Low p-value (\(p \le \alpha\), usually 0.05): Reject the null hypothesis. Conclude that the two groups have significantly different circular distributions.

  • High p-value (\(p > \alpha\)): Fail to reject the null hypothesis. There is not enough evidence to say the two groups are distributed differently around the circle.

See Also

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

Examples

Run this code
set.seed(20250411)
x1 <- c(35, 45, 50, 55, 60, 70, 85, 95, 105, 120)
x2 <- c(75, 80, 90, 100, 110, 130, 135, 140, 150, 160, 165)
watson_two_test(x1, x2, axial = FALSE)
watson_two_test_perm(x1, x2, axial = FALSE)

data1 <- rvm(n=20, mean = 0, kappa=3)
data2 <- rvm(n=20, mean = 90, kappa=2)
watson_two_test(data1, data2, axial = FALSE)
watson_two_test_perm(data1, data2, axial = FALSE)


# San Andreas Fault Data:
data(san_andreas)
data("nuvel1")
PoR <- subset(nuvel1, nuvel1$plate.rot == "na")
sa.por <- PoR_shmax(san_andreas, PoR, "right")
watson_two_test(sa.por$azi, 135, alpha = 0.05)
watson_two_test_perm(sa.por$azi, rvm(100, 135, 10), alpha = 0.05)

Run the code above in your browser using DataLab