grf(n, grid = "irreg", nx = round(sqrt(n)), ny = round(sqrt(n)),
xlims = c(0, 1), ylims = c(0, 1), nsim = 1,
cov.model = "matern",
cov.pars = stop("cov. parameters (sigmasq and phi) needed"),
kappa = 0.5, nugget = 0, lambda = 1, aniso.pars,
method = c("cholesky", "svd", "eigen", "circular.embedding"),
messages.screen = TRUE)
cov.spatial
for
further details. Defaults to the
exponential model."matern"
, "powered.exponential"
, "cauchy"
and "gneiting.matern"
. More details on the documentation fDETAILS
below.TRUE
.nsim = 1
) or a matrix with the
simulated values. For the latter each column corresponds to one
simulation."cholesky"
, "svd"
and "eigen"
the
simulation consists of multiplying a vector of standardized
normal deviates by a square root of the covariance matrix.
The square root of a matrix is not uniquely defined. The
three available methods differs in the way they compute the
square root of the (positive definite) covariance matrix. For method = "circular.embedding"
the algorithm implements
the method described by Wood & Chan (1994) which is based on Fourier
transforms.
Only regular and equally spaced grids can be generated using this method.
The code for the "circular.embedding"
method
was provided by Martin Schlather, University of Bayreuth
("circular.embedding"
method is
no longer being maintained. Martin has released a
package called RandomFields
(available on CRAN
)
for simulation of random fields.
We strongly recommend the use of this package for simulations on fine
grids with large number of locations.
plot.grf
and image.grf
for
graphical output,
coords.aniso
for anisotropy coordinates transformation
and, chol
,
svd
and eigen
for methods of matrix decomposition.#
sim1 <- grf(100, cov.pars = c(1, .25))
# a display of simulated locations and values
points.geodata(sim1)
# empirical and theoretical variograms
plot(sim1)
#
# a "smallish" simulation
sim2 <- grf(441, grid = "reg", cov.pars = c(1, .25))
image.grf(sim2)
#
# a "bigger" one
sim3 <- grf(40401, grid = "reg", cov.pars = c(10, .2), met = "circ")
image.grf(sim3)
<testonly>#sim1 <- grf(100, cov.pars=c(1, .3), nsim=5)
#plot(sim1)</testonly>
Run the code above in your browser using DataLab