GeoSimCopula {GeoModels}R Documentation

Simulation of Gaussian and non Gaussian Random Fields using copula.

Description

Simulation of Gaussian and some non Gaussian spatial, spatio-temporal and spatial bivariate random fields using Gaussian or Clayton copula. The function return a realization of a Random Field for a given covariance model and covariance parameters. Simulation is based on Cholesky decomposition.

Usage

GeoSimCopula(coordx, coordy=NULL, coordt=NULL, 
coordx_dyn=NULL, corrmodel, distance="Eucl",
      GPU=NULL, grid=FALSE, local=c(1,1),
      method="cholesky", model='Gaussian', n=1, param,
      anisopars=NULL,radius=6371, sparse=FALSE,
      copula="Gaussian",seed=NULL, X=NULL,spobj=NULL,nrep=1)

Arguments

coordx

A numeric (d \times 2)-matrix (where d is the number of spatial sites) giving 2-dimensions of spatial coordinates or a numeric d-dimensional vector giving 1-dimension of spatial coordinates. Coordinates on a sphere for a fixed radius radius are passed in lon/lat format expressed in decimal degrees.

coordy

A numeric vector giving 1-dimension of spatial coordinates; coordy is interpreted only if coordx is a numeric vector or grid=TRUE otherwise it will be ignored. Optional argument, the default is NULL then coordx is expected to be numeric a (d \times 2)-matrix.

coordt

A numeric vector giving 1-dimension of temporal coordinates. Optional argument, the default is NULL then a spatial RF is expected.

coordx_dyn

A list of m numeric (d_t \times 2)-matrices containing dynamical (in time) spatial coordinates. Optional argument, the default is NULL

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 Eucl, the euclidean distance. See the Section Details of GeoFit.

GPU

Numeric; if NULL (the default) no GPU computation is performed.

grid

Logical; if FALSE (the default) the data are interpreted as spatial or spatial-temporal realisations on a set of non-equispaced spatial sites (irregular grid).

local

Numeric; number of local work-items of the GPU

method

String; the type of matrix decomposition used in the simulation. Default is cholesky. The other possible choices is svd.

model

String; the type of RF and therefore the densities associated to the likelihood objects. Gaussian is the default, see the Section Details.

n

Numeric; the number of trials for binomial RFs. The number of successes in the negative Binomial RFs. Default is 1.

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)

sparse

Logical; if TRUE then cholesky decomposition is performed using sparse matrices algorithms (spam packake). It should be used with compactly supported covariance models.FALSE is the default.

copula

String; the type of copula. It can be "Clayton" or "Gaussian"

seed

Numeric; an integer used in set.seed function to reproduce the simulation.

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 GeoSimCopula. An object of class GeoSimCopula is a list containing at most the following components:

bivariate

Logical:TRUE if the Gaussian RF is bivariate, otherwise FALSE;

coordx

A d-dimensional vector of spatial coordinates;

coordy

A d-dimensional vector of spatial coordinates;

coordt

A t-dimensional vector of temporal coordinates;

coordx_dyn

A list of dynamical (in time) spatial coordinates;

corrmodel

The correlation model; see GeoCovmatrix.

data

The vector or matrix or array of data, see GeoFit;

distance

The type of spatial distance;

method

The method of simulation

model

The type of RF, see GeoFit.

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

A list of the parameters

radius

The radius of the sphere if coordinates are passed in lon/lat format;

randseed

The seed used for the random simulation;

spacetime

TRUE if spatio-temporal and FALSE if spatial RF;

copula

The type of copula

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

Examples

library(GeoModels)

################################################################
###
### Example q. Simulation of a reparametrized Beta RF
### for beta regression
### with Gaussian and Clayton Copula 
### with  underlying Wendland correlation.
###
###############################################################
set.seed(261)
NN=1400
x <- runif(NN);y <- runif(NN)
coords=cbind(x,y)

shape1=3
shape2=3
smooth=0


corrmodel="GenWend"
min=0;max=1


X=cbind(rep(1,NN),runif(NN))

NuisParam("Beta2",num_betas=2,copula="Gaussian")
CorrParam("GenWend")


#### Gaussian copula
param=list(smooth=smooth,power2=4, min=min,max=max,
             mean=0.1,mean1=0.1,scale=0.3,nugget=0,shape=5)

data <- GeoSimCopula(coordx=coords, corrmodel=corrmodel, model="Beta2",param=param,
  copula="Gaussian",sparse=TRUE,X=X)$data

quilt.plot(coords,data)


#### Clayton copula
NuisParam("Beta2",num_betas=2,copula="Clayton")
CorrParam("GenWend")
param=list(smooth=smooth,power2=4, min=min,max=max,
             mean=0.2,mean1=0.1,scale=0.3,nugget=0,shape=6,nu=4)
data1 <- GeoSimCopula(coordx=coords, corrmodel=corrmodel, model="Beta2",param=param,
  copula="Clayton",sparse=TRUE,X=X)$data

hist(data1,freq=FALSE)
quilt.plot(coords,data1)


[Package GeoModels version 2.0.2 Index]