kernel {iprior} | R Documentation |
Reproducing kernels for the I-prior package
Description
The kernel functions used in this package are:
The (canonical) linear kernel
The fractional Brownian motion (fBm) kernel with Hurst index
\gamma
The Pearson kernel
The (scaled)
d
-degree polynomial kernel with offsetc
The squared exponential (SE) kernel with lengthscale
l
Usage
kern_canonical(x, y = NULL, centre = TRUE)
kern_linear(x, y = NULL, centre = TRUE)
kern_pearson(x, y = NULL)
kern_fbm(x, y = NULL, gamma = 0.5, centre = TRUE)
kern_se(x, y = NULL, l = 1, centre = FALSE)
kern_poly(x, y = NULL, c = 0, d = 2, lam.poly = 1, centre = TRUE)
Arguments
x |
A vector, matrix or data frame. |
y |
(Optional) vector, matrix or data frame. |
centre |
Logical. Whether to centre the data (default) or not. |
gamma |
The Hurst coefficient for the fBm kernel. |
l |
The lengthscale for the SE kernel. |
c |
The offset for the polynomial kernel. This is a value greater than zero. |
d |
The degree for the polynomial kernel. This is an integer value greater than oe equal to two. |
lam.poly |
The scale parameter for the polynomial kernel. |
Details
The Pearson kernel is used for nominal-type variables, and thus
factor
-type variables are treated with the Pearson kernel
automatically when fitting I-prior models. The other kernels are for
continuous variables, and each emits different properties of functions.
The linear kernel is used for "straight-line" functions. In addition, if squared, cubic, or higher order terms are to be modelled, then the polynomial kernel is suitable for this purpose. For smoothing models, the fBm kernel is preferred, although the SE kernel may be used as well.
Value
A matrix whose [i, j]
entries are given by h(\code{x[i]},
\code{y[j]})
, with h
being the appropriate kernel function. The
matrix has dimensions m
by n
according to the lengths of
y
and x
respectively. When a single argument x
is
supplied, then y
is taken to be equal to x
, and a symmetric
n
by n
matrix is returned.
The matrix has a "kernel"
attribute indicating which type of kernel
function was called.
References
Examples
kern_linear(1:3)
kern_fbm(1:5, 1:3, gamma = 0.7)