Description Usage Arguments Details Note Note See Also Examples
View source: R/RMmodelsSpecial.R
RRdistr
defines a distribution family given by fct
.
It is used to introduce random parameters based on
distributions defined on R.
1 2 |
name |
an arbitrary family of distributions. E.g.
|
nrow, ncol |
The matrix size (or vector if |
envir |
an environment; defaults to
|
... |
Second possibility to pass the distribution family is to
pass a character string as |
RRdistr
returns an object of class RMmodel
.
RRdistr
is the generic model introduced
automatically when distribution families in R are used in the model
definition. See the examples below.
See Bayesian Modelling for a less technical introduction to hierarchical modelling.
The use of RRdistr
is completely on the risk of the user. There is no
way to check whether the expressions of the user are mathematically
correct.
Further, RRdistr
may not be used in connection with obsolete
commands of RandomFields.
RMmodel
,
RR,
RFsimulate
,
RFdistr
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | 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 <- 10
for (i in 1:n) {
readline(paste("Simulation no.", i, ": press return", sep=""))
plot(RFsimulate(model, x=x, seed=i))
}
## 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
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, seed=i))
}
## snd, part 1
## note that the fist 'exp' refers to the exponential function,
## the second to the exponential distribution.
(model1 <- RMgauss(var=exp(3), scale=exp(rate=1)))
x <- 1:100/10
plot(z1 <- RFsimulate(model=model, x=x))
## snd, part 2
## exactly the same result as in the previous example
(model2 <- RMgauss(var=exp(3), scale=RRdistr("exp", rate=1)))
plot(z2 <- RFsimulate(model=model, x=x))
all.equal(model1, model2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.