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.4754557 -0.3225914 -0.5251827
#> [2,] -0.5454911 -0.4607772 -0.2237687
#> [3,] 0.5972781 -0.4503121 -0.6325060
#> [4,] -0.7199454 0.9117895 -1.3527040
#> [5,] -0.8630023 0.4385241 -0.1779215