F_from_f function

Distribution and quantile functions from angular function

Distribution and quantile functions from angular function

Numerical computation of the distribution function FF and the quantile function F1F^{-1} for an angular function

ff in a tangent-normal decomposition . F1(x)F^{-1}(x) results from the inversion of [REMOVE_ME]F(x)=1xωp1cff(z)(1z2)(p3)/2dzF(x)=1xωp1cff(z)(1z2)(p3)/2dz[REMOVEME2] F(x) = \int_{-1}^x \omega_{p - 1}c_f f(z) (1 - z^2)^{(p - 3) / 2}\,\mathrm{d}zF(x) = \int_{-1}^x \omega_{p - 1}c_f f(z)(1 - z^2)^{(p - 3) / 2} dz [REMOVE_ME_2]

for x[1,1]x\in [-1, 1], where cfc_f is a normalizing constant and ωp1\omega_{p - 1} is the surface area of Sp2S^{p - 2}.

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 [1,1][-1, 1]. Must be vectorized.

  • p: integer giving the dimension of the ambient space RpR^p that contains Sp1S^{p-1}.

  • Gauss: use a Gauss-Legendre quadrature

    rule to integrate ff with N nodes? Otherwise, rely on integrate Defaults to TRUE.

  • N: number of points used in the Gauss--Legendre quadrature. Defaults to 320.

  • K: number of equispaced points on [1,1][-1, 1] used for evaluating F1F^{-1} and then interpolating. Defaults to 1e3.

  • tol: tolerance passed to uniroot for the inversion of FF. Also, passed to integrate's rel.tol and abs.tol if Gauss = FALSE. Defaults to 1e-6.

  • ...: further parameters passed to f.

Returns

A splinefun object ready to evaluate FF or F1F^{-1}, as specified.

Description

Numerical computation of the distribution function FF and the quantile function F1F^{-1} for an angular function

ff in a tangent-normal decomposition . F1(x)F^{-1}(x) results from the inversion of

F(x)=1xωp1cff(z)(1z2)(p3)/2dzF(x)=1xωp1cff(z)(1z2)(p3)/2dz F(x) = \int_{-1}^x \omega_{p - 1}c_f f(z) (1 - z^2)^{(p - 3) / 2}\,\mathrm{d}zF(x) = \int_{-1}^x \omega_{p - 1}c_f f(z)(1 - z^2)^{(p - 3) / 2} dz

for x[1,1]x\in [-1, 1], where cfc_f is a normalizing constant and ωp1\omega_{p - 1} is the surface area of Sp2S^{p - 2}.

Details

The normalizing constant cfc_f is such that F(1)=1F(1) = 1. 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.

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)
  • Maintainer: Eduardo García-Portugués
  • License: GPL-3
  • Last published: 2024-05-24