locdev function

Local projected alternatives to uniformity

Local projected alternatives to uniformity

Density and random generation for local projected alternatives to uniformity with densities [REMOVE_ME]fκ,μ(x):=1κωp+κf(xμ)fκ,μ(x)=(1κ)/ωp+κf(xμ)[REMOVEME2] f_{\kappa, \boldsymbol{\mu}}({\bf x}): =\frac{1 - \kappa}{\omega_p} + \kappa f({\bf x}'\boldsymbol{\mu})f_{\kappa, \mu}(x) = (1 - \kappa) / \omega_p + \kappa f(x'\mu) [REMOVE_ME_2]

where [REMOVE_ME]f(z)=1ωp{1+k=1uk,pCkp/21(z)}f(x)=(1/ωp)1+k=1uk,pCk(p/21)(z)[REMOVEME2] f(z) = \frac{1}{\omega_p}\left\{1 + \sum_{k = 1}^\infty u_{k, p}C_k^{p / 2 - 1}(z)\right\}f(x) = (1 / \omega_p){1 + \sum_{k = 1}^\infty u_{k, p} C_k^(p / 2 - 1)(z)} [REMOVE_ME_2]

is the angular function controlling the local alternative in a Gegenbauer series , 0κ10\le \kappa \le 1, μ\mu is a direction on Sp1S^{p - 1}, and ωp\omega_p is the surface area of Sp1S^{p - 1}. The sequence {uk,p}\{u_{k, p}\} is typically such that c("\n\n", "uk,p=(1+2k/(p2))bk,pu_{k, p} = (1 + 2k / (p - 2)) b_{k, p}") for the Gegenbauer coefficients {bk,p}\{b_{k, p}\} of the kernel function of a Sobolev statistic (see the transformation between the coefficients uk,pu_{k, p}

and bk,pb_{k, p}).

Also, automatic truncation of the series k=1uk,pCk(p/21)(z)\sum_{k = 1}^\infty u_{k, p} C_k^(p / 2 - 1)(z)

according to the proportion of "Gegenbauer norm"

explained.

f_locdev(z, p, uk) con_f(f, p, N = 320) d_locdev(x, mu, f, kappa) r_locdev(n, mu, f, kappa, F_inv = NULL, ...) cutoff_locdev(p, K_max = 10000, thre = 0.001, type, Rothman_t = 1/3, Pycke_q = 0.5, verbose = FALSE, Gauss = TRUE, N = 320, tol = 1e-06)

Arguments

  • z: projected evaluation points for ff, a vector with entries on [1,1][-1, 1].

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

  • uk: coefficients uk,pu_{k, p} associated to the indexes 1:length(uk), a vector.

  • f: angular function defined on [1,1][-1, 1]. Must be vectorized.

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

  • x: locations in Sp1S^{p-1} to evaluate the density. Either a matrix of size c(nx, p) or a vector of length p. Normalized internally if required (with a warning message).

  • mu: a unit norm vector of size p giving the axis of rotational symmetry.

  • kappa: the strength of the local alternative, between 0

    and 1.

  • n: sample size, a positive integer.

  • F_inv: quantile function associated to ff. Computed by F_inv_from_f if NULL (default).

  • ...: further parameters passed to F_inv_from_f.

  • K_max: integer giving the truncation of the series. Defaults to 1e4.

  • thre: proportion of norm not explained by the first terms of the truncated series. Defaults to 1e-3.

  • type: name of the Sobolev statistic, using the naming from avail_cir_tests and avail_sph_tests.

  • Rothman_t: tt parameter for the Rothman test, a real in (0,1)(0, 1). Defaults to 1 / 3.

  • Pycke_q: qq parameter for the Pycke "qq-test", a real in (0,1)(0, 1). Defaults to 1 / 2.

  • verbose: output information about the truncation (TRUE or 1) and a diagnostic plot (2)? Defaults to FALSE.

  • Gauss: use a Gauss--Legendre quadrature rule of N nodes in the computation of the Gegenbauer coefficients? Otherwise, call integrate. Defaults to TRUE.

  • tol: tolerance passed to integrate's rel.tol and abs.tol if Gauss = FALSE. Defaults to 1e-6.

Returns

  • f_locdev: angular function evaluated at x, a vector.

  • con_f: normalizing constant cfc_f of ff, a scalar.

  • d_locdev: density function evaluated at x, a vector.

  • r_locdev: a matrix of size c(n, p) containing a random sample from the density c("\n\n", "fkappa,mu f_{\\kappa, \\mu}").

  • cutoff_locdev: vector of coefficients {uk,p}\{u_{k, p}\}

    automatically truncated according to K_max and thre

    (see details).

Description

Density and random generation for local projected alternatives to uniformity with densities

fκ,μ(x):=1κωp+κf(xμ)fκ,μ(x)=(1κ)/ωp+κf(xμ) f_{\kappa, \boldsymbol{\mu}}({\bf x}): =\frac{1 - \kappa}{\omega_p} + \kappa f({\bf x}'\boldsymbol{\mu})f_{\kappa, \mu}(x) = (1 - \kappa) / \omega_p + \kappa f(x'\mu)

where

f(z)=1ωp{1+k=1uk,pCkp/21(z)}f(x)=(1/ωp)1+k=1uk,pCk(p/21)(z) f(z) = \frac{1}{\omega_p}\left\{1 + \sum_{k = 1}^\infty u_{k, p}C_k^{p / 2 - 1}(z)\right\}f(x) = (1 / \omega_p){1 + \sum_{k = 1}^\infty u_{k, p} C_k^(p / 2 - 1)(z)}

is the angular function controlling the local alternative in a Gegenbauer series , 0κ10\le \kappa \le 1, μ\mu is a direction on Sp1S^{p - 1}, and ωp\omega_p is the surface area of Sp1S^{p - 1}. The sequence {uk,p}\{u_{k, p}\} is typically such that c("\n\n", "uk,p=(1+2k/(p2))bk,pu_{k, p} = (1 + 2k / (p - 2)) b_{k, p}") for the Gegenbauer coefficients {bk,p}\{b_{k, p}\} of the kernel function of a Sobolev statistic (see the transformation between the coefficients uk,pu_{k, p}

and bk,pb_{k, p}).

Also, automatic truncation of the series k=1uk,pCk(p/21)(z)\sum_{k = 1}^\infty u_{k, p} C_k^(p / 2 - 1)(z)

according to the proportion of "Gegenbauer norm"

explained.

Details

See the definitions of local alternatives in Prentice (1978) and in García-Portugués et al. (2023).

The truncation of c("\n\n", "\\sum_{k = 1}^\\infty u_{k, p} C_k^(p / 2 - 1)(z)") is done to the first K_max terms and then up to the index such that the first terms leave unexplained the proportion thre of the norm of the whole series. Setting thre = 0 truncates to K_max terms exactly. If the series only contains odd or even non-zero terms, then only K_max / 2

addends are effectively taken into account in the first truncation.

Examples

## Local alternatives diagnostics loc_alt_diagnostic <- function(p, type, thre = 1e-3, K_max = 1e3) { # Coefficients of the alternative uk <- cutoff_locdev(K_max = K_max, p = p, type = type, thre = thre, N = 640) old_par <- par(mfrow = c(2, 2)) # Construction of f z <- seq(-1, 1, l = 1e3) f <- function(z) f_locdev(z = z, p = p, uk = uk) plot(z, f(z), type = "l", xlab = expression(z), ylab = expression(f(z)), main = paste0("Local alternative f, ", type, ", p = ", p), log = "y") # Projected density on [-1, 1] f_proj <- function(z) rotasym::w_p(p = p - 1) * f(z) * (1 - z^2)^((p - 3) / 2) plot(z, f_proj(z), type = "l", xlab = expression(z), ylab = expression(omega[p - 1] * f(z) * (1 - z^2)^{(p - 3) / 2}), main = paste0("Projected density, ", type, ", p = ", p), log = "y", sub = paste("Integral:", round(con_f(f = f, p = p), 4))) # Quantile function for projected density mu <- c(rep(0, p - 1), 1) F_inv <- F_inv_from_f(f = f, p = p, K = 5e2) plot(F_inv, xlab = expression(x), ylab = expression(F^{-1}*(x)), main = paste0("Quantile function, ", type, ", p = ", p)) # Sample from the alternative and plot the projected sample n <- 5e4 samp <- r_locdev(n = n, mu = mu, f = f, kappa = 1, F_inv = F_inv) plot(z, f_proj(z), col = 2, type = "l", main = paste0("Simulated projected data, ", type, ", p = ", p), ylim = c(0, 1.75)) hist(samp %*% mu, freq = FALSE, breaks = seq(-1, 1, l = 50), add = TRUE) par(old_par) } ## Local alternatives for the PCvM test loc_alt_diagnostic(p = 2, type = "PCvM") loc_alt_diagnostic(p = 3, type = "PCvM") loc_alt_diagnostic(p = 4, type = "PCvM") loc_alt_diagnostic(p = 5, type = "PCvM") loc_alt_diagnostic(p = 11, type = "PCvM") ## Local alternatives for the PAD test loc_alt_diagnostic(p = 2, type = "PAD") loc_alt_diagnostic(p = 3, type = "PAD") loc_alt_diagnostic(p = 4, type = "PAD") loc_alt_diagnostic(p = 5, type = "PAD") loc_alt_diagnostic(p = 11, type = "PAD") ## Local alternatives for the PRt test loc_alt_diagnostic(p = 2, type = "PRt") loc_alt_diagnostic(p = 3, type = "PRt") loc_alt_diagnostic(p = 4, type = "PRt") loc_alt_diagnostic(p = 5, type = "PRt") loc_alt_diagnostic(p = 11, type = "PRt")

References

García-Portugués, E., Navarro-Esteban, P., Cuesta-Albertos, J. A. (2023) On a projection-based class of uniformity tests on the hypersphere. Bernoulli, 29(1):181--204. tools:::Rd_expr_doi("10.3150/21-BEJ1454") .

Prentice, M. J. (1978). On invariant tests of uniformity for directions and orientations. The Annals of Statistics, 6(1):169--176. tools:::Rd_expr_doi("10.1214/aos/1176344075")

  • Maintainer: Eduardo García-Portugués
  • License: GPL-3
  • Last published: 2024-05-24