GeoSimapprox {GeoModels} | R Documentation |
Fast simulation of Gaussian and non Gaussian Random Fields.
Description
Simulation of Gaussian and some non Gaussian spatial, spatio-temporal and spatial bivariate random fields using approximate methods of simulation (circulant embeeding and turning bands) (see Examples).
Usage
GeoSimapprox(coordx, coordy=NULL, coordt=NULL,
coordx_dyn=NULL,corrmodel, distance="Eucl",GPU=NULL,
grid=FALSE,local=c(1,1),max.ext=1,
method="TB", L=2000,model='Gaussian',
n=1,param,anisopars=NULL, radius=6371,X=NULL,spobj=NULL,nrep=1)
Arguments
coordx |
A numeric ( |
coordy |
A numeric vector giving 1-dimension of
spatial coordinates; |
coordt |
A numeric vector giving 1-dimension of
temporal coordinates. Optional argument, the default is |
coordx_dyn |
A list of |
corrmodel |
String; the name of a correlation model, for the description see the Section Details. |
distance |
String; the name of the spatial distance. The default
is |
GPU |
Numeric; if |
grid |
Logical; if |
local |
Numeric; number of local work-items of the GPU |
max.ext |
Numeric; The maximum extension of the simulation window (for the spatial CE method). |
method |
String; the type of approximation method. Default is |
L |
Numeric; the number of lines in the turning band method. |
model |
String; the type of RF and therefore the densities associated to the likelihood
objects. |
n |
Numeric; the number of trials for binomial RFs. The number of successes in the negative Binomial RFs. Default is |
param |
A list of parameter values required in the simulation procedure of RFs, see Examples. |
anisopars |
A list of two elements "angle" and "ratio" i.e. the anisotropy angle and the anisotropy ratio, respectively. |
radius |
Numeric; a value indicating the radius of the sphere when using the great circle distance. Default value is the radius of the earth in Km (i.e. 6371) |
X |
Numeric; Matrix of space-time covariates. |
spobj |
An object of class sp or spacetime |
nrep |
Numeric; Numbers of indipendent replicates. |
Value
Returns an object of class GeoSim
.
An object of class GeoSim
is a list containing
at most the following components:
bivariate |
Logical: |
coordx |
A |
coordy |
A |
coordt |
A |
coordx_dyn |
A list of dynamical (in time) spatial coordinates; |
corrmodel |
The correlation model; see |
data |
The vector or matrix or array of data, see
|
distance |
The type of spatial distance; |
method |
The method of simulation |
model |
The type of RF, see |
n |
The number of trial for Binomial RFs;the number of successes in a negative Binomial RFs; |
numcoord |
The number of spatial coordinates; |
numtime |
The number the temporal realisations of the RF; |
param |
The vector of parameters' estimates; |
radius |
The radius of the sphere if coordinates are passed in lon/lat format; |
spacetime |
|
nrep |
The number of indipendent replicates; |
Author(s)
Moreno Bevilacqua, moreno.bevilacqua89@gmail.com,https://sites.google.com/view/moreno-bevilacqua/home, Víctor Morales Oñate, victor.morales@uv.cl, https://sites.google.com/site/moralesonatevictor/, Christian", Caamaño-Carrillo, chcaaman@ubiobio.cl,https://www.researchgate.net/profile/Christian-Caamano
References
T. Gneiting, H. Sevcikova, D. B. Percival, M. Schlather and Y. Jiang (2006) Fast and Exact Simulation of Large Gaussian Lattice Systems in R2: Exploring the Limits Journal of Computational and Graphical Statistics 15 (3)
D. Arroyo, X. Emery (2020) An R Implementation of a Continuous Spectral Algorithm for Simulating Vector Gaussian Random Fields in Euclidean Spaces ACM Transactions on Mathematical Software 47(1)
J. Guiness (2018) Permutation and Grouping Methods for Sharpening Gaussian Process Approximations Technometrics 60(4) 415-429.
Examples
library(GeoModels)
################################################################
###
### Example 1. Simulation of a large spatial Gaussian RF
### with Matern covariance model
### using circulant embeeding method
### It works only for regular grid
### for any typpe of correlation model
###############################################################
set.seed(68)
x = seq(0,1,0.006)
y = seq(0,1,0.006)
param=list(smooth=1.5,mean=0,sill=1,scale=0.2/3,nugget=0)
# Simulation of a spatial Gaussian RF with Matern correlation function
data1 <- GeoSimapprox(coordx=x,coordy=y, grid=TRUE,corrmodel="Matern", model="Gaussian",
method="CE",param=param)$data
fields::image.plot( matrix(data1, length(x), length(y), byrow = TRUE) )
################################################################
###
### Example 2. Simulation of a large spatial Gaussian RF
### with Matern covariance model
### using Turning band method
### It works for (ir)regular grid
### for the Matern model
###############################################################
set.seed(68)
x = runif(8000)
y = runif(8000)
coords=cbind(x,y)
param=list(smooth=0.5,mean=0,sill=1,scale=0.1,nugget=0)
# Simulation of a spatial Gaussian RF with Matern correlation function
data1 <- GeoSimapprox(coords, corrmodel="Matern", model="Gaussian",
method="TB",param=param)$data
quilt.plot(coords,data1)
################################################################
###
### Example 3. Simulation of a large spacetime Gaussian RF
### with separable matern covariance model
### using Circular embeeding method
### It works for (large) regular time grid
###############################################################
set.seed(68)
coordt <- (0:100)
coords <- cbind( runif(100, 0 ,1), runif(100, 0 ,1))
param <- list(mean = 0, sill = 1, nugget = 0.25,
scale_s = 0.05, scale_t = 2,
smooth_s = 0.5, smooth_t = 0.5)
# Simulation of a spatial Gaussian RF with Matern correlation function
param<-list(nugget=0,mean=0,scale_s=0.2/3,scale_t=2/3,sill=1,smooth_s=0.5,smooth_t=0.5)
data <- GeoSimapprox(coordx=coords, coordt=coordt, corrmodel="Matern_Matern",
model="Gaussian",method="CE",param=param)$data
dim(data)
################################################################
###
### Example 4. Simulation of a large spacetime Gaussian RF
### with separable GenWend covariance model
### using Circular embeeding method in time
###############################################################
set.seed(68)
# Simulation of a spatial Gaussian RF with Matern correlation function
param<-list(nugget=0,mean=0,scale_s=0.2,scale_t=3,sill=1,
smooth_s=0,smooth_t=0, power2_s=4,power2_t=4)
data <- GeoSimapprox(coordx=coords, coordt=coordt, corrmodel="GenWend_GenWend",
model="Gaussian",method="CE",param=param)$data
dim(data)
################################################################
###
### Example 6. Simulation of a large bivariate Gaussian RF
### with bivariate Matern correlation model
###
###############################################################
# Define the spatial-coordinates of the points:
#x <- runif(20000, 0, 2)
#y <- runif(20000, 0, 2)
#coords <- cbind(x,y)
# Simulation of a bivariate spatial Gaussian RF:
# with a Bivariate Matern
#set.seed(12)
#param=list(mean_1=4,mean_2=2,smooth_1=0.5,smooth_2=0.5,smooth_12=0.5,
# scale_1=0.12,scale_2=0.1,scale_12=0.15,
# sill_1=1,sill_2=1,nugget_1=0,nugget_2=0,pcol=0.5)
#data <- GeoSimapprox(coordx=coords,corrmodel="Bi_matern",
# param=param,method="TB",L=1000)$data
#opar=par(no.readonly = TRUE)
#par(mfrow=c(1,2))
#quilt.plot(coords,data[1,],col=terrain.colors(100),main="1",xlab="",ylab="")
#quilt.plot(coords,data[2,],col=terrain.colors(100),main="2",xlab="",ylab="")