library(RandomFields) ## Overview over the implemented models RFgetModelNames(group.by=c("operator", "domain")) # RFoptions(seed = 0) x <- y <- seq(-10, 10, 0.1) model <- RMexp() simu <- RFsimulate(model, x, y, grid=TRUE) plot(simu) model <- RMexp(var=3, scale=5) simu <- RFsimulate(model, x, y, grid=TRUE) plot(simu) model <- RMexp(var=3, scale=5) + RMnugget(var=4) simu <- RFsimulate(model, x, y, grid=TRUE) plot(simu) x <- y <- seq(-10, 10, 0.2) ## Example 1 M1 <- c(0.9, 0.43) M2 <- c(0.43, 0.9) model <- RMmatrix(M = M1, RMwhittle(nu = 0.3)) + RMmatrix(M = M2, RMwhittle(nu = 2, scale = 2)) plot(model, dim = 2, xlim = c(-3, 3)) simu <- RFsimulate(model, x, y, grid = TRUE) plot(simu) ## Example 2 model <- RMbiwm(nudiag = c(1, 2), nured = 1, rhored = 1, cdiag = c(1, 5), s = c(1, 1, 2)) plot(model, dim = 2, xlim = c(-3, 3)) simu <- RFsimulate(model, x, y, grid = TRUE) plot(simu) str(RFgetModel()) ## Example 3 model <- RMcurlfree(RMmatern(nu = 5), scale = 4) plot(model, dim = 2, xlim = c(-3, 3)) simu <- RFsimulate(model, x, y, grid = TRUE) plot(simu, select.variables = list(1, 2 : 3, 4)) ## Example 4 Aniso <- RMangle(pi / 4, diag = c(1, 2)) nsst <- RMnsst(Aniso=Aniso, phi=RMgauss(), psi=RMfbm(alpha=1), delta=2) plot(nsst, xlim=c(-3,3), dim=2) simu <- RFsimulate(nsst, x, x) plot(simu) sep <- RMmult(RMexp(proj=1), RMwave(proj=2, scale=1.2), Aniso=matrix(ncol=2, c(2, 1, -1, 3))) plot(sep, xlim=c(-3,3), dim=2) simu <- RFsimulate(sep, x, x) plot(simu) Aniso2 <- RMuser(fctn=floor(x) + (x - floor(x))^2, vdim=2) nonstat <- RMcauchy(Aniso = Aniso2, gamma=1) plot(nonstat, xlim=c(-3,3), dim=2) model <- nsst + sep + nonstat plot(model, xlim=c(-1, 1), dim=2) simu <- RFsimulate(model, x=x, y=x, n=4) plot(simu) ## Example 5 S <- RMuser(fctn=exp(-as.matrix(dist(x))) + 0.1 * diag(2) * (x[1]==x[2]), vdim=c(2, 2)) model <- RMstp(xi=RMgauss(), phi = RMstable(alpha=1.5), z = rep(0, 2), S = S, M = matrix(ncol=2, nrow=2, 0) ) plot(model, xlim=c(-3, 3), dim=2) x <- y <- seq(-4, 4, 0.2) ## takes 3min; ## seq(-8, 8, 0.2) take too much time, currently simu <- RFsimulate(model, x, y, grid = TRUE) plot(simu) ############################# ## Suggestions for exercises ############################# ## explore further multivariate models ?RMdelay ?RMschur ?RMbigneiting ## explore vector valued models ?RMdivfree ?RMvector ?RMkolmogorov ## explore anisotropic models ## any RMmodel allows for the parameter Aniso, see ?RMmodel ?RMangle ?RMuser ## explore hierarchical modelling ?RRdistr ## explore LMC ## * with dependent C, e.g. using the bivariate Whittle-Matern model ## * or with k>2 with independent components; see ?RMparswm for dependent ones