simulate_gp: Simulation of gaussian processes

Description Usage Arguments Value References Examples

View source: R/simulation.R

Description

This function returns a realization of a user-specific gaussian process. This function is based on the fact that a gaussian process is fully specified by a mean function and a covariance matrix.

Usage

1
2
3
4
5
simulate_gp(locs = NULL, n = NULL, p = NULL,
  meanmodel = function(locs, meanparms) rep(0, nrow(locs)),
  meanparms = NULL, covmodel = function(locs, covparms) diag(1,
  nrow(locs)), covparms = NULL, pivot = FALSE, correction = NULL,
  tol = .Machine$double.eps, seed = NULL)

Arguments

locs

If locs is a numeric matrix, then locs is a location matrix with n rows and p columns. If locs is "grid", then a location matrix is generated using equidistant grids with the number n of locations and the dimension p of domain [0,1]^p. If locs is "random", then a location matrix is randomly generated with the number n of locations and the dimension p of domain [0,1]^p. At NULL by default

n

Number of locations. At NULL by default

p

Dimension of domain [0,1]^p. At NULL by default

meanmodel

If meanmodel is a function, then meanmodel is a mean function. If meanmodel is a vector, then meanmodel is a mean vector. By default, it is the zero function.

meanparms

A numerical vector with mean parameters. It must be compatible with the argument meanmodel. At NULL by default

covmodel

If covmodel is a function, then covmodel is a covariance function. If covmodel is a matrix, then covmodel is a covariance matrix. By default, it is the identity matrix.

covparms

A numerical vector with covariance parameters. It must be compatible with the argument covmodel. At NULL by default

pivot

Logical indicating if pivoting is to be used when factorizing a covariance matrix. At FALSE by default

correction

An argument specifying a correction method for the cholesky factorization of a covariance matrix. At NULL by default. If correction is NULL, then the built-in R function chol is used. If correction is "qr", then the built-in R function qr is used. If correction is "diag", then C + diag(tol, n) is used instead of a covariance matrix C. Other correction methods "type-I", "type-II", "eigen-I", "eigen-II", "GMW81", and "SE99" are refered to Fang and O'leary (2008).

tol

Numerical tolerance. At .Machine$double.eps by default

seed

An integer specifying whether and how the random number generator should be initialized. The default, NULL will not change the random generator state.

Value

simulate_gp returns

References

Fang, Haw-ren, and Dianne P. O’leary. "Modified Cholesky algorithms: a catalog with new approaches." Mathematical Programming 115.2 (2008): 319-349.

Examples

1
2
out <- simulate_gp(locs = NULL, n = 5^2, p = 2)
out$y # a realization of the gaussian process with a mean rep(0, n) and a covariance diag(1, n)

myeongjong/GPsim documentation built on Dec. 11, 2019, 12:37 p.m.