unif_cap function

Uniform spherical cap distribution

Uniform spherical cap distribution

Density, simulation, and associated functions for a uniform distribution within a spherical cap of angle 0απ0\leq \alpha\leq \pi about a direction μ\mu on Sp1:=xRp:x=1S^{p-1}:={x \in R^p:||x||=1}, p2p \geq 2. The density at xSp1x \in S^{p-1} is given by [REMOVE_ME]cp,r1[1r,1](xμ)withcp,r:=ωp[1Fp(1r)],cp,r1[1r,1](xμ)with\quadcp,r:=ωp[1Fp(1r)],[REMOVEME2] c_{p,r} 1_{[1 - r, 1]}(\mathbf{x}' \boldsymbol{\mu}) \quad\mathrm{with}\quad c_{p,r} := \omega_{p}\left[1 - F_p(1 - r)\right],c_{p,r} 1_{[1 - r, 1]}(x' \mu) with \quadc_{p,r}:=\omega_p \left[1 - F_p(1 - r)\right], [REMOVE_ME_2] where r=cos(α)r=\cos(\alpha) is the projected radius of the spherical cap about μ\mu, ωp\omega_p is the surface area of Sp1S^{p-1}, and FpF_p is the projected uniform distribution (see p_proj_unif).

The angular function of the uniform cap distribution is g(t):=1[1r,1](t)g(t):=1_{[1 - r, 1]}(t). The associated projected density is c("tildeg(t):=omegap1\n\\tilde{g}(t):=\\omega_{p-1}\n", "cp,r(1t2)(p3)/21[1r,1](t)c_{p,r} (1 - t^2)^{(p - 3) / 2} 1_{[1 - r, 1]}(t)").

d_unif_cap(x, mu, angle = pi/10) c_unif_cap(p, angle = pi/10) r_unif_cap(n, mu, angle = pi/10) p_proj_unif_cap(x, p, angle = pi/10) q_proj_unif_cap(u, p, angle = pi/10) d_proj_unif_cap(x, p, angle = pi/10, scaled = TRUE) r_proj_unif_cap(n, p, angle = pi/10)

Arguments

  • x: locations to evaluate the density or distribution. For d_unif_cap, positions on Sp1S^{p - 1} given either as a matrix of size c(nx, p) or a vector of length p. Normalized internally if required (with a warning message). For d_unif_proj_cap and p_unif_proj_cap, a vector with values in [1,1][-1, 1].
  • mu: the directional mean μ\mu of the distribution. A unit-norm vector of length p.
  • angle: angle α\alpha defining the spherical cap about μ\mu. A scalar in [0,π][0, \pi]. Defaults to π/10\pi / 10.
  • p: integer giving the dimension of the ambient space RpR^p that contains Sp1S^{p-1}.
  • n: sample size, a positive integer.
  • u: vector of probabilities.
  • scaled: whether to scale the angular function by the normalizing constant. Defaults to TRUE.

Returns

Depending on the function:

  • d_unif_cap: a vector of length nx or 1 with the evaluated density at x.
  • r_unif_cap: a matrix of size c(n, p) with the random sample.
  • c_unif_cap: the normalizing constant.
  • p_proj_unif_cap: a vector of length x with the evaluated distribution function at x.
  • q_proj_unif_cap: a vector of length u with the evaluated quantile function at u.
  • d_proj_unif_cap: a vector of size nx with the evaluated angular function.
  • r_proj_unif_cap: a vector of length n containing simulated values from the cosines density associated to the angular function.

Description

Density, simulation, and associated functions for a uniform distribution within a spherical cap of angle 0απ0\leq \alpha\leq \pi about a direction μ\mu on Sp1:=xRp:x=1S^{p-1}:={x \in R^p:||x||=1}, p2p \geq 2. The density at xSp1x \in S^{p-1} is given by

cp,r1[1r,1](xμ)withcp,r:=ωp[1Fp(1r)],cp,r1[1r,1](xμ)with\quadcp,r:=ωp[1Fp(1r)], c_{p,r} 1_{[1 - r, 1]}(\mathbf{x}' \boldsymbol{\mu}) \quad\mathrm{with}\quad c_{p,r} := \omega_{p}\left[1 - F_p(1 - r)\right],c_{p,r} 1_{[1 - r, 1]}(x' \mu) with \quadc_{p,r}:=\omega_p \left[1 - F_p(1 - r)\right],

where r=cos(α)r=\cos(\alpha) is the projected radius of the spherical cap about μ\mu, ωp\omega_p is the surface area of Sp1S^{p-1}, and FpF_p is the projected uniform distribution (see p_proj_unif).

The angular function of the uniform cap distribution is g(t):=1[1r,1](t)g(t):=1_{[1 - r, 1]}(t). The associated projected density is c("tildeg(t):=omegap1\n\\tilde{g}(t):=\\omega_{p-1}\n", "cp,r(1t2)(p3)/21[1r,1](t)c_{p,r} (1 - t^2)^{(p - 3) / 2} 1_{[1 - r, 1]}(t)").

Examples

# Simulation and density evaluation for p = 2 mu <- c(0, 1) angle <- pi / 5 n <- 1e2 x <- r_unif_cap(n = n, mu = mu, angle = angle) col <- viridisLite::viridis(n) r_noise <- runif(n, 0.95, 1.05) # Perturbation to improve visualization color <- col[rank(d_unif_cap(x = x, mu = mu, angle = angle))] plot(r_noise * x, pch = 16, col = color, xlim = c(-1, 1), ylim = c(-1, 1)) # Simulation and density evaluation for p = 3 mu <- c(0, 0, 1) angle <- pi / 5 x <- r_unif_cap(n = n, mu = mu, angle = angle) color <- col[rank(d_unif_cap(x = x, mu = mu, angle = angle))] scatterplot3d::scatterplot3d(x, size = 5, xlim = c(-1, 1), ylim = c(-1, 1), zlim = c(-1, 1), color = color) # Simulated data from the cosines density n <- 1e3 p <- 3 angle <- pi / 3 hist(r_proj_unif_cap(n = n, p = p, angle = angle), breaks = seq(cos(angle), 1, l = 10), probability = TRUE, main = "Simulated data from proj_unif_cap", xlab = "t", xlim = c(-1, 1)) t <- seq(-1, 1, by = 0.01) lines(t, d_proj_unif_cap(x = t, p = p, angle = angle), col = "red")

Author(s)

Alberto Fernández-de-Marcos and Eduardo García-Portugués.

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