Designed to be partially specified. (see examples)

SE(X, sigma = 1, rho = median(as.matrix(dist(t(X)))), jitter = 1e-10)

LINEAR(X, sigma = 1, c = rep(0, nrow(X)))

Arguments

X

covariate (dimension Q x N; i.e., covariates x samples)

sigma

scalar parameter

rho

scalar bandwidth parameter

jitter

small scalar to add to off-diagonal of gram matrix (for numerical underflow issues)

c

vector parameter defining intercept for linear kernel

Value

Gram Matrix (N x N) (e.g., the Kernel evaluated at each pair of points)

Details

Gram matrix G is given by

SE (squared exponential): $$G = \sigma^2 * exp(-[(X-c)'(X-c)]/(s*\rho^2))$$

LINEAR: $$G = \sigma^2*(X-c)'(X-c)$$

Examples

# Create Partial for use with basset K <- function(X) SE(X, 2, .2) # Example use X <- matrix(rnorm(10), 2, 5) G <- K(X) G # this is the gram matrix (the kernel evaluated on a finite set of points)
#> 1 2 3 4 5 #> 1 4.000000e+00 2.319187e-13 4.722057e-03 1.183206e-32 2.239274e-10 #> 2 2.319187e-13 4.000000e+00 1.157943e-18 4.229921e-22 1.401244e-41 #> 3 4.722057e-03 1.157943e-18 4.000000e+00 2.052164e-53 1.531729e-18 #> 4 1.183206e-32 4.229921e-22 2.052164e-53 4.000000e+00 5.341212e-40 #> 5 2.239274e-10 1.401244e-41 1.531729e-18 5.341212e-40 4.000000e+00