cosines-signs {rotasym}R Documentation

Cosines and multivariate signs of a hyperspherical sample about a given location

Description

Computation of the cosines and multivariate signs of the hyperspherical sample X1,,XnSp1\mathbf{X}_1,\ldots,\mathbf{X}_n\in S^{p-1} about a location θSp1\boldsymbol{\theta}\in S^{p-1}, for Sp1:={xRp:x=1}S^{p-1}:=\{\mathbf{x}\in R^p:||\mathbf{x}||=1\} with p2p\ge 2. The cosines are defined as

Vi:=Xiθ,i=1,,n,V_i:=\mathbf{X}_i'\boldsymbol{\theta},\quad i=1,\ldots,n,

whereas the multivariate signs are the vectors U1,,UnSp2\mathbf{U}_1,\ldots,\mathbf{U}_n\in S^{p-2} defined as

Ui:=ΓθXi/ΓθXi,i=1,,n.\mathbf{U}_i := \boldsymbol{\Gamma}_{\boldsymbol{\theta}}\mathbf{X}_i/ ||\boldsymbol{\Gamma}_{\boldsymbol{\theta}}\mathbf{X}_i||,\quad i=1,\ldots,n.

The projection matrix Γθ\boldsymbol{\Gamma}_{\boldsymbol{\theta}} is a p×(p1)p\times (p-1) semi-orthogonal matrix that satisfies

ΓθΓθ=Ip1andΓθΓθ=Ipθθ.\boldsymbol{\Gamma}_{\boldsymbol{\theta}}' \boldsymbol{\Gamma}_{\boldsymbol{\theta}}=\mathbf{I}_{p-1} \quad\mathrm{and}\quad\boldsymbol{\Gamma}_{\boldsymbol{\theta}} \boldsymbol{\Gamma}_{\boldsymbol{\theta}}'= \mathbf{I}_p-\boldsymbol{\theta}\boldsymbol{\theta}'.

where Ip\mathbf{I}_p is the identity matrix of dimension pp.

Usage

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 Γθ\boldsymbol{\Gamma}_{\boldsymbol{\theta}} is to be found using an eigendecomposition of Ipθθ\mathbf{I}_p-\boldsymbol{\theta}\boldsymbol{\theta}' (inefficient). Defaults to FALSE.

Details

Note that the projection matrix Γθ\boldsymbol{\Gamma}_{\boldsymbol{\theta}} is not unique. In particular, any completion of θ\boldsymbol{\theta} to an orthonormal basis {θ,v1,,vp1}\{\boldsymbol{\theta},\mathbf{v}_1,\ldots,\mathbf{v}_{p-1}\} gives a set of p1p-1 orthonormal pp-vectors {v1,,vp1}\{\mathbf{v}_1,\ldots,\mathbf{v}_{p-1}\} that conform the columns of Γθ\boldsymbol{\Gamma}_{\boldsymbol{\theta}}. If eig = FALSE, this approach is employed by rotating the canonical completion of e1=(1,0,,0)\mathbf{e}_1=(1,0,\ldots,0), {e2,,ep}\{\mathbf{e}_2,\ldots,\mathbf{e}_p\}, by the rotation matrix that rotates e1\mathbf{e}_1 to θ\boldsymbol{\theta}:

Hθ=(θ+e1)(θ+e1)/(1+θ1)Ip.\mathbf{H}_{\boldsymbol{\theta}}= (\boldsymbol{\theta}+\mathbf{e}_1)(\boldsymbol{\theta}+\mathbf{e}_1)'/ (1+\theta_1)-\mathbf{I}_p.

If eig = TRUE, then a much more expensive eigendecomposition of ΓθΓθ=Ipθθ\boldsymbol{\Gamma}_{\boldsymbol{\theta}} \boldsymbol{\Gamma}_{\boldsymbol{\theta}}'= \mathbf{I}_p-\boldsymbol{\theta}\boldsymbol{\theta}' is performed for determining {v1,,vp1}\{\mathbf{v}_1,\ldots,\mathbf{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:

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

# 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[1]),
     ylab = expression(x[2]))
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[1]),
     ylab = expression(x[2]))
hist(cosines(X = X, theta = theta), prob = TRUE, main = "Cosines",
     xlab = expression(x * "'" * theta))

[Package rotasym version 1.1.5 Index]