Description Usage Arguments Details Value Author(s) Examples
mgp
Simulate a Multivariate spatial Gaussian process known as linear model
of coregionalization Y(h) = AS(h), where S(h) is a vector of q independent Gaussian
processes.
1 2 |
s1 |
First coordinate |
s2 |
Second coordinate |
cov.model |
A character or function indicating the covariance function that Should be used to compute the variance-covariance matrix |
variance |
A qxq matrix of non-spatial covariance. |
nugget |
A qxq diagonal matrix of non-spatial noise. |
phi |
A q-length vector of decay parameters. |
kappa |
A q-length vector of kappa parameters if Matern spatial correlation function is used. |
details.
A vector of the realization of the Gaussian Process
Erick A. Chacon-Montalvan
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 | # Generate coordinates
N <- 100
s1 <- 2 * runif(N)
s2 <- 2 * runif(N)
# Covariance parameters
q <- 2
var <- sqrt(diag(c(4, 4)))
A <- matrix(c(1, - 0.8, 0, 0.6), nrow = 2)
variance <- var %*% tcrossprod(A) %*% var
nugget <- diag(0, q)
phi <- rep(1 / 0.08, q)
# Generate the multivariate Gaussian process
y <- mgp(s1, s2, "exponential", variance, nugget, phi)
y1 <- y[1:N]
y2 <- y[(N + 1):(2 * N)]
# Check correlation
cor(y1, y2)
plot(y1, y2)
# Visualize the spatial
plot(s1, s2, cex = y1, col = 2)
points(s1, s2, cex = y2, col = 3)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.