unif_cap | R Documentation |
Density, simulation, and associated functions for a uniform
distribution within a spherical cap of angle 0\leq \alpha\leq \pi
about
a direction \boldsymbol{\mu}
on S^{p-1}:=\{\mathbf{x} \in
R^p:||\mathbf{x}||=1\}
, p \geq 2
. The
density at \mathbf{x} \in S^{p-1}
is given by
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(\alpha)
is the projected radius of the spherical cap about
\boldsymbol{\mu}
, \omega_p
is the surface area of
S^{p-1}
, and F_p
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 \tilde{g}(t):=\omega_{p-1} 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)
x |
locations to evaluate the density or distribution. For
|
mu |
the directional mean |
angle |
angle |
p |
integer giving the dimension of the ambient space |
n |
sample size, a positive integer. |
u |
vector of probabilities. |
scaled |
whether to scale the angular function by the normalizing
constant. Defaults to |
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.
Alberto Fernández-de-Marcos and Eduardo García-Portugués.
# 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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.