RandomFields (version 2.0.71)

RFparameters: Control Parameters

Description

RFparameters sets and returns control parameters for the simulation of random fields

Usage

RFparameters(..., no.readonly=FALSE)

Arguments

...
arguments in tag = value form, or a list of tagged values.
no.readonly
If RFparameters is called without parameter then all parameters are returned in a list. If no.readonly=TRUE then only rewritable parameters are returned.

Value

  • If any parameter has been given RFparameters returns an invisible list of the given parameters in full name.

    Otherwise the complete list of parameters is returned. Further the values of the following internal readonly variables are returned: * covmaxchar: max. name length for variogram/covariance models * covnr: number of currently implemented variogram/covariance models * distrmaxchar: max. name length for a distribution * distrnr: number of currently implemented distributions * maxdim: maximum number of dimensions for a random field * maxmodels: maximum number of elementary models in definition of a complex covariance model * methodmaxchar: max. name length for methods * methodnr: number of currently implemented simulation methods

Details

The possible parameters are General options [object Object],[object Object] General options for simulating [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object] Options for simulating with the standard circulant embedding method [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object] Options for simulating by simple matrix decomposition [object Object],[object Object],[object Object],[object Object] Options for simulating hyperplane tessellations [object Object],[object Object],[object Object],[object Object]

Options for simulating with the local ce methods (cutoff, intrinsic) [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object] Options for simulating a Gaussian Markov random fields [object Object],[object Object],[object Object],[object Object] Options for simulating by random coins [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object] Options for simulating nugget effects Simulating a nugget effect seems trivial. It gets complicated and best methods (including direct and circulant embedding!) fail if zonal anisotropies are considered, where sets of points have to be identified that belong to the same subspace of eigenvalue 0 of the anisotropy matrix. [object Object],[object Object]

Options for using the sequential method The method works only for spatio-temporal settings (and grids). [object Object],[object Object],[object Object]

Options for special simulation methods Special methods exist for the following covariance functions [object Object] Options for simulating with a turning bands method Currently, there are 3 variants of the turning bands method implemented: [object Object],[object Object],[object Object]

The following parameters are used. [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object] Options specific to simulating max-stable random fields [object Object]

General comments on the options The following refers to the simulation of Gaussian random fields (InitGaussRF, GaussRF), but most parts also apply for the simulation of max-stable random fields (InitMaxStableRF, MaxStableRF). Some of the global parameters determine the basic settings of a simulation, e.g. direct.method (which chooses a square root of a positive definite matrix). The values of such parameters are read by InitGaussRF and stored in an internal register. Changing such a parameter between calling InitGaussRF and calling DoSimulateRF or between subsequent calls of GaussRF will not have any effect. These parameters have the flag "[init]". Parameters like TBM2.lines (which determines the number of i.i.d. processes to be simulated on the line) are only relevant when generating random numbers. These parameters are read by DoSimulateRF (or by the second part of GaussRF), and are marked by "[do]". Storing has an influence on both, InitGaussRF and DoSimulateRF. InitGaussRF may reserve more memory if Storing=TRUE. DoSimulateRF will free the register if Storing=FALSE, whatever the value of Storing was when InitGaussRF was called.

The distinction between [init] and [do] is also relevant if GaussRF is used and called a second time with the same parameters for the random field and if RFparameters()$Storing=TRUE. Then GaussRF realises that the second call has the same random field parameters, and takes over the stored intermediate results (that have been calculated with the RFparameters() at that time). To prevent the use of stored intermediate results or to take into account intermediate changes of RFparameters set RFparameters(Storing=FALSE) or use DeleteRegister() between calls of GaussRF.

A programme that checks whether the parameters are well adapted to a specific simulation problem is given as an example of EmpiricalVariogram().

For further details on the implemented methods, see RFMethods.

References

Schlather, M. (1999) An introduction to positive definite functions and to unconditional simulation of random fields. Technical report ST 99-10, Dept. of Maths and Statistics, Lancaster University.

See Also

GaussRF, GetPracticalRange, MaxStableRF, RandomFields, and RFMethods.

Examples

Run this code
RFparameters(Storing=TRUE)
 str(RFparameters())


############################################################
##                                                        ##
##       use of TBM.points and TBM.center                 ##
##                                                        ##
############################################################
## The following example shows that the same realisation      
## can be obtained on different grid geometries (or point     
## configurations, i.e. grid, non-grid) using TBM3 (or TBM2)

x1 <- seq(-150,150,1)
y1 <- seq(-15, 15, 1)
x2 <- seq(-50, 50, 1)
model <- "exponential"
param <- c(0, 1, 0, 10)
meth <- "TBM3"

###### simulation of a random field on long thing stripe
runif(1)
rs <- get(".Random.seed", envir=.GlobalEnv, inherits = FALSE)
z1 <- GaussRF(x1, y1, model=model, param=param, grid=TRUE, 
              method=meth, TBM.center=0, Storing=TRUE)
do.call(getOption("device"), list(height=1.55, width=12))
par(mar=c(2.2, 2.2, 0.1, 0.1))
image(x1, y1, z1, col=rainbow(100))
polygon(range(x2)[c(1,2,2,1)], range(y1)[c(1,1,2,2)], border="red", lwd=3)


###### definition of a random field on a square of shorter diagonal
assign(".Random.seed", rs, envir=.GlobalEnv)
tbm.points <- length(GetRegisterInfo(meth="TBM")$S$line)
z2 <- GaussRF(x2, x2, model=model, param=param, grid=TRUE, register=1,
              method=meth, TBM.center=0, TBM.points=tbm.points)
do.call(getOption("device"), list(height=4.3, width=4.3))
par(mar=c(2.2, 2.2, 0.1, 0.1))
image(x2, x2, z2, zlim=range(z1), col=rainbow(100))
polygon(range(x2)[c(1,2,2,1)], range(y1)[c(1,1,2,2)], border="red", lwd=3)



############################################################
##                                                        ##
##                   use of exactness                     ##
##                                                        ##  
############################################################
x <- seq(0, 1, 1/30)
model <- list("+",
              list("stable", alpha=1.0),
              list(model="gencauchy", alpha=1.0, beta=2.0)
              )

for (exactness in c(NA, FALSE, TRUE)) { 
  readline(paste("exactness: `", exactness, "'; press return"))
   z <- GaussRF(x, x,  grid=TRUE, gridtriple=FALSE,
                model=model, exactness=exactness,
                stationary.only=NA, Print=1, n=1,
                TBM2.linesimustep=1, Storing=TRUE)
   Print(GetRegisterInfo()$meth$name)
  }



 #############################################################
 ## The following gives a tiny example on the advantage of  ##
 ## local.dependent=TRUE (and CE.dependent=TRUE) if in a    ##
 ## study most of the time is spent with simulating the     ##
 ## Gaussian random fields. Here, the covariance at a pair  ##
 ## of points is estimated for n independentent repetitions ##
 ## and 2*n locally dependent dependent repetitions .       ##
 ## To get the precision, the procedure is repeated m times.##
 #############################################################

# In the example below, local.dependent speeds up the simulation
# by about factor 16 at the price of an increased variance of
# factor 1.5

x <- seq(0, 1, len=10)
y <- seq(0, 1, len=10)
grid.size <- c(length(x), length(y))
model <- list("$", var=1.1, aniso=matrix(nc=2, c(2,1,0.5,1)),
              list(model="exp"))
(CovarianceFct(matrix(c(1, -1), ncol=2), model=model)) ## true value

m <- if (interactive()) 100 else 2
n <- if (interactive()) 100 else 10

# using local.dependent=FALSE (which is the default)
c1 <- numeric(m)
unix.time(
for (i in 1:m) {
  cat("", i)
  z <- GaussRF(x, y, model=model, grid=TRUE, method="cu", n=n,
               local.dependent=FALSE, pch="")
  c1[i] <- cov(z[1,length(y), ], z[length(x), 1, ])
})  # many times slower than with local.dependent=TRUE
mean(c1)
sd(c1)

# using local.dependent=TRUE...
c2 <- numeric(m)
unix.time(
for (i in 1:m) {
  cat("", i)
  z <- GaussRF(x, y, model=model, grid=TRUE, method="cu", n=2 * n,
               local.dependent=TRUE, pch="")
  c2[i] <- cov(z[1,length(y),], z[length(x), 1 , ])
})
mean(c2)
sd(c2) # the sd is samller (using more locally dependent realisations)
##       but it is (much) faster! For n=n2 instead of n=2 * n, the 
##       value of sd(c2) would be larger due to the local dependencies 
##       in the realisations.

Run the code above in your browser using DataLab