| cosines-signs | R Documentation |
Computation of the cosines and multivariate signs of the
hyperspherical sample
\boldsymbol{X}_1,\ldots,\boldsymbol{X}_n\in \mathcal{S}^{p-1} about a
location \boldsymbol{\theta}\in \mathcal{S}^{p-1}, for
\mathcal{S}^{p-1}:=\{\boldsymbol{x}\in
\mathbb{R}^p:\|\boldsymbol{x}\|=1\} with p\ge 2. The cosines
are defined as
V_i:=\boldsymbol{X}_i'\boldsymbol{\theta},\quad i=1,\ldots,n,
whereas the multivariate signs are the vectors
\boldsymbol{U}_1,\ldots,\boldsymbol{U}_n\in \mathcal{S}^{p-2} defined
as
\boldsymbol{U}_i :=
\boldsymbol{\Gamma}_{\boldsymbol{\theta}}\boldsymbol{X}_i/
\|\boldsymbol{\Gamma}_{\boldsymbol{\theta}}\boldsymbol{X}_i\|,\quad
i=1,\ldots,n.
The projection matrix \boldsymbol{\Gamma}_{\boldsymbol{\theta}} is a
p\times (p-1) semi-orthogonal matrix that satisfies
\boldsymbol{\Gamma}_{\boldsymbol{\theta}}'
\boldsymbol{\Gamma}_{\boldsymbol{\theta}}=\boldsymbol{I}_{p-1}
\quad\mathrm{and}\quad\boldsymbol{\Gamma}_{\boldsymbol{\theta}}
\boldsymbol{\Gamma}_{\boldsymbol{\theta}}'=
\boldsymbol{I}_p-\boldsymbol{\theta}\boldsymbol{\theta}'.
where \boldsymbol{I}_p is the identity matrix of dimension p.
signs(X, theta, Gamma = NULL, check_X = FALSE)
cosines(X, theta, check_X = FALSE)
Gamma_theta(theta, eig = FALSE)
X |
hyperspherical data, a matrix of size |
theta |
a unit-norm vector of length |
Gamma |
output from |
check_X |
whether to check the unit norms on the rows of |
eig |
whether |
Note that the projection matrix
\boldsymbol{\Gamma}_{\boldsymbol{\theta}} is not unique. In
particular, any completion of \boldsymbol{\theta} to an orthonormal
basis
\{\boldsymbol{\theta},\boldsymbol{v}_1,\ldots,\boldsymbol{v}_{p-1}\}
gives a set of p-1 orthonormal p-vectors
\{\boldsymbol{v}_1,\ldots,\boldsymbol{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 \boldsymbol{e}_1=(1,0,\ldots,0),
\{\boldsymbol{e}_2,\ldots,\boldsymbol{e}_p\}, by the rotation matrix
that rotates \boldsymbol{e}_1 to \boldsymbol{\theta}:
\boldsymbol{H}_{\boldsymbol{\theta}}=
(\boldsymbol{\theta}+\boldsymbol{e}_1)
(\boldsymbol{\theta}+\boldsymbol{e}_1)'/(1+\theta_1)-\boldsymbol{I}_p.
If eig = TRUE, then a much more expensive eigendecomposition of
\boldsymbol{\Gamma}_{\boldsymbol{\theta}}
\boldsymbol{\Gamma}_{\boldsymbol{\theta}}'=
\boldsymbol{I}_p-\boldsymbol{\theta}\boldsymbol{\theta}' is performed for
determining \{\boldsymbol{v}_1,\ldots,\boldsymbol{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.
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
\boldsymbol{\Gamma}_{\boldsymbol{\theta}} of size c(p, p - 1).
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. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1080/01621459.2019.1665527")}
tang-norm-decomp, test_rotasym.
# 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)
old_par <- 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))
par(old_par)
# 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)
old_par <- 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))
par(old_par)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.