Learn R Programming

RandomFields (version 3.0.32)

RRdistr: RRdistr

Description

RRdistr defines of distribution family given by fct. It is used to introduce Random parameters based on distributions defined on R.

Usage

RRdistr(fct, nrow, ncol, envir)

Arguments

fct
an arbitrary family of distribution. E.g. norm() for the family dnorm, pnorm, qnorm, rnorm.
nrow, ncol
The matrix size (or vector if ncol=1) the family returns. Except for very advanced modelling we always have nrow=ncol=1, which is the default.
envir
an environment; defaults to new.env().

Details

RRdistr returns an object of class RMmodel.

See Also

RMmodel, RR, RRdistr, RFsimulate, RRdistr

Examples

Run this code
RFoptions(seed=0) ## *ANY* simulation will have the random seed 0; set
##                   RFoptions(seed=NA) to make them all random again
## here a model with random scale parameter
model <- RMgauss(scale=exp(rate=1))
x <- seq(0,10,0.02)
n <- if (interactive()) 10 else 1
for (i in 1:n) {
  readline(paste("Simulation no.", i, ": press return", sep=""))
  plot(RFsimulate(model, x=x))
}

## another possibility to define exactly the same model above is
## model <- RMgauss(scale=exp())

## note that however, the following two definitions lead
## to covariance models with fixed scale parameter:
## model <- RMgauss(scale=exp(1))   # fixed to 2.7181
## model <- RMgauss(scale=exp(x=1)) # fixed to 2.7181


## here, just two other examples:
## fst
FinalizeExample()
model <- RMmatern(nu=unif(min=0.1, max=2)) # random
for (i in 1:n) {
  readline(paste("Simulation no.", i, ": press return", sep=""))
  plot(RFsimulate(model, x=x))
}

## snd
## note that the fist 'exp' refers to the exponential function,
## the second to the exponential distribution.
model <- RMgauss(var=exp(3), scale=exp(rate=1))
Print(model)
plot(z <- RFsimulate(model=model, x=1:100/10))

FinalizeExample()

Run the code above in your browser using DataLab