View source: R/kernel_matern.R
kernel_matern | R Documentation |
Matern covariance function
kernel_matern(x, sigma, kappa, nu = 1, X1 = NULL, X2 = NULL)
x |
Distance measure. |
sigma |
Positive scale parameter. |
kappa |
Positive inverse range/lengthscale parameter. |
nu |
Smoothness parameter default to 1. |
X1 |
A |
X2 |
A |
Let x = dist(x_i, x_j).
cov(i,j) = sigma^2 * 2^(1-nu)/gamma(nu) * (kappa*x)^nu * K_v(kappa*x)
Note that when nu=0.5
, the Matern kernel corresponds to the absolute exponential kernel.
A matrix or a scalar of Matern covariance depending on the type of x
or
whether X1
and X2
are used instead.
X1 <- cbind(runif(10, 1, 10), runif(10, 10, 20))
X2 <- cbind(runif(5, 1, 10), runif(5, 10, 20))
kernel_matern(sigma=2, kappa=1, X1=X1, X2=X2)
kernel_matern(as.matrix(stats::dist(X1)), sigma=2, kappa=1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.