Learn R Programming

rSPDE (version 2.5.1)

simulate.rSPDEobj: Simulation of a fractional SPDE using a rational SPDE approximation

Description

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, ...)

Value

A matrix with the n samples as columns.

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.

See Also

simulate.CBrSPDEobj()

Examples

Run this code
# 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")

Run the code above in your browser using DataLab