kern_to_cov {MagmaClustR} | R Documentation |
Create covariance matrix from a kernel
Description
kern_to_cov()
creates a covariance matrix between input values (that
could be either scalars or vectors) evaluated within a kernel function,
which is characterised by specified hyper-parameters. This matrix is
a finite-dimensional evaluation of the infinite-dimensional covariance
structure of a GP, defined thanks to this kernel.
Usage
kern_to_cov(input, kern = "SE", hp, deriv = NULL, input_2 = NULL)
Arguments
input |
A vector, matrix, data frame or tibble containing all inputs for one individual. If a vector, the elements are used as reference, otherwise , one column should be named 'Input' to indicate that it represents the reference (e.g. 'Input' would contain the timestamps in time-series applications). The other columns are considered as being covariates. If no column is named 'Input', the first one is used by default. |
kern |
A kernel function. Several popular kernels (see The Kernel Cookbook) are already implemented and can be selected within the following list:
|
hp |
A list, data frame or tibble containing the hyper-parameters used
in the kernel. The name of the elements (or columns) should correspond
exactly to those used in the kernel definition. If |
deriv |
A character, indicating according to which hyper-parameter the derivative should be computed. If NULL (default), the function simply returns the covariance matrix. |
input_2 |
(optional) A vector, matrix, data frame or tibble under the
same format as |
Value
A covariance matrix, where elements are evaluations of the associated kernel for each pair of reference inputs.
Examples
TRUE