gp_sim: Generate a random GP realisation.

Description Usage Arguments Value Notes See Also

View source: R/gp_functions.R

Description

gp_sim returns one or more data vectors drawn from a Gaussian Process.

Usage

1
2
gp_sim(theta, acv.model = NULL, dat = NULL, t.star = NULL,
  N.sim = 1, plot = FALSE)

Arguments

theta

(vector) parameters for covariance function the first element is the mean value mu

acv.model

(name) name of the function to compute ACV(tau | theta)

dat

(matrix) an N * 3 matrix of data: 3 columns

t.star

(vector) times at which to compute the simulation(s).

N.sim

(integer) number of random vectors to draw.

plot

(logical) add lines to an existing plot showing the results.

Value

An n * N.sim matrix, each column is a simulation, a pseudo-random n-length vector drawn from the Gaussian Process.

Notes

Simulate random realisations of a Gaussian Process (GP) with covariance defined by parameters theta, at times t.star. This is essentially eqn 2.22 of Rasmussen & Williams (2006):

y.sim ~ N(mean = y.star, cov = C)

Uses the function rmvnorm from the mvtnorm package to generate n-dimensional Gaussian vectors.

If dat is supplied (a data frame/list containing t and y) then the conditional mean values at times t.star, y[t.star] and covariance matrix C for lags tau[i,j] = |t.star[j] - t.star[i]| are generated by the gp_conditional function. See gp_logLikelihood for more about the input data form.

If dat is not supplied we sample from the 'prior' GP, i.e. assume mean = theta[1] and covariance matrix given by acv.model and theta parameters.

This function essentially just computes a covariance matrix given an autocovariance function (and its parameters), which may be conditional on some data, and uses this to draw a random Gaussian vector with rmvnorm.

See Also

gp_conditional, rmvnorm


svdataman/gin documentation built on March 12, 2021, 7:37 a.m.