Density, simulation, and associated functions for a uniform distribution within a spherical cap of angle 0≤α≤π about a direction μ on Sp−1:=x∈Rp:∣∣x∣∣=1, p≥2. The density at x∈Sp−1 is given by [REMOVE_ME]cp,r1[1−r,1](x′μ)withcp,r:=ωp[1−Fp(1−r)],cp,r1[1−r,1](x′μ)with\quadcp,r:=ωp[1−Fp(1−r)],[REMOVEME2] where r=cos(α) is the projected radius of the spherical cap about μ, ωp is the surface area of Sp−1, and Fp is the projected uniform distribution (see p_proj_unif).
The angular function of the uniform cap distribution is g(t):=1[1−r,1](t). The associated projected density is c("tildeg(t):=omegap−1\n", "cp,r(1−t2)(p−3)/21[1−r,1](t)").
x: locations to evaluate the density or distribution. For d_unif_cap, positions on Sp−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].
mu: the directional mean μ of the distribution. A unit-norm vector of length p.
angle: angle α defining the spherical cap about μ. A scalar in [0,π]. Defaults to π/10.
p: integer giving the dimension of the ambient space Rp that contains Sp−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≤α≤π about a direction μ on Sp−1:=x∈Rp:∣∣x∣∣=1, p≥2. The density at x∈Sp−1 is given by
where r=cos(α) is the projected radius of the spherical cap about μ, ωp is the surface area of Sp−1, and Fp is the projected uniform distribution (see p_proj_unif).
The angular function of the uniform cap distribution is g(t):=1[1−r,1](t). The associated projected density is c("tildeg(t):=omegap−1\n", "cp,r(1−t2)(p−3)/21[1−r,1](t)").
Examples
# Simulation and density evaluation for p = 2mu <- c(0,1)angle <- pi /5n <-1e2x <- r_unif_cap(n = n, mu = mu, angle = angle)col <- viridisLite::viridis(n)r_noise <- runif(n,0.95,1.05)# Perturbation to improve visualizationcolor <- 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 = 3mu <- c(0,0,1)angle <- pi /5x <- 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 densityn <-1e3p <-3angle <- pi /3hist(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.