condrgp: Conditional simulation of Gaussian random fields

Description Usage Arguments Value Author(s) See Also Examples

View source: R/conditionalSim.R

Description

This function generates conditional simulation of Gaussian random fields from the simple kriging predictor.

Usage

1
2
condrgp(n, coord, data.coord, data, cov.mod = "powexp", mean = 0, sill =
1, range = 1, smooth = 1, grid = FALSE, control = list())

Arguments

n

Integer. The number of conditional simulations.

coord

A numeric vector or matrix specifying the coordinates where the process has to be generated. If coord is a matrix, each row specifies one location.

data.coord

A numeric vector or matrix specifying the coordinates where the process is conditioned.

data

A numeric vector giving the conditioning observations.

cov.mod

A character string specifying the covariance function family. Must be one of "whitmat", "powexp", "cauchy" or "bessel" for the Whittle-Mater, the powered exponential, the Cauchy or Bessel covariance families.

mean,sill,range,smooth

The mean, sill, range and smooth of the Gaussian process.

grid

Logical. Does coord specifies a grid?

control

A named list passing options to the simulation method of Gaussian processes — see rgp.

Value

A list with components:

coord

The coordinates at which the process was simulated;

cond.sim

The simulated process;

data.coord

The coordinates of the conditioning locations;

data

The conditioning observations;

cov.mod

The covariance function family;

grid

Does coord specifies a grid?

Author(s)

Mathieu Ribatet

See Also

kriging, rgp.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
## Several conditional simulations
n.site <- 50
n.sim <- 512

x.obs <- runif(n.site, -100, 100)
x.sim <- seq(-100, 100, length = n.sim)

data <- rgp(1, x.obs, "whitmat", sill = 1, range = 10, smooth = 0.75)

sim <- condrgp(5, x.sim, x.obs, data, "whitmat", sill = 1, range =
10, smooth = 0.75)

matplot(x.sim, t(sim$cond.sim),  type = "l", lty = 1, xlab = "x", ylab =
expression(Y[cond](x)))
points(x.obs, data, pch = 21, bg = 1)
title("Five conditional simulations")

## Comparison between one conditional simulations and the kriging
## predictor on a grid
x.obs <- matrix(runif(2 * n.site, -100, 100), ncol = 2)
x <- y <- seq(-100, 100, length = 100)
x.sim <- cbind(x, y)

data <- rgp(1, x.obs, "whitmat", sill = 1, range = 50, smooth = 0.75)

krig <- kriging(data, x.obs, x.sim, "whitmat", sill = 1, range = 50,
smooth = 0.75, grid = TRUE)
sim <- condrgp(1, x.sim, x.obs, data, "whitmat", sill = 1, range = 50,
smooth = 0.75, grid = TRUE)

z.lim <- range(c(sim$cond.sim, data, krig$krig.est))
breaks <- seq(z.lim[1], z.lim[2], length = 65)
col <- heat.colors(64)
idx <- as.numeric(cut(data, breaks))

op <- par(mfrow = c(1,2))
image(x, y, krig$krig.est, col = col, breaks = breaks)
points(x.obs, bg = col[idx], pch = 21)
title("Kriging predictor")
image(x, y, sim$cond.sim, col = col, breaks = breaks)
points(x.obs, bg = col[idx], pch = 21)
title("Conditional simulation")
## Note how the background colors of the above points matches the ones
## returned by the image function
par(op)

Example output



SpatialExtremes documentation built on Sept. 1, 2020, 3:01 a.m.