Covariogram: Computes covariance, variogram and extremal coefficient...

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/Covariogram.r

Description

The procedure computes and/or plots the covariance, the variogram or the extremal coefficient functions and the practical range estimated fitting a Gaussian or max-stable random field with the composite-likelihood or using the weighted least square method. Allows to add to the variogram or extremal coefficient plots the empirical estimates.

Usage

1
2
3
4
5
6
Covariogram(fitted, lags=NULL, lagt=NULL, answer.cov=FALSE,
            answer.vario=FALSE, answer.extc=FALSE,
            answer.range=FALSE, fix.lags=NULL, fix.lagt=NULL,
            show.cov=FALSE, show.vario=FALSE, show.extc=FALSE,
            show.range=FALSE, add.cov=FALSE, add.vario=FALSE,
            add.extc=FALSE, pract.range=95, vario, ...)

Arguments

fitted

A fitted object obtained from the FitComposite or WLeastSquare procedures.

lags

A numeric vector of distances.

lagt

A numeric vector of temporal separations.

answer.cov

Logical; if TRUE a vector with the estimated covariance function is returned; if FALSE (the default) the covariance is not returned.

answer.vario

Logical; if TRUE a vector with the estimated variogram is returned; if FALSE (the default) the variogram is not returned.

answer.extc

Logical; if TRUE a vector with the estimated extremal coefficient is returned; if FALSE (the default) the variogram is not returned.

answer.range

Logical; if TRUE the estimated pratical range is returned; if FALSE (the default) the pratical range is not returned.

fix.lags

Integer; a positive value denoting the spatial lag to consider for the plot of the temporal profile.

fix.lagt

Integer; a positive value denoting the temporal lag to consider for the plot of the spatial profile.

show.cov

Logical; if TRUE the estimated covariance function is plotted; if FALSE (the default) the covariance function is not plotted.

show.vario

Logical; if TRUE the estimated variogram is plotted; if FALSE (the default) the variogram is not plotted.

show.extc

Logical; if TRUE the estimated extremal coefficient is plotted; if FALSE (the default) the extremal coefficient is not plotted.

show.range

Logical; if TRUE the estimated pratical range is added on the plot; if FALSE (the default) the pratical range is not added.

add.cov

Logical; if TRUE the vector of the estimated covariance function is added on the current plot; if FALSE (the default) the covariance is not added.

add.vario

Logical; if TRUE the vector with the estimated variogram is added on the current plot; if FALSE (the default) the correlation is not added.

add.extc

Logical; if TRUE the vector with the estimated extremal coefficient is added on the current plot; if FALSE (the default) the correlation is not added.

pract.range

Numeric; the percent of the sill to be reached.

vario

A Variogram object obtained from the EVariogram procedure.

...

other optional parameters which are passed to plot functions.

Value

The returned object is eventually a list with:

covariance

The vector of the estimated covariance function;

variogram

The vector of the estimated variogram function;

extrcoeff

The vector of the estimated extremal coefficient function;

pratical.range

The estimated practial range.

Author(s)

Simone Padoan, simone.padoan@unibocconi.it, http://faculty.unibocconi.it/simonepadoan; Moreno Bevilacqua, moreno.bevilacqua@uv.cl, https://sites.google.com/a/uv.cl/moreno-bevilacqua/home.

References

Padoan, S. A. and Bevilacqua, M. (2015). Analysis of Random Fields Using CompRandFld. Journal of Statistical Software, 63(9), 1–27.

Cooley, D., Naveau, P. and Poncet, P. (2006) Variograms for spatial max-stable random fields. Dependence in Probability and Statistics, p. 373–390.

Cressie, N. A. C. (1993) Statistics for Spatial Data. New York: Wiley.

Gaetan, C. and Guyon, X. (2010) Spatial Statistics and Modelling. Spring Verlang, New York.

Smith, R. L. (1990) Max-Stable Processes and Spatial Extremes. Unpublished manuscript, University of North California.

See Also

FitComposite, WLeastSquare

Examples

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
library(CompRandFld)
library(RandomFields)
library(scatterplot3d)
set.seed(31231)

# Set the coordinates of the points:
x <- runif(100, 0, 10)
y <- runif(100, 0, 10)
coords<-cbind(x,y)

################################################################
###
### Example 1. Plot of covariance and variogram functions
### estimated from a Gaussian random field with exponent 
### correlation. One spatial replication is simulated.
###
###
###############################################################

# Set the model's parameters:
corrmodel <- "exponential"
mean <- 0
sill <- 1
nugget <- 0
scale <- 2

# Simulation of the Gaussian random field:
data <- RFsim(coordx=coords, corrmodel=corrmodel, param=list(mean=mean,
              sill=sill, nugget=nugget, scale=scale))$data

# Maximum composite-likelihood fitting of the Gaussian random field:

start<-list(scale=scale,sill=sill,mean=mean(data))
fixed<-list(nugget=nugget)
# Maximum composite-likelihood fitting of the random field:
fit <- FitComposite(data, coordx=coords, corrmodel=corrmodel,likelihood="Marginal",
                     type="Pairwise",start=start,fixed=fixed,maxdist=6)

# Results:
print(fit)

# Empirical estimation of the variogram:
vario <- EVariogram(data, x, y)

# Plot of covariance and variogram functions:
par(mfrow=c(1,2))
Covariogram(fit, show.cov=TRUE, show.range=TRUE,
            show.vario=TRUE, vario=vario,pch=20)


################################################################
##
### Example 2. Plot of covariance and extremal coefficient
### functions estimated from a max-stable random field with
### exponential correlation. n idd spatial replications are
### simulated.
###
###############################################################

set.seed(1156)
# Simulation of the max-stable random field:
data <- RFsim(coordx=coords, corrmodel=corrmodel, model="ExtGauss", replicates=20,
              param=list(mean=mean,sill=sill,nugget=nugget,scale=scale))$data

start=list(sill=sill,scale=scale)
# Maximum composite-likelihood fitting of the max-stable random field:
fit <- FitComposite(data, coordx=coords, corrmodel=corrmodel, model='ExtGauss',
                    replicates=20, varest=TRUE, vartype='Sampling',
                    margins="Frechet",start=start)

data <- Dist2Dist(data, to='sGumbel')

# Empirical estimation of the madogram:
vario <- EVariogram(data, coordx=coords, type='madogram', replicates=20)

# Plot of correlation and extremal coefficient functions:
par(mfrow=c(1,2))
Covariogram(fit, show.cov=TRUE, show.range=TRUE, show.extc=TRUE,
            vario=vario, pract.range=84,pch=20)


################################################################
###
### Example 3. Plot of covariance and variogram functions
### estimated from a Gaussian spatio-temporal random field with
### double-exp correlation.
### One spatio-temporal replication is simulated.
###
###############################################################

# Define the spatial-coordinates of the points:
#x <- runif(20, 0, 1)
#y <- runif(20, 0, 1)
# Define the temporal sequence:
#time <- seq(0, 30, 1)

# Simulation of the spatio-temporal Gaussian random field:
#data <- RFsim(x, y, time, corrmodel="exp_exp",param=list(mean=mean,
#              nugget=nugget,scale_s=0.5,scale_t=1,sill=sill))$data

# Maximum composite-likelihood fitting of the space-time Gaussian random field:
#fit <- FitComposite(data, x, y, time, corrmodel="exp_exp", maxtime=5,
#                    likelihood="Marginal",type="Pairwise", fixed=list(
#                    nugget=nugget, mean=mean),start=list(scale_s=0.2,
#                    scale_t=1, sill=sill))

# Empirical estimation of spatio-temporal covariance:
#vario <- EVariogram(data, x, y, time, maxtime=10)

# Plot of the fitted space-time covariace
#Covariogram(fit,show.cov=TRUE)

# Plot of the fitted space-time variogram
#Covariogram(fit,vario=vario,show.vario=TRUE)

# Plot of covariance, variogram and spatio and temporal profiles:
#Covariogram(fit,vario=vario,fix.lagt=1,fix.lags=1,show.vario=TRUE,pch=20)

################################################################
###
### Example 4. Plot of parametric and empirical lorelograms
### estimated from a Binary Gaussian random fields with 
### exponential correlation. One spatial replication is
### simulated.
###
###############################################################

#set.seed(1240)

# Define the spatial-coordinates of the points:
#x <- seq(0,3, 0.1)
#y <- seq(0,3, 0.1)

# Simulation of the Binary Gaussian random field:
#data <- RFsim(x, y, corrmodel=corrmodel, model="BinaryGauss",
#              threshold=0,param=list(nugget=nugget,mean=mean,
#              scale=.6,sill=0.8))$data

# Maximum composite-likelihood fitting of the Binary Gaussian random field:
#fit <- FitComposite(data, x, y, corrmodel=corrmodel, model="BinaryGauss",
#                    maxdist=0.8, likelihood="Marginal", type="Pairwise",
#                    start=list(mean=mean,scale=0.1,sill=0.1))

# Empirical estimation of the lorelogram:
#vario <- EVariogram(data, x, y, type="lorelogram", maxdist=2)

# Plot of fitted and empirical lorelograms:
#Covariogram(fit, vario=vario, show.vario=TRUE, lags=seq(0.1,2,0.1),pch=20)

Example output

Loading required package: sp
Loading required package: RandomFieldsUtils

Attaching package: 'RandomFields'

The following object is masked from 'package:RandomFieldsUtils':

    RFoptions


##################################################################
Maximum Composite-Likelihood Fitting of Gaussian Random Fields

Setting: Marginal Composite-Likelihood 

Model associated to the likelihood objects: Gaussian 

Type of the likelihood objects: Pairwise 

Covariance model: exponential 
Number of spatial coordinates: 100 
Number of dependent temporal realisations: 1 
Number of replicates of the random field: 1 
Number of estimated parameters: 3 

Maximum log-Composite-Likelihood value: -6734.94

Estimated parameters:
   mean    scale     sill  
-0.2512   1.1151   0.5963  

##################################################################
Warning message:
In RandomFields::MaxStableRF(x = initparam$coordx, y = initparam$coordy,  :
  The function is obsolete. Use 'RFsimulate' instead.

CompRandFld documentation built on Jan. 10, 2020, 9:08 a.m.