powered by
Exponential covariance function
kernel_exp(x, sigma, ell, X1 = NULL, X2 = NULL)
A matrix or a scalar of exponential covariance depending on the type of x or whether X1 and X2 are used instead.
x
X1
X2
Distance measure.
The scale parameter with the constraint of sigma > 0
sigma > 0
The range/lengthscale parameter with the constraint of ell > 0.
ell > 0
A n1 x 2 matrix containing the coordinates of location set 1. If x is not provided, X1 and X2 should be provided for calculating their distance.
n1 x 2
A n2 x 2 coordinate matrix.
n2 x 2
Let x = dist(x_i, x_j).
cov(i,j) = sigma^2*exp(-x/ell)
X1 <- cbind(runif(10, 1, 10), runif(10, 10, 20)) X2 <- cbind(runif(5, 1, 10), runif(5, 10, 20)) kernel_exp(sigma=2, ell=1, X1=X1, X2=X2) kernel_exp(as.matrix(stats::dist(X1)), sigma=2, ell=1)
Run the code above in your browser using DataLab