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.19929390 0.5272291 0.5268134
#> [2,] -1.33092476 0.4944712 0.2263466
#> [3,] -2.58605557 0.7990859 2.0358786
#> [4,] -0.42659913 0.5567059 2.4631173
#> [5,] 0.06881175 0.9354856 0.4857316