Skip to contents

Generates n realizations of a zero-mean Gaussian process. The function also accepts user-defined covariance functions (without "nugget" effect, see cov), The implemented defaults with scale parameter \(\phi\), order \(o\) and nugget effect variance \(\sigma^2\) are:

  • squared exponential covariance \(Cov(x(t), x(t')) = \exp(-(t-t')^2)/\phi) + \sigma^2 \delta_{t}(t')\).

  • Wiener process covariance \(Cov(x(t), x(t')) = \min(t',t)/\phi + \sigma^2 \delta_{t}(t')\),

  • Matèrn process covariance \(Cov(x(t), x(t')) = \tfrac{2^{1-o}}{\Gamma(o)} (\tfrac{\sqrt{2o}|t-t'|}{\phi})^o \text{Bessel}_o(\tfrac{\sqrt{2o}|t-t'|}{s}) + \sigma^2 \delta_{t}(t')\)

Usage

tf_rgp(
  n,
  arg = 51L,
  cov = c("squareexp", "wiener", "matern"),
  scale = diff(range(arg))/10,
  nugget = scale/200,
  order = 1.5
)

Arguments

n

how many realizations to draw

arg

vector of evaluation points (arg of the return object). Defaults to (0, 0.02, 0.04, ..., 1). If given as a single integer (don't forget the L...), creates a regular grid of that length over (0,1).

cov

type of covariance function to use. Implemented defaults are "squareexp", "wiener", "matern", see Description. Can also be any vectorized function returning \(Cov(x(t), x(t'))\) without nugget effect for pairs of inputs t and t'.

scale

scale parameter (see Description). Defaults to the width of the domain divided by 10.

nugget

nugget effect for additional white noise / unstructured variability. Defaults to scale/200 (so: very little white noise).

order

order of the Matèrn covariance (if used, must be >0), defaults to 1.5. The higher, the smoother the process. Evaluation of the covariance function becomes numerically unstable for large (>20) order, use "squareexp".

Value

an tfd-vector of length n

See also

Other tidyfun RNG functions: tf_jiggle()