Description Usage Arguments Examples
Function that takes a covariance function and returns a function that generates covariance matrices according to the given covariance function.
1 |
cov_fct |
covariance function. |
noise |
logical. Should an identity matrix be added to the covariance matrix? |
param |
standard values of parameters |
ns |
list of arguments to make a stationary covariance locally adaptive.
The list has takes the following entries |
... |
arguments passed to cov_fct. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | # Generate observation points
t <- seq(0, 1, length = 3)
# Generate covariances
matern_cov <- make_cov_fct(Matern, noise = FALSE)
bm_cov <- make_cov_fct(Brownian, noise = FALSE)
bb_cov <- make_cov_fct(Brownian, noise = FALSE, type = 'bridge')
# Evaluate covariance matrices
matern_cov(t, param = c(1, 1, 1))
bm_cov(t, param = c(1, 1, 1))
bb_cov(t, param = c(1, 1, 1))
# Plot covariance matrices
t <- seq(0, 1, length = 30)
persp(t, t, matern_cov(t, param = c(1, 0.5, 1)),
theta = -30, phi = 30, ticktype = 'd', zlab = '',
col = 'lightblue', shade = 0.2,
main = 'Matern covariance (1, 0.5, 1)', zlim = c(0, 1))
persp(t, t, matern_cov(t, param = c(1, 0.5, 2)),
theta = -30, phi = 30, ticktype = 'd', zlab = '',
col = 'lightblue', shade = 0.2,
main = 'Matern covariance (1, 0.5, 2)', zlim = c(0, 1))
persp(t, t, matern_cov(t, param = c(1, 0.1, 2)),
theta = -30, phi = 30, ticktype = 'd', zlab = '',
col = 'lightblue', shade = 0.2,
main = 'Matern covariance (1, 0.1, 2)', zlim = c(0, 1))
persp(t, t, bm_cov(t, param = 1), theta = -30, phi = 30,
ticktype = 'd', zlab = '', col = 'lightblue', shade = 0.2,
main = 'Brownian motion covariance (tau = 1)', zlim = c(0, 1))
persp(t, t, bb_cov(t, param = 2), theta = -30, phi = 30,
ticktype = 'd', zlab = '', col = 'lightblue', shade = 0.2,
main = 'Brownian bridge covariance (tau = 2)', zlim = c(0, 1))
# Make covariance non-stationary
matern_cov_ns <- make_cov_fct(Matern, noise = FALSE,
ns = list(knots = 3, range = c(0, 1)))
# Use mid-point reference instead of last
matern_cov_ns_mid <- make_cov_fct(Matern, noise = FALSE,
ns = list(knots = 3, fixed = 2,
range = c(0, 1)))
# Original covariance
persp(t, t, matern_cov_ns(t, param = c(1, 1, 1, 0.3, 2)),
theta = -30, phi = 30, ticktype = 'd', zlab = '',
col = 'lightblue', shade = 0.2,
main = 'Matern covariance (1, 0.1, 2)', zlim = c(0, 1))
# Modified covariances
persp(t, t, matern_cov_ns(t, param = c(0.5, 0.7, 1, 0.3, 2)),
theta = -30, phi = 30, ticktype = 'd', zlab = '',
col = 'lightblue', shade = 0.2,
main = 'Non-stationary Matern covariance (1, 0.1, 2)', zlim = c(0, 1.1))
persp(t, t, matern_cov_ns(t, param = c(1, 0.7, 1, 0.3, 2)),
theta = -30, phi = 30, ticktype = 'd', zlab = '',
col = 'lightblue', shade = 0.2,
main = 'Non-stationary Matern covariance (1, 0.1, 2)', zlim = c(0, 1.1))
persp(t, t, matern_cov_ns_mid(t, param = c(1, 0.7, 1, 0.3, 2)),
theta = -30, phi = 30, ticktype = 'd', zlab = '',
col = 'lightblue', shade = 0.2,
main = 'Non-stationary Matern covariance (1, 0.1, 2)', zlim = c(0, 1.1))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.