Learn R Programming

tectonicr (version 0.4.10)

weighted-rayleigh-test: Weighted Goodness-of-fit Test for Circular Data

Description

Weighted version of the Rayleigh test (or V0-test) for uniformity against a distribution with a priori expected von Mises concentration. weighted_rayleigh_perm() estimates p-values by Monte Carlo simulation of uniform samples with the same weights.

Usage

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

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

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

Value

a list with the components:

R or C

weighted mean resultant length or, if mu is specified, the weighted mean cosine of the deviations from mu. Large values reject uniformity.

statistic

Test statistic

p.value

significance level of the test statistic

n_eff

effective sample size

weighted_rayleigh_perm() returns a list of class "htest".

Arguments

x

numeric vector. Values in degrees

mu

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

w

numeric vector weights of length length(x). If NULL, the non-weighted Rayleigh test is performed.

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 ranging between 0 and 1.

quiet

logical. Prints the test's decision.

n_perm

integer. Number of simulated uniform samples.

Details

The Null hypothesis is uniformity (randomness). The alternative is a unimodal distribution with the specified mean direction mu (weighted V-test), or with an unknown mean direction if mu is NULL (weighted Rayleigh test). The null hypothesis is rejected if p.value < alpha.

Under the null hypothesis the weighted mean cosine has variance \(\sum w_i^2 / (2 (\sum w_i)^2)\), so the asymptotic tests use the effective sample size \(n_\text{eff} = (\sum w_i)^2 / \sum w_i^2\), which equals \(n\) for equal weights.

See Also

Other One-Sample-Tests: hodges_ajne_test(), kuiper_test(), norm_chisq(), rao_spacing_test(), rayleigh-test, watson_test()

Examples

Run this code
# Load data
data("cpm_models")
data(san_andreas)
PoR <- equivalent_rotation(cpm_models[["NNR-MORVEL56"]], "na", "pa")
sa.por <- PoR_shmax(san_andreas, PoR, "right")
data("iceland")
PoR.ice <- equivalent_rotation(cpm_models[["NNR-MORVEL56"]], "eu", "na")
ice.por <- PoR_shmax(iceland, PoR.ice, "out")
data("tibet")
PoR.tib <- equivalent_rotation(cpm_models[["NNR-MORVEL56"]], "eu", "in")
tibet.por <- PoR_shmax(tibet, PoR.tib, "in")

# GOF test:
weighted_rayleigh(tibet.por$azi.PoR, mu = 90, w = 1 / tibet$unc)
weighted_rayleigh(ice.por$azi.PoR, mu = 0, w = 1 / iceland$unc)
weighted_rayleigh(sa.por$azi.PoR, mu = 135, w = 1 / san_andreas$unc)

weighted_rayleigh_perm(tibet.por$azi.PoR, mu = 90, w = 1 / tibet$unc)
weighted_rayleigh_perm(ice.por$azi.PoR, mu = 0, w = 1 / iceland$unc)
weighted_rayleigh_perm(sa.por$azi.PoR, mu = 135, w = 1 / san_andreas$unc)

Run the code above in your browser using DataLab