kernel | R Documentation |
An isotropic kernel L
on \mathcal{S}^d
and its
normalizing constant are such that \int_{\mathcal{S}^d} c(h, d, L)
L\left(\frac{1 - \boldsymbol{x}'\boldsymbol{y}}{h^2}\right)
\,\mathrm{d}\boldsymbol{x} = 1
(extrinsic-chordal distance) or
\int_{\mathcal{S}^d} c(h, d, L)
L\left(\frac{\cos^{-1}(\boldsymbol{x}'\boldsymbol{y})^2}{2h^2}\right)
\,\mathrm{d}\boldsymbol{x} = 1
(intrinsic distance).
L(t, kernel = "1", squared = FALSE, deriv = 0, k = 10,
inc_sfp = TRUE)
c_kern(h, d, kernel = "1", kernel_type = "1", k = 10, log = FALSE,
inc_sfp = TRUE, intrinsic = FALSE)
grad_L(x, y, h, kernel = 1, k = 10)
hess_L(x, y, h, kernel = 1, k = 10)
t |
vector with the evaluation points. |
kernel |
kernel employed: |
squared |
square the kernel? Only for |
deriv |
kernel derivative. Must be |
k |
softplus kernel parameter. Defaults to |
inc_sfp |
include |
h |
vector of size |
d |
vector of size |
kernel_type |
type of kernel employed: |
log |
compute the logarithm of the constant? Defaults to |
intrinsic |
consider the intrinsic distance? Defaults to |
x |
a matrix of size |
y |
center of the kernel, a vector of size |
The gradient and Hessian are computed for the functions
\boldsymbol{x} \mapsto
L\left(\frac{1 - \boldsymbol{x}'\boldsymbol{y}}{h^2}\right)
.
L
: a vector with the kernel evaluated at t
.
grad_L
: a vector with the gradient evaluated at x
.
hess_L
: a matrix with the Hessian evaluated at x
.
# Constants in terms of h
h_grid <- seq(0.01, 4, l = 100)
r <- 2
d <- 2
dr <- rep(d, r)
c_vmf <- sapply(h_grid, function(hi)
log(c_kern(h = rep(hi, r), d = dr, kernel = 1, kernel_type = 2)))
c_epa <- sapply(h_grid, function(hi)
log(c_kern(h = rep(hi, r), d = dr, kernel = 2, kernel_type = 2)))
c_sfp <- sapply(h_grid, function(hi)
log(c_kern(h = rep(hi, r), d = dr, kernel = 3, k = 1, kernel_type = 2)))
plot(h_grid, c_epa, type = "l", ylab = "Constant", xlab = "h", col = 2)
lines(h_grid, c_sfp, col = 3)
lines(h_grid, c_vmf, col = 1)
abline(v = sqrt(2), lty = 2, col = 2)
# Kernel and its derivatives
h <- 0.5
x <- c(sqrt(2), -sqrt(2), 0) / 2
y <- c(-sqrt(2), sqrt(3), sqrt(3)) / 3
L(t = (1 - sum(x * y)) / h^2)
grad_L(x = x, y = y, h = h)
hess_L(x = x, y = y, h = h)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.