Skip to contents

Returns variance when two observations are exactly identical and zero otherwise. For kernel_white_noise(x), the diagonal therefore equals the requested white-noise variance.

Usage

kernel_white_noise(x, y = NULL, variance = 1)

Arguments

x

Numeric vector or matrix. Matrix rows are observations and columns are input dimensions.

y

Optional numeric vector or matrix with the same number of input dimensions as x. If NULL, computes the covariance of x with itself.

variance

Positive marginal variance.

Value

A numeric covariance matrix.

Stability

Stable: from version 1.0.0 this interface changes incompatibly only in a major release, after a deprecation period. Results and options that concern an experimental model class, kernel, or argument follow that interface's tier. See gaussianprocesses-package for the policy.

See also

white_noise_kernel() creates the same kernel as a reusable specification, which can be combined, optimized, and used in models.

Examples

# Only coincident inputs covary.
kernel_white_noise(c(0, 0, 1), variance = 0.1)
#>      [,1] [,2] [,3]
#> [1,]  0.1  0.1  0.0
#> [2,]  0.1  0.1  0.0
#> [3,]  0.0  0.0  0.1