A_theta_x function

Surface area of the intersection of two hyperspherical caps

Surface area of the intersection of two hyperspherical caps

Computation of [REMOVE_ME]Ax(θij):=1ωpSp11{Xiγx,Xjγx}dγ,Ax(θij):=1ωpSp11Xiγx,Xjγxdγ,[REMOVEME2] A_x(\theta_{ij}) := \frac{1}{\omega_p}\int_{S^{p - 1}} 1_{\{{\bf X}_i'\boldsymbol\gamma \le x,{\bf X}_j'\boldsymbol\gamma \le x\}}\,\mathrm{d}\boldsymbol\gamma,A_x(\theta_{ij}) := \frac{1}{\omega_p} \int_{S^{p - 1}}1_{X_i'\gamma \le x, X_j'\gamma \le x} d\gamma, [REMOVE_ME_2]

where θij:=cos1(XiXj)[0,π]\theta_{ij} := \cos^{-1}(X_i'X_j) \in [0, \pi], x[1,1]x \in [-1, 1], and ωp\omega_{p} is the surface area of Sp1S^{p - 1}. Ax(θij)A_x(\theta_{ij}) is the proportion of surface area of Sp1S^{p - 1} covered by the intersection of two hyperspherical caps centered at XiX_i and XjX_j and with common solid angle πcos1(x)\pi - \cos^{-1}(x).

A_theta_x(theta, x, p, N = 160L, as_matrix = TRUE)

Arguments

  • theta: vector with values in [0,π][0, \pi].
  • x: vector with values in [1,1][-1, 1].
  • p: integer giving the dimension of the ambient space RpR^p that contains Sp1S^{p-1}.
  • N: number of points used in the Gauss-Legendre quadrature . Defaults to 160.
  • as_matrix: return a matrix with the values of Ax(θ)A_x(\theta) on the grid formed by theta and x? If FALSE, Ax(θ)A_x(\theta) is evaluated on theta and x if they equal in size. Defaults to TRUE.

Returns

A matrix of size c(length(theta), length(x)) containing the evaluation of Ax(θ)A_x(\theta) if as_matrix = TRUE. Otherwise, a vector of size c(length(theta) if theta and x equal in size.

Description

Computation of

Ax(θij):=1ωpSp11{Xiγx,Xjγx}dγ,Ax(θij):=1ωpSp11Xiγx,Xjγxdγ, A_x(\theta_{ij}) := \frac{1}{\omega_p}\int_{S^{p - 1}} 1_{\{{\bf X}_i'\boldsymbol\gamma \le x,{\bf X}_j'\boldsymbol\gamma \le x\}}\,\mathrm{d}\boldsymbol\gamma,A_x(\theta_{ij}) := \frac{1}{\omega_p} \int_{S^{p - 1}}1_{X_i'\gamma \le x, X_j'\gamma \le x} d\gamma,

where θij:=cos1(XiXj)[0,π]\theta_{ij} := \cos^{-1}(X_i'X_j) \in [0, \pi], x[1,1]x \in [-1, 1], and ωp\omega_{p} is the surface area of Sp1S^{p - 1}. Ax(θij)A_x(\theta_{ij}) is the proportion of surface area of Sp1S^{p - 1} covered by the intersection of two hyperspherical caps centered at XiX_i and XjX_j and with common solid angle πcos1(x)\pi - \cos^{-1}(x).

Details

See García-Portugués et al. (2023) for more details about the Ax(θ)A_x(\theta) function.

Examples

# Plot A_x(theta) for several dimensions and x's A_lines <- function(x, th = seq(0, pi, l = 200)) { plot(th, A_theta_x(theta = th, x = x, p = 2), type = "l", col = 1, ylim = c(0, 1.25), main = paste("x =", x), ylab = expression(A[x](theta)), xlab = expression(theta), axes = FALSE) axis(1, at = c(0, pi / 4, pi / 2, 3 * pi / 4, pi), labels = expression(0, pi / 4, pi / 2, 3 * pi / 4, pi)) axis(2); box() abline(h = c(0, 1), lty = 2) lines(th, A_theta_x(theta = th, x = x, p = 3), col = 2) lines(th, A_theta_x(theta = th, x = x, p = 4), col = 3) lines(th, A_theta_x(theta = th, x = x, p = 5), col = 4) legend("top", lwd = 2, legend = paste("p =", 2:5), col = 1:4, cex = 0.75, horiz = TRUE) } old_par <- par(mfrow = c(2, 3)) A_lines(x = -0.75) A_lines(x = -0.25) A_lines(x = 0) A_lines(x = 0.25) A_lines(x = 0.5) A_lines(x = 0.75) par(old_par) # As surface of (theta, x) for several dimensions A_surf <- function(p, x = seq(-1, 1, l = 201), th = seq(0, pi, l = 201)) { col <- c("white", viridisLite::viridis(20)) breaks <- c(-1, seq(1e-15, 1, l = 21)) A <- A_theta_x(theta = th, x = x, p = p) image(th, x, A, main = paste("p =", p), col = col, breaks = breaks, xlab = expression(theta), axes = FALSE) axis(1, at = c(0, pi / 4, pi / 2, 3 * pi / 4, pi), labels = expression(0, pi / 4, pi / 2, 3 * pi / 4, pi)) axis(2); box() contour(th, x, A, levels = breaks, add = TRUE) } old_par <- par(mfrow = c(2, 2)) A_surf(p = 2) A_surf(p = 3) A_surf(p = 4) A_surf(p = 5) par(old_par) # No matrix return th <- seq(0, pi, l = 5) x <- seq(-1, 1, l = 5) diag(A_theta_x(theta = th, x = x, p = 2)) A_theta_x(theta = th, x = x, p = 2, as_matrix = FALSE)

References

García-Portugués, E., Navarro-Esteban, P., Cuesta-Albertos, J. A. (2023) On a projection-based class of uniformity tests on the hypersphere. Bernoulli, 29(1):181--204. tools:::Rd_expr_doi("10.3150/21-BEJ1454") .

  • Maintainer: Eduardo García-Portugués
  • License: GPL-3
  • Last published: 2024-05-24