GeoSimapprox | R Documentation |
Simulation of Gaussian and some non Gaussian spatial, spatio-temporal and spatial bivariate random fields using two approximate methods of simulation: circulant embeeding and turning band. (see Examples).
GeoSimapprox(coordx, coordy=NULL, coordz=NULL,coordt=NULL,
coordx_dyn=NULL,corrmodel, distance="Eucl",GPU=NULL,
grid=FALSE,local=c(1,1),max.ext=1,
method="TB", L=1000,model='Gaussian',parallel=FALSE,ncores=NULL,
n=1,param,anisopars=NULL, radius=6371,X=NULL,spobj=NULL,
nrep=1,progress=TRUE)
coordx |
A numeric ( |
coordy |
A numeric vector giving 1-dimension of
spatial coordinates; Optional argument, the default is |
coordz |
A numeric vector giving 1-dimension of
spatial coordinates; Optional argument, the default is |
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. |
parallel |
Logical; if |
ncores |
Numeric; number of cores involved in parallelization. |
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. |
progress |
Logic; If TRUE then a progress bar is shown. |
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; |
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
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)
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
###############################################################
set.seed(68)
x = seq(0,1,0.005)
y = seq(0,1,0.005)
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 Tukey-h RF
### with GenWend-Matern covariance model
### using Turning band method
### It works for (ir)regular grid
###############################################################
set.seed(68)
x = runif(50000)
y = runif(50000)
coords=cbind(x,y)
param=list(smooth=0.5,mean=0,sill=1,scale=0.04,nugget=0,tail=0.15,power2=1/4)
# Simulation of a spatial Gaussian RF with Matern correlation function
data1 <- GeoSimapprox(coords, corrmodel="GenWend_Matern", model="Tukeyh",
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="")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.