Skip to contents

The function samples a Gaussian random field based on a pre-computed rational SPDE approximation.

Usage

# S3 method for rSPDEobj
simulate(object, nsim = 1, seed = NULL, ...)

Arguments

object

The rational SPDE approximation, computed using fractional.operators(), matern.operators(), or spde.matern.operators().

nsim

The number of simulations.

seed

an object specifying if and how the random number generator should be initialized (‘seeded’).

...

Currently not used.

Value

A matrix with the n samples as columns.

Examples

# Sample a Gaussian Matern process on R using a rational approximation
kappa <- 10
sigma <- 1
nu <- 0.8
range <- sqrt(8*nu)/kappa

# create mass and stiffness matrices for a FEM discretization
x <- seq(from = 0, to = 1, length.out = 101)
fem <- rSPDE.fem1d(x)

# compute rational approximation
op <- matern.operators(
  range = range, sigma = sigma,
  nu = nu, loc_mesh = x, d = 1,
  parameterization = "matern"
)

# Sample the model and plot the result
Y <- simulate(op)
plot(x, Y, type = "l", ylab = "u(x)", xlab = "x")