Skip to contents

Realisations \(mean + L e\) with \(C = LL'\) the covariance at coords (Davis 1987); conditioning on z at data_coords uses the exact Gaussian conditional law (simple kriging mean and error covariance, pivoted factor). method: "cholesky", "precision" (\(Q = C^{-1} = RR'\), \(x = R^{-T}e\); Rue and Held 2005) or "pivoted" (PivotedCholesky). Realisation s uses Philox stream s - 1; identical to the Python arm morie.fn.zschl.chol_sim.

Usage

CholeskySim(
  coords,
  model,
  nsim = 1L,
  seed = 1L,
  mean = 0,
  z = NULL,
  data_coords = NULL,
  method = "cholesky",
  tol = 1e-12
)

Arguments

coords

Matrix of simulation locations.

model

Covariance model (KrigingCovariance).

nsim

Number of realisations.

seed

Philox seed.

mean

Known constant mean.

z

Conditioning data.

data_coords

Locations of z.

method

"cholesky", "precision" or "pivoted".

tol

Relative trace tolerance of the pivoted factor.

Value

List with simulations (nsim x n), mean, cov.

References

Davis, M. W. (1987). Production of conditional simulations via the LU triangular decomposition of the covariance matrix. Mathematical Geology 19, 91-98.

Rue, H. and Held, L. (2005). Gaussian Markov Random Fields. Chapman and Hall/CRC.

Examples

CholeskySim(rbind(c(0, 0), c(1, 0)), list(model = "Exp", psill = 1, range = 1),
  seed = 3)$simulations
#>           [,1]       [,2]
#> [1,] 0.9026909 -0.7754037