rGRFgauss: Simulate a Gaussian Random Field

View source: R/randomfields.R

rGRFgaussR Documentation

Simulate a Gaussian Random Field

Description

Generate a realisation of a Gaussian Random Field with given first and second moments.

Usage

rGRFgauss(W = owin(), mu = 0, var = 1, scale,
          ..., nsim = 1, drop = TRUE)
rGRFexpo(W = owin(), mu = 0, var = 1, scale,
          ..., nsim = 1, drop = TRUE)
rGRFstable(W = owin(), mu = 0, var = 1, scale, alpha,
           ..., nsim = 1, drop = TRUE)
rGRFgencauchy(W = owin(), mu = 0, var = 1, scale, alpha, beta, 
           ..., nsim = 1, drop = TRUE)
rGRFmatern(W = owin(), mu = 0, var = 1, scale, nu, 
           ..., nsim = 1, drop = TRUE)

Arguments

W

Window (object of class "owin") in which to generate the simulated random field.

mu

The mean of the random field. A single numeric value, or a function(x, y, ...), or a pixel image (object of class "im").

var

Variance of the random field. A single positive number.

scale

Spatial scale parameter h. A single positive number. See Details.

alpha, beta, nu

Additional parameters for specific models. See Details.

...

Arguments passed to as.mask to determine the pixel resolution.

nsim

Number of simulated realisations to be generated.

drop

Logical. If nsim=1 and drop=TRUE (the default), the result will be a point pattern, rather than a list containing a point pattern.

Details

These functions generate simulated realisations of a Gaussian random field.

The mean E[Z(u)] of the Gaussian random field value Z(u) at any location u is specified by the argument mu, which may be a constant, a function(x,y,...), or a pixel image.

The variance V[Z(u)] of the Gaussian random field value is specified by the argument var, which should be a single positive numerical value.

The correlation C(u - v) = C(Z(u), Z(v)) between the values at two locations u and v depends on the distance r = \| u-v\| as follows:

rGRFexpo

the exponential covariance function

C(r) = \sigma^2 \exp(-r/h)

where \sigma^2 is the variance parameter var, and h is the scale parameter scale.

rGRFgauss

the Gaussian covariance function

C(r) = \sigma^2 \exp(-(r/h)^2)

where \sigma^2 is the variance parameter var, and h is the scale parameter scale.

rGRFstable

the stable covariance function

C(r) = \sigma^2 \exp(-(r/h)^\alpha)

where \sigma^2 is the variance parameter var, h is the scale parameter scale, and \alpha is the shape parameter alpha.

rGRFgencauchy

the generalised Cauchy covariance function

C(r) = \sigma^2 (1 + (x/h)^\alpha)^{-\beta/\alpha}

where \sigma^2 is the variance parameter var, h is the scale parameter scale, and \alpha and \beta are the shape parameters alpha and beta.

rGRFmatern

the Whittle-\Matern covariance function

C(r) = \sigma^2 \frac{1}{2^{\nu-1} \Gamma(\nu)} (\sqrt{2 \nu} \, r/h)^\nu K_\nu(\sqrt{2\nu}\, r/h)

where \sigma^2 is the variance parameter var, h is the scale parameter scale, and \nu is the shape parameter nu.

The algorithm generates nsim simulated realisations of the random field using the circulant embedding technique (Davies and Bryant, 2013).

Value

If nsim=1 and drop=TRUE, a pixel image (object of class "im"). Otherwise, a list of pixel images.

Author(s)

\tilman

and David Bryant. Modified by \adrian.

References

Davies, T.M. and Bryant, D. (2013) On Circulant Embedding for Gaussian Random Fields in R. Journal of Statistical Software 55, issue 9 \Sexpr[results=rd]{tools:::Rd_expr_doi("10.18637/jss.v055.i09")}

See Also

rLGCP

Examples

  plot(rGRFgauss(scale=0.1))

spatstat.random documentation built on Nov. 21, 2025, 9:07 a.m.