Learn R Programming

RandomFields (version 1.0.15)

ShowModels: Interactive Choice of Models and Parameters

Description

ShowModels is an interactive plot of models and one- or two-dimensional simulations; it allows for fitting variogram models by eye.

Usage

ShowModels(covx=ifelse(is.null(empirical),4,max(empirical$c)),
           x=NULL, y=NULL, fixed.rs=FALSE, method=NULL, empirical=NULL,
           model=NULL, param=NULL, all.param=NULL, PracticalRange=FALSE, 
           legend=TRUE, register=0,...)

Arguments

covx
if a sinlge value is given, it is the largest distance for which the covariance functions or the variograms are plotted; otherwise the models are plotted for the given values, and the origin.
x
if NULL simulations are not performed; otherwise it gives the $x$ coordinates of a grid.
y
if NULL at most one-dimensional simulations are performed (depending on the value of x); otherwise y gives the $y$ coordinates of a two-dimensional grid.
fixed.rs
if TRUE then the same random seed is used for all simulations.
method
simulation method, see RFMethods; if NULL then a suitable simulation method is chosen automatically.
empirical
empirical variogram; a list as returned by EmpiricalVariogram.
model
string; covariance model, see CovarianceFct, or type PrintModelList() to get all options. If given this model is shown at the beginning.
param
parameter vector: param=c(mean, variance, nugget, scale,...); the parameters must be given in this order; see CovarianceFct for more details. Only considered if mode
all.param
all.param=c(mean, variance, nugget, scale); the parameters must be given in this order; If all.param is given then the parameters of all covariance functions are set to the given values. The values are overwritten
PracticalRange
logical. If TRUE the range of the covariance functions $C(h)$ is adjusted so that the covariance function is about 0.05 for scale==1 and distance $h=1$.
legend
if TRUE then a legend is added to the two-dimensional plot; note that legend has a bug up to R-1.2.3.
register
register where intermediate results of the simulations are stored, see also GaussRF.
...
additional graphics options for the plot of the one- or two-dimensional simulations, see plot and image.

Value

  • list of the last model and its parameters.

Details

The interactive plot consists of 4 parts:
  • top left: graph of the covariance function or the variogram. In caseempiricalis given the empirical variogram is also plotted.
  • bottom left: one- or two-dimensional simulation
  • top right: list of implemented models; a specific model is chosen by the left mouse button.
  • bottom right: parameter list for the chosen model. This part is active if the name of the model is surrounded by asterixes. It is deactivated by clicking on the upper parts of the window. If the bottom right part is active then the numerical parameters of the model can be increased by clicking on the right hand side of the grey vertical line, and decreased by clicking on the left hand side. The farer away from the vertical line the larger the added or subtracted values. The bottom lines giveglobalparameters, which determine
    • thePracticalRange, seeRFparametersfor details
    • the way the model is shown in the upper left part, namely as covariance function or as variogram.
The interactive plot is left by clicking any mouse button different from the left when the top right part is active.

See Also

CovarianceFct, GaussRF, RFMethods, RandomFields.

Examples

Run this code
# first example: one-dimensional simulations
close.screen(close.screen())
RFparameters(Print=1)
x <-  seq(1,10,0.1);
ShowModels(x=x)

# second example: two-dimensional simulations and
#                 empirical variogram
close.screen(close.screen())
RFparameters(Print=1)
dx <- runif(300,0,8)
dy <- runif(300,0,8)
dz <- GaussRF(x=dx, y=dy, grid=FALSE, model="gaus",
      param=c(1,2,1,2))
ev <- EmpiricalVariogram(x=dx, y=dy, data=dz, grid=FALSE,
      bin=(-1:20)/4)
x <-  seq(1,5,0.1);
ShowModels(x=x,y=x,empirical=ev)

Run the code above in your browser using DataLab