# Generate smooth GP samples with Gaussian covariance
t <- seq(0, 1, length.out = 100)
fd <- make.gaussian.process(n = 20, t = t,
cov = kernel.gaussian(length_scale = 0.2),
seed = 42)
plot(fd)
# Generate rough GP samples with exponential covariance
fd_rough <- make.gaussian.process(n = 20, t = t,
cov = kernel.exponential(length_scale = 0.1),
seed = 42)
plot(fd_rough)
# Generate 2D GP samples (surfaces)
s <- seq(0, 1, length.out = 20)
t2 <- seq(0, 1, length.out = 20)
fd2d <- make.gaussian.process(n = 5, t = list(s, t2),
cov = kernel.gaussian(length_scale = 0.3),
seed = 42)
plot(fd2d)
# Generate GP with non-zero mean
mean_func <- function(t) sin(2 * pi * t)
fd_mean <- make.gaussian.process(n = 10, t = t,
cov = kernel.gaussian(variance = 0.1),
mean = mean_func, seed = 42)
plot(fd_mean)
Run the code above in your browser using DataLab