RFoptions(seed=0, xi=0)
## seed=0: *ANY* simulation will have the random seed 0; set
## RFoptions(seed=NA) to make them all random again
## xi=0: any simulated max-staable random field has extreme value index 0
x <- seq(0, 2, if (interactive()) 0.01 else 1)
## standard use of RPschlather (i.e. a standardized Gaussian field)
z <- RFsimulate(RPschlather(RMgauss()), x)
plot(z, type="l")
## the following refers to the standard use, but obviously is incorrect
try(RFsimulate(model=RPschlather(RMgauss(var=2)), x=x, grid=TRUE))
## the following refers to the generalized use of RPschlather, where
## any random field can be used. Note that 'z' and 'z2' have the same
## .Random.seed (and the same simulation method), hence the same values
z2 <- RFsimulate(model=RPschlather(RPgauss(RMgauss(var=2))), x=x, grid=TRUE)
plot(z2, type="l")
all.equal(z, z2) # true
if (.C("isAuthor", a=integer(1))$a) { # OK
model <- RMgauss()
x <- seq(0,10, 0.02)
z <- RFsimulate(RPschlather(model, xi=0), x,
n=if (interactive()) 100 else 1)
plot(z)
hist(unlist(z@data), 50, freq=FALSE)
curve(exp(-x) * exp(-exp(-x)), from=-3, to=8, add=TRUE)
## for some more sophisticated models see 'maxstableAdvanced'
}
FinalizeExample()
Run the code above in your browser using DataLab