mgp: Multivariate Gaussian Processes

Description Usage Arguments Details Value Author(s) Examples

Description

mgp handles the evaluation of multivariate Gaussian processes with two behaviours. It evaluates the multivariate effects applied to the coordinates coords if size == NULL or it simulates the coordinates coords if size is provided.

Usage

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

Arguments

coords

A list of replicated coordinates. Each coordinate is a q replicated vector of the unique coordinates. If size != NULL, coords is the output of the function mgp.

A

A qxm matrix that defines the relationship between Y(h) and S(h).

cor.model

A character or function indicating the correlation function to be used to compute the correlation matrix

cor.params

A nested list of the parameters of the correlation function for each response.

size

A numeric value n representing the number of locations, it is used to simulate the coordinates coords. In case size == NULL, mgp simulates the multivariate Gaussian process.

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

The q-dimensional multivariate Gaussian process Y(h) is expressed as a linear combination

Y(h) = AS(h).

where S(h) is a vector of m standardized independent Gaussian processes at location h and A a qxm matrix of coefficients.

Value

A list of simulated replicated coordinates in case size is provided; otherwise, a nq-length numeric vector of the evaluated multivariate 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
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
## Simulation of a temporal multivariate Gaussian process

# Define the number of location and responses, and a linear transformation matrix
n <- 200
q <- 3
A <- matrix(c(1, 0, 1, 0, 1, - 0.8), nrow = q)

# Simulate coordinates
coords <- mgp(list(time = NA), A, size = n)

# Simulate a multivariate Gaussian process
cor.params <- list(list(phi = 0.08), list(phi = 0.15))
y <- mgp(coords, A, "exp_cor", cor.params)

# Visualize the temporal multivariate Gaussian process
data <- data.frame(time = coords[[1]], y, response = factor(rep(1:q, each = n)))
library(ggplot2)
ggplot(data, aes(time)) +
  geom_line(aes(y = y, col = response))

## Simulation of a spatial multivariate Gaussian process

# Define the number of location and responses, and a linear transformation matrix
n <- 1500
q <- 2
A <- matrix(c(1, -1), nrow = q)

# Simulate coordinates
coords <- mgp(list(s1 = NA, s2 = NA), A, size = n)

# Simulate a multivariate Gaussian process
cor.params <- list(list(phi = 0.1))
y <- mgp(coords, A, "exp_cor", cor.params)

# Visualize the temporal multivariate Gaussian process
data <- data.frame(s1 = coords[[1]], s2 = coords[[2]], y,
  response = factor(rep(1:q, each = n)))
ggplot(data, aes(s1, s2)) +
  geom_point(aes(size = y, col = y)) +
  facet_wrap(~ response)

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