simulate.covAll: Simulation of a 'covAll' Object

Description Usage Arguments Value Note See Also Examples

Description

Simulation of a covAll object.

Usage

1
2
3
4
## S4 method for signature 'covAll'
simulate(object, nsim = 1, seed = NULL,
         X, mu = NULL, method = "mvrnorm", checkNames = TRUE,
         ...)  

Arguments

object

A covariance kernel object.

nsim

Number of simulated paths.

seed

Not used yet.

X

A matrix with the needed inputs as its columns.

mu

Optional vector with length nrow(X) giving the expectation μ(x) of the Gaussian Process at the simulation locations x.

method

Character used to choose the simulation method. For now the only possible value is "mvrnorm" corresponding to the function with this name in the MASS package.

checkNames

Logical. It TRUE the colnames of X and the input names of object as given by inputNames(object) must be identical sets.

...

Other arguments for methods.

Value

A numeric matrix with nrow(X) rows and nsim columns. Each column is the vector of the simulated path at the simulation locations.

Note

The simulation is unconditional.

See Also

The mvrnorm function.

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
## -- as in example(kergp) define an argumentwise invariant kernel --

kernFun <- function(x1, x2, par) {
  h <- (abs(x1) - abs(x2)) / par[1]
  S <- sum(h^2)
  d2 <- exp(-S)
  K <- par[2] * d2
  d1 <- 2 * K * S / par[1]   
  attr(K, "gradient") <- c(theta = d1,  sigma2 = d2)
  return(K)
}

covSymGauss <- covMan(kernel = kernFun,
                      hasGrad = TRUE,
                      label = "argumentwise invariant",
                      d = 2,
                      parNames = c("theta", "sigma2"),
                      par = c(theta = 0.5, sigma2 = 2))

## -- simulate a path from the corresponding GP --

nGrid <- 24; n <- nGrid^2; d <- 2
xGrid <- seq(from = -1, to = 1, length.out = nGrid)
Xgrid <- expand.grid(x1 = xGrid, x2 = xGrid)

ySim <- simulate(covSymGauss, X = Xgrid)
contour(x = xGrid, y = xGrid,
        z = matrix(ySim, nrow = nGrid, ncol = nGrid), 
        nlevels = 15)

kergp documentation built on March 18, 2021, 5:06 p.m.