GeoCorrFct {GeoModels}R Documentation

Spatial and Spatio-temporal correlation or covariance of (non) Gaussian random fields

Description

The function computes the correlations of a spatial (or spatio-temporal or bivariate spatial) Gaussian or non Gaussian randomm field for a given correlation model and a set of spatial (temporal) distances.

Usage

GeoCorrFct(x,t=NULL,corrmodel, model="Gaussian",
distance="Eucl", param, radius=6371,n=1,
covariance=FALSE,variogram=FALSE)

Arguments

x

A set of spatial distances.

t

A set of (optional) temporal distances.

corrmodel

String; the name of a correlation model, for the description see the Section Details.

model

String; the type of RF. See GeoFit.

distance

String; the name of the spatial distance. The default is Eucl, the euclidean distance. See GeoFit.

param

A list of parameter values required for the covariance model.

radius

Numeric; a value indicating the radius of the sphere when using covariance models valid using the great circle distance. Default value is the radius of the earth in Km (i.e. 6371)

n

Numeric; the number of trials in a (negative) binomial random fields. Default is 1.

covariance

Logic; if TRUE then the covariance is returned. Default is FALSE

variogram

Logic; if FALSE then the covariance/coorelation is returned. Otherwise the associated semivariogram is returned

Value

Returns correlations or covariances values associated to a given parametric spatial and temporal correlation models.

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 1. Correlation of a Gaussian random field with underlying 
### Matern correlation model
###
###############################################################
# Define the spatial distances
x = seq(0,1,0.005)
# Correlation Parameters for Matern model 
CorrParam("Matern")
NuisParam("Gaussian")
# Matern Parameters 
param=list(sill=1,smooth=0.5,scale=0.2/3,nugget=0,mean=0)
corr= GeoCorrFct(x=x, corrmodel="Matern", param=param,model="Gaussian")
plot(x,corr,ylim=c(0,1),type="l")

################################################################
###
### Example 2. Correlation of a Gaussian random field with underlying 
### Generalized Wendland-Matern correlation model
###
###############################################################
CorrParam("GenWend_Matern")
NuisParam("Gaussian")
# GenWend Matern Parameters 
param=list(sill=1,smooth=1,scale=0.1,nugget=0,power2=1/4,mean=0)
corr= GeoCorrFct(x=x, corrmodel="GenWend_Matern", param=param,model="Gaussian")
plot(x,corr,ylim=c(0,1),type="l")

################################################################
###
### Example 3. Correlation of a t random field with underlying 
### Generalized Wendland correlation model
###
###############################################################
CorrParam("GenWend")
NuisParam("StudentT")
x = seq(0,1,0.005)
param=list(sill=1,smooth=1,scale=0.5,nugget=0,power2=5,df=1/6,mean=0)
corr= GeoCorrFct(x=x, corrmodel="GenWend", param=param,model="StudentT")
plot(x,corr,ylim=c(0,1),type="l")

################################################################
###
### Example 4. Correlation of a LoggGaussian random field with underlying 
### Kummer correlation model
###
###############################################################
CorrParam("Kummer")
NuisParam("LogGaussian")
# GenWend Matern Parameters 
param=list(smooth=1,sill=0.5,scale=0.1,nugget=0,power2=1,mean=0)
corr= GeoCorrFct(x=x, corrmodel="Kummer", param=param,model="LogGaussian")
plot(x,corr,ylim=c(0,1),type="l")

################################################################
###
### Example 5. Correlation of Weibull random field with underlying 
### Generalized Cauchy correlation model
###
###############################################################
CorrParam("GenCauchy")
NuisParam("Weibull")
x = seq(0,1,0.005)
param=list(scale=0.2,nugget=0,power1=0.8, power2=0.8,shape=4,mean=0)
corr= GeoCorrFct(x=x, corrmodel="GenCauchy", param=param,model="Weibull")
plot(x,corr,ylim=c(0,1),type="l")

################################################################
###
### Example 6. Covariance of Poisson random field with underlying 
### Matern correlation model
###
###############################################################
CorrParam("Matern")
NuisParam("Poisson")
x = seq(0,1,0.005)
param=list(scale=0.6/3,nugget=0,smooth=0.5,mean=2)
cova= GeoCorrFct(x=x, corrmodel="Matern", param=param,model="Poisson",covariance=TRUE)
plot(x,cova,ylim=c(0,exp(2)),type="l")


################################################################
###
### Example 7. Correlation of a space time Gaussian random field 
### with underlying  spacetime separable Matern correlation model
###
###############################################################

## spatial and temporal distances 
h<-seq(0,3,by=0.05)
times<-seq(0,3,by=0.05)

# Correlation Parameters for the space time separable Matern model 
CorrParam("Matern")
NuisParam("Gaussian")
# Matern Parameters 
param=list(sill=1,scale_s=0.8/3,scale_t=1,nugget=0,mean=0,smooth_s=1.5,smooth_t=0.5)

corr= GeoCorrFct(x=h,t=times,corrmodel="Matern_Matern", param=param,model="Gaussian")

cc=matrix(corr,nrow=length(h),ncol=length(times))
persp(cc,x= h,y=times, theta = 20, phi = 30, 
                   ticktype = "detailed",zlab="",xlab="Distance",ylab="Time")


################################################################
###
### Example 8. Correlation of a bivariate Gaussian random field 
### with underlying  separable bivariate  Matern correlation model
###
###############################################################
# Define the spatial distances
x = seq(0,1,0.005)
# Correlation Parameters for the bivariate sep Matern model 
CorrParam("Bi_Matern_sep")
# Matern Parameters 
param=list(sill_1=1,sill_2=1,smooth=0.5,scale=0.2/3,mean_1=0,
                       mean_2=0,nugget_1=0,nugget_2=0,pcol=0.2)
corr= GeoCorrFct(x=x, corrmodel="Bi_Matern_sep", param=param,model="Gaussian")

# first correlation
plot(x,corr[1,],ylim=c(0,1),type="l")
# cross correlation
plot(x,corr[2,],ylim=c(0,1),type="l")
# second correlation
plot(x,corr[3,],ylim=c(0,1),type="l")


[Package GeoModels version 2.0.1 Index]