F_from_f {sphunif} | R Documentation |
Distribution and quantile functions from angular function
Description
Numerical computation of the distribution function and
the quantile function
for an angular function
in a tangent-normal decomposition.
results from the inversion of
for , where
is a normalizing constant and
is the surface area of
.
Usage
F_from_f(f, p, Gauss = TRUE, N = 320, K = 1000, tol = 1e-06, ...)
F_inv_from_f(f, p, Gauss = TRUE, N = 320, K = 1000, tol = 1e-06, ...)
Arguments
f |
angular function defined on |
p |
integer giving the dimension of the ambient space |
Gauss |
use a Gauss–Legendre quadrature
rule to integrate |
N |
number of points used in the Gauss–Legendre quadrature. Defaults
to |
K |
number of equispaced points on |
tol |
tolerance passed to |
... |
further parameters passed to |
Details
The normalizing constant is such that
. It does not
need to be part of
f
as it is computed internally.
Interpolation is performed by a monotone cubic spline. Gauss = TRUE
yields more accurate results, at expenses of a heavier computation.
If f
yields negative values, these are silently truncated to zero.
Value
A splinefun
object ready to evaluate or
, as specified.
Examples
f <- function(x) rep(1, length(x))
plot(F_from_f(f = f, p = 4, Gauss = TRUE), ylab = "F(x)", xlim = c(-1, 1))
plot(F_from_f(f = f, p = 4, Gauss = FALSE), col = 2, add = TRUE,
xlim = c(-1, 1))
curve(p_proj_unif(x = x, p = 4), col = 3, add = TRUE, n = 300)
plot(F_inv_from_f(f = f, p = 4, Gauss = TRUE), ylab = "F^{-1}(x)")
plot(F_inv_from_f(f = f, p = 4, Gauss = FALSE), col = 2, add = TRUE)
curve(q_proj_unif(u = x, p = 4), col = 3, add = TRUE, n = 300)