simulateHorizons {SoPhy}R Documentation

Simulation of the stochastic part of the definition of the horizons

Description

simulateHorizons simulates the Gaussian random fields that define the Miller-similar medium, the stones and the roots according to the definition of the horizons.

Usage

simulateHorizons(h, first = 1, what = 'all',
                  PrintLevel = RFparameters()$Print,
                  message = function(s) {print(s)}, stone.trials=50)

Arguments

h a list of the same format as the output of xswms2d
first first gives the first horizon for which a Gaussian random field should be generated. It is assumed that the preceding horizons have already been simulated.
first greater than 1 is suitable in the following situation. Assume the random fields for all horizons of the profile have been generated. Then the random field parameter of the nth horizon is changed. For updating the simulated random fields it suffices now to call simulateHorizons by first=n
what what is a second parameter afer first that is used to determine the starting point of the updating procedure:
'all'
the simulations of the Gaussian random fields (according to first), the simulation of the stones and the simulation of the roots are performed
'stone'
only the simulations for the stones and the roots are performed
'root'
only the simulations for the roots are performed
'randomfield'
only the simulations for the Gaussian random fields are performed
PrintLevel If non-positive nothing is printed. The higher the number the more information is given on during the calculations.
message function that has a string as argument. message is called for printing error messages and for the current stage of the calculations. message is called independently of the value of PrintLevel. message is intended to be used for messages on graphical devices.
stone.trials number of trials to find a realisation for the spatial distributions of the stones before simulate.stones gives up.

Value

List of the same format as the output of xswms2d. The following elements are changed in general

random.seed The random seed for the simulation of the Gaussian random fields. It is changed when what='all' or random.seed has been NULL
stone.random.seed The random seed for the simulation of the stones. It is changed when what%in% c('all','stone') or stone.random.seed has been NULL
root.random.seed The random seed for the simulation of the roots. It is changed when what=%in% c('all','stone','root') or root.random.seed has been NULL
RF the simulations of the Gaussian random fields
Stone.RF the simulations of the profile including the values for the stones, see also create.stones
Root.RF the simulations of the profile including the root values if $rf.Kf=TRUE, see also create.roots
rf.complete logical. rf.complete is FALSE if the simulation has not been completed (because of an error).

Note

As a side effect the global variable .Random.seed is reset.

Author(s)

Martin Schlather, martin.schlather@math.uni-goettingen.de http://www.stochastik.math.uni-goettingen.de/institute

References

Schlather, M. (2001) Simulation and analysis of random fields R News bf{1} (2), 18-20.

See Also

SoPhy, xswms2d

Examples

h <- xswms2d(xlim=c(1, 50), ylim=c(1, 50), step=1, new=NULL)
h$n <- 2            ## define a second
h$H2 <- h$H1
h$H2$type <- "H"    ## genuine horizon, not polygon 

## coordinates of the boundary segments between the horizons 
h$H2$points <- list(x=seq(1, 100, 5))             ## x coordinates
h$H2$points$y <- 40 + 20 * cos(h$H2$points$x / 5) ## y coordinates

## Gaussian random field of the second horizon is pure nugget effect:
h$H2$model <- list(model=list(list(model='nugget', var=0.5, scale=1)),
                   mean=0.5)
h$H2$stone$lambda <- 0.005  ## intensity of the stones in the 2nd horizon
h <- calculate.horizons(h)
for (i in 1:2) { 
  plotRF(simulateHorizons(h)) ##
  readline("Press return")
}


[Package SoPhy version 1.0.34 Index]