Condition a Multivariate Normal distribution based on a Gaussian Process using a exponentiated quadratic covariance matrix.
Arguments
- n
number of random draws.
- x
position of values to condition on.
- y
values to condition on (at positions
x
).- x_new
new positions to estimate values at.
- amplitude
Vertical scale of the covariance function
- length_scale
Horizontal scale of the covariance function
- delta
A small offset along the diagonal of the resulting covariance matrix to ensure the function returns a positive-semidefinite matrix. Can also be used as a white noise kernel to allow for increased variation at individual positions along the vector
x
.
Value
A matrix of size \(M \times N\), where \(M\) is length(x_new)
,
and \(N\) is n
. Each column is a random draw from the conditioned
multivariate normal where each row corresponds to the draw at the position
in x_new
.
Examples
x <- 1:10
y <- rep(0, 10)
x_new <- 11:15
condition_gaussian_process(3, x, y, x_new)
#> [,1] [,2] [,3]
#> [1,] 0.8364084 -0.3599454 -0.2408916
#> [2,] 0.6685950 -0.5781517 0.8602529
#> [3,] 0.2979424 -0.6303187 1.1717011
#> [4,] -0.4289284 0.7481498 0.2505266
#> [5,] 0.8509445 0.3492500 0.5947322