Learn R Programming

SepTest (version 0.0.1)

Gauss.st.F: Simulate a spatio-temporal Gaussian random field on a regular grid

Description

Simulates a space-time Gaussian random field on a regular \((x,y,t)\) grid. The field is returned as a 3D array and can be used as a latent field for log-Gaussian Cox process (LGCP) simulation.

Usage

Gauss.st.F(
  xlim = c(0, 1),
  ylim = c(0, 1),
  tlim = c(0, 1),
  par1 = c(1, 0.05),
  par2 = c(1, 0.06),
  sigmas = c(0.5, 0.5, 1),
  grid = c(15L, 15L, 10L)
)

Value

A list with components:

Z

Numeric array of dimension c(nx, ny, nt) containing simulated field values.

xcoord

Numeric vector of length nx with x-grid coordinates.

ycoord

Numeric vector of length ny with y-grid coordinates.

tcoord

Numeric vector of length nt with time-grid coordinates.

Arguments

xlim, ylim, tlim

Numeric vectors of length 2 giving the ranges for the spatial and temporal axes. Defaults are c(0,1) for each.

par1

Numeric vector of length 2 giving the temporal covariance parameters c(variance, scale) for an exponential covariance \(var * exp(-d/scale)\).

par2

Numeric vector of length 2 giving the spatial covariance parameters c(variance, scale) for an exponential covariance \(var * exp(-d/scale)\).

sigmas

Numeric vector of length 3 specifying the weights \((\sigma_1,\sigma_2,\sigma_3)\) for combining the spatial, temporal, and spatio-temporal components of the field.

grid

Integer vector of length 3 giving the number of grid points in the \(x\), \(y\), and \(t\) directions.

Author

Mohammad Ghorbani mohammad.ghorbani@slu.se
Nafiseh Vafaei nafiseh.vafaei@slu.se

Details

The simulated field is a weighted sum of three independent Gaussian components: $$Z(x,y,t) = \sigma_1 Z_s(x,y) + \sigma_2 Z_t(t) + \sigma_3 Z_{st}(x,y,t),$$ where \(Z_s\) is a purely spatial field, \(Z_t\) is a purely temporal field, and \(Z_{st}\) is a spatio-temporal field with separable exponential covariance in space and time.

The function uses mvrnorm for multivariate normal simulation and rdist to compute pairwise distances for covariance matrix construction.

Spatial and temporal covariances are exponential. The spatio-temporal component uses a separable covariance \(C_{st}((u,t),(u',t')) = C_s(u,u') C_t(t,t')\). Simulation is performed via Cholesky factors without constructing the full \((nx*ny*nt) \times (nx*ny*nt)\) covariance matrix.

References

Ghorbani M., Vafaei N., Dvořák J., Myllymäki M. (2021). Testing the first-order separability hypothesis for spatio-temporal point patterns. Computational Statistics and Data Analysis, 161, 107245.

See Also

mvrnorm, rdist

Examples

Run this code

 if (requireNamespace("MASS", quietly = TRUE) && requireNamespace("fields", quietly = TRUE)) {
  set.seed(1)
  field <- Gauss.st.F(
    xlim = c(0, 1), ylim = c(0, 1), tlim = c(0, 1),
    par1 = c(1, 0.05), par2 = c(1, 0.06),
    sigmas = c(0.5, 0.5, 1),
    grid = c(15, 15, 10)
  )
# Inspect dimensions and visualize one time slice
dim(field$Z)
image(field$xcoord, field$ycoord, field$Z[, , 1],
      main = "Gaussian Random Field (t = 1)",
      col = RColorBrewer::brewer.pal(11, "Spectral"))
  }

Run the code above in your browser using DataLab