gp: Simulate a Gaussian process

Description Usage Arguments Details Value Author(s) Examples

Description

gp Simulate a spatial Gaussian process given a certain covariance function.

Usage

1
2
gp(coords, cor.model = "exp_cor", cor.params, sigma2 = 1,
  size = NULL, range = 1, geom = NULL)

Arguments

coords

A list of coordinates

cor.model

A character or function indicating the covariance function that Should be used to compute the variance-covariance matrix

cor.params

A list of the parameters required by the cor.model function.

sigma2

variance of the Gaussian process

size

numeric value to simulate the covariate x

range

Range of the coordinates of the Gaussian processes.

geom

object of class ‘sf’ or ‘sfc’ to define the area where to simulate the samples

Details

details.

Value

A vector of the realization of the Gaussian Process

Author(s)

Erick A. Chacón-Montalván

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
(x <- gp(list(s1 = NA), size = 10))
(s1 <- x[[1]])
# Simulate and plot the realization of a Gaussian process
(y <- gp(list(s1), cor.model = "exp_cor", cor.params = list(phi = 0.05)))

(x <- gp(list(s1 = NA, s2 = NA), size = 10))
(s1 <- x[[1]])
(s2 <- x[[2]])
# Simulate and plot the realization of a Gaussian process
(y <- gp(list(s1, s2), cor.model = "exp_cor", cor.params = list(phi = 0.05)))
plot(s1, s2, cex = y)
# Plot with ggplot
# ggplot(data.frame(s1, s2, y), aes(s1, s2, col = y)) +
#  geom_point(size = 3)

(x <- gp(list(s1 = "none", s2 = NA), size = 10))
(s1 <- x[[1]])
(s2 <- s1)
# Simulate and plot the realization of a Gaussian process
(y <- gp(list(s1, s2), cor.model = "exp_cor", cor.params = list(phi = 0.05)))

ErickChacon/datasim documentation built on March 25, 2020, 7:53 p.m.