# cosines-signs: Cosines and multivariate signs of a hyperspherical sample... In rotasym: Tests for Rotational Symmetry on the Hypersphere

## Description

Computation of the cosines and multivariate signs of the hyperspherical sample X_1, …, X_n \in S^{p-1} about a location θ \in S^{p-1}, for S^{p-1} := {x\in R^p : ||x|| = 1} with p≥ 2. The cosines are defined as

V_i := X_i'θ, i = 1, …, n,

whereas the multivariate signs are the vectors U_1, …, U_n \in S^{p-2} defined as

U_i := Γ_θ X_i / ||Γ_θ X_i||, i = 1, …, n.

The projection matrix Γ_θ is a p x (p-1) semi-orthogonal matrix that satisfies

Γ_θ'Γ_θ = I_{p-1} and Γ_θΓ_θ' = I_p - θθ',

where I_p is the identity matrix of dimension p.

## Usage

 1 2 3 4 5 signs(X, theta, Gamma = NULL, check_X = FALSE) cosines(X, theta, check_X = FALSE) Gamma_theta(theta, eig = FALSE) 

## Arguments

 X hyperspherical data, a matrix of size c(n, p) with unit-norm rows. NAs are allowed. theta a unit-norm vector of length p. Normalized internally if it does not have unit norm (with a warning message). Gamma output from Gamma_theta(theta = theta). If NULL (default), it is computed internally. check_X whether to check the unit norms on the rows of X. Defaults to FALSE for performance reasons. eig whether Γ_θ is to be found using an eigendecomposition of I_p - θθ' (inefficient). Defaults to FALSE.

## Details

Note that the projection matrix Γ_θ is not unique. In particular, any completion of θ to an orthonormal basis {θ, v_1, …, v_{p-1}} gives a set of p-1 orthonormal p-vectors {v_1, …, v_{p-1}} that conform the columns of Γ_θ. If eig = FALSE, this approach is employed by rotating the canonical completion of e_1=(1, 0, …, 0), {e_1, …, e_p}, by the rotation matrix that rotates e_1 to θ:

H_θ = (θ + e_1)(θ + e_1)' / (1 + θ_1) - I_p.

If eig = TRUE, then a much more expensive eigendecomposition of Γ_θΓ_θ' = I_p - θθ' is performed for determining {v_1, …, v_{p-1}}.

If signs and cosines are called with X without unit norms in the rows, then the results will be spurious. Setting check_X = TRUE prevents this from happening.

## Value

Depending on the function:

• cosines: a vector of length n with the cosines of X.

• signs: a matrix of size c(n, p - 1) with the multivariate signs of X.

• Gamma_theta: a projection matrix Γ_θ of size c(p, p - 1).

## Author(s)

Eduardo García-Portugués, Davy Paindaveine, and Thomas Verdebout.

## References

García-Portugués, E., Paindaveine, D., Verdebout, T. (2020) On optimal tests for rotational symmetry against new classes of hyperspherical distributions. Journal of the American Statistical Association, 115(532):1873–1887. doi: 10.1080/01621459.2019.1665527

## Examples

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 # Gamma_theta theta <- c(0, 1) Gamma_theta(theta = theta) # Signs and cosines for p = 2 L <- rbind(c(1, 0.5), c(0.5, 1)) X <- r_ACG(n = 1e3, Lambda = L) par(mfrow = c(1, 2)) plot(signs(X = X, theta = theta), main = "Signs", xlab = expression(x), ylab = expression(x)) hist(cosines(X = X, theta = theta), prob = TRUE, main = "Cosines", xlab = expression(x * "'" * theta)) # Signs and cosines for p = 3 L <- rbind(c(2, 0.25, 0.25), c(0.25, 0.5, 0.25), c(0.25, 0.25, 0.5)) X <- r_ACG(n = 1e3, Lambda = L) par(mfrow = c(1, 2)) theta <- c(0, 1, 0) plot(signs(X = X, theta = theta), main = "Signs", xlab = expression(x), ylab = expression(x)) hist(cosines(X = X, theta = theta), prob = TRUE, main = "Cosines", xlab = expression(x * "'" * theta)) 

rotasym documentation built on Oct. 18, 2021, 5:09 p.m.