WLeastSquare: WLS of Gaussian and Max-Stable Random Fields

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

View source: R/WeightedLeastSquare.r

Description

the function returns the parameters' estimates and the estimates' variances of a random field obtained by the weigthed least squares estimator.

Usage

1
2
3
4
WLeastSquare(data, coordx, coordy=NULL, coordt=NULL, corrmodel,
             distance="Eucl", fixed=NULL, grid=FALSE, maxdist=NULL,
             maxtime=NULL,  model='Gaussian', optimizer='Nelder-Mead',
             numbins=NULL, replicates=1, start=NULL, weighted=FALSE)

Arguments

data

A d-dimensional vector (a single spatial realisation) or a (n x d)-matrix (n iid spatial realisations) or a (d x d)-matrix (a single spatial realisation on regular grid) or an (d x d x n)-array (n iid spatial realisations on regular grid) or a (t x d)-matrix (a single spatial-temporal realisation) or an (t x d x n)-array (n iid spatial-temporal realisations) or or an (d x d x t)-array (a single spatial-temporal realisation on regular grid) or an (d x d x t x n)-array (n iid spatial-temporal realisations on regular grid). See FitComposite for details.

coordx

A numeric (d x 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.

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 x 2)-matrix.

coordt

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

corrmodel

String; the name of a correlation model, for the description (see FitComposite).

distance

String; the name of the spatial distance. The default is Eucl, the euclidean distance. See the Section Details of FitComposite.

fixed

A named list giving the values of the parameters that will be considered as known values. The listed parameters for a given correlation function will be not estimated, i.e. if list(nugget=0) the nugget effect is ignored.

grid

Logical; if FALSE (the default) the data are interpreted as a vector or a (n x d)-matrix, instead if TRUE then (d x d x n)-matrix is considered.

maxdist

A numeric value denoting the maximum distance, see Details and FitComposite.

maxtime

Numeric; an optional positive value indicating the maximum temporal lag considered in the composite-likelihood computation (see FitComposite.

model

String; the type of random field. Gaussian is the default, see FitComposite for the different types.

optimizer

String; the optimization algorithm (see optim for details). 'Nelder-Mead' is the default.

numbins

A numeric value denoting the numbers of bins, see the Section Details

replicates

Numeric; a positive integer denoting the number of independent and identically distributed (iid) replications of a spatial or spatial-temporal random field. Optional argument, the default value is 1 then a single realisation is considered.

start

A named list with the initial values of the parameters that are used by the numerical routines in maximization procedure. NULL is the default (see FitComposite).

weighted

Logical; if TRUE then the weighted least square estimator is considered. If FALSE (the default) then the classic least square is used.

Details

The numbins parameter indicates the number of adjacent intervals to consider in order to grouped distances with which to compute the (weighted) lest squares.

The maxdist parameter indicates the maximum distance below which the shorter distances will be considered in the calculation of the (weigthed) least squares.

Value

Returns an object of class WLS. An object of class WLS is a list containing at most the following components:

bins

Adjacent intervals of grouped distances;

bint

Adjacent intervals of grouped temporal separations

centers

The centers of the bins;

coordx

The vector or matrix of spatial coordinates;

coordy

The vector of spatial coordinates;

coordt

The vector of temporal coordinates;

convergence

A string that denotes if convergence is reached;

corrmodel

The correlation model;

data

The vector or matrix of data;

distance

The type of spatial distance;

fixed

The vector of fixed parameters;

iterations

The number of iteration used by the numerical routine;

message

Extra message passed from the numerical routines;

model

The type of random fields;

numcoord

The number of spatial coordinates;

numrep

The number of the iid replicatations of the random field;

numtime

The number the temporal realisations of the random field;

param

The vector of parameters' estimates;

srange

The minimum and maximum spatial distance;

trange

The minimum and maximum temporal separations;

variograms

The empirical spatial variogram;

variogramt

The empirical temporal variogram;

variogramst

The empirical spatial-temporal variogram;

weighted

A logical value indicating if its the weighted method;

wls

The value of the least squares at the minimum.

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.

Barry, J. T., Crowder, M. J. and Diggle, P. J. (1997) Parametric estimation of the variogram. Tech. Report, Dept Maths & Stats, Lancaster University.

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, optim

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
library(CompRandFld)
library(RandomFields)
set.seed(2111)

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


################################################################
###
### Example 1. Least square fitting of a Gaussian random field
### with exponential correlation.
### One spatial replication is simulated.
### Unweighted version (all weights equals to 1).
###
###############################################################

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

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

fix<-list(nugget=0)
ini<-list(scale=scale,sill=sill)
# Least square fitting of the random field:
fit <- WLeastSquare(data, x, y, corrmodel=corrmodel,fixed=fix,start=ini)

# Results:
print(fit)


################################################################
###
### Example 2. Least square fitting of a max-stable random field
### (Extremal Gaussian model) with exponential correlation
### n iid spatial replications.
### Unweighted version (all weights equals to 1).
###
###############################################################


# Simulation of the max-stable random field:
data <- RFsim(x, y, corrmodel=corrmodel, model="ExtGauss",
              param=list(mean=mean, sill=sill, nugget=nugget,
              scale=scale), replicates=40)$data

# Least square fitting of the random field:
fit <- WLeastSquare(data, x, y, corrmodel=corrmodel, model="ExtGauss",
                    replicates=40)

# Results:
print(fit)

################################################################
###
### Example 3. Least square fitting of a spatio-temporal
### Gaussian random field with double exponential correlation.
### One replication is simulated.
### Weighted version (all weights equals to 1).
###
###############################################################

# Define the temporal sequence:
#time <- seq(1, 25, 1)

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

#fix<-list(nugget=nugget)
#ini<-list(scale_s=scale,scale_t=1,sill=1)
# Weighted least square estimation:
#fit <- WLeastSquare(data, x, y, time, corrmodel="exp_exp", maxdist=5,
#                    maxtime=5,fixed=fix,start=ini)

# Results
#print(fit)

CompRandFld documentation built on Jan. 8, 2020, 3:01 p.m.