unif_cap {sphunif}R Documentation

Uniform spherical cap distribution

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 μ\boldsymbol{\mu} on Sp1:={xRp:x=1}S^{p-1}:=\{\mathbf{x} \in R^p:||\mathbf{x}||=1\}, p2p \geq 2. The density at xSp1\mathbf{x} \in S^{p-1} is given by

cp,r1[1r,1](xμ)withcp,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],

where r=cos(α)r=\cos(\alpha) is the projected radius of the spherical cap about μ\boldsymbol{\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 g~(t):=ωp1cp,r(1t2)(p3)/21[1r,1](t)\tilde{g}(t):=\omega_{p-1} c_{p,r} (1 - t^2)^{(p - 3) / 2} 1_{[1 - r, 1]}(t).

Usage

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 μ\boldsymbol{\mu} of the distribution. A unit-norm vector of length p.

angle

angle α\alpha defining the spherical cap about μ\boldsymbol{\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.

Value

Depending on the function:

Author(s)

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

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")

[Package sphunif version 1.4.0 Index]