CovarianceFct {RandomFields} | R Documentation |
CovarianceFct
returns the values of a covariance function
Variogram
returns the values of a variogram model
PrintModelList
prints the list of currently implemented models
including the corresponding simulation methods
GetModelList
returns a matrix of currently implemented models
and their simulation methods
GetModelNames
returns a list of currently implemented models
CovarianceFct(x, model, param, dim=ifelse(is.matrix(x),ncol(x),1), fctcall="Covariance") Variogram(x, model, param, dim=ifelse(is.matrix(x),ncol(x),1)) PrintModelList() GetModelList(abbr=TRUE) GetModelNames()
x |
vector or (n x
dim )-matrix. In particular,
if the model is isotropic or dim=1 then x
is a vector. |
model |
character or list;
if character then name of the covariance function or
variogram model - see below, or type PrintModelList() for
all options; see Details for the definition of the model by a list.
|
param |
vector or matrix of parameters or missing, see Details
and Examples;
The simplest form is that param is vector of the form
param=c(NA,variance,nugget,scale,...) , in this order;The dots ... stand for additional parameters of the
model.
|
dim |
dimension of the space in which the model is applied |
fctcall |
this parameter should not be changed by the user |
abbr |
logical or numerical. If TRUE the names for the methods are
abbreviated. If numerical, abbr gives the number of letters. |
The implemented models are in standard notation for a covariance function (variance 1, nugget 0, scale 1) and for positive real arguments x (and t):
bessel
C(x)= 2^a Gamma(a+1)x^(-a) J_a(x)
The parameter a is greater than or equal to (d-2)/2, where d is the dimension of the random field.
fractalB
wave
cauchy
C(x)=(1+x^2)^(-a)
The parameter a is positive.
The model possesses two generalisations, the gencauchy
model and the hyperbolic
model.
cauchytbm
C(x)= (1+(1-b/c)x^a)(1+x^a)^(-b/a-1)
The parameter a is in (0,2] and b
is positive.
The model is valid for dimensions d<=c;
this has been shown for integer c, but the
package allows real values of c.
It allows for simulating random fields where
fractal dimension and Hurst coefficient can be chosen
independently.
It has negative correlations for b>c and large
x.
circular
C(x)=1-2/pi*(x sqrt(1-x^2)+asin(x)) if 0<=x<=1, 0 otherwise
This isotropic covariance function is valid only for dimensions less than or equal to 2.
constant
cone
RFMethods
); it is defined only in two dimensions.
The corresponding (boolean)
function is a truncated cone with socle. The base has radius
1/2. The model has three parameters, a,
b, and c:cubic
C(x)= 1- 7 x^2 + 8.75 x^3 - 3.5 x^5 + 0.75 x^7 if 0<=x<=1, 0 otherwise
This model is valid only for dimensions less than or equal to 3. It is a 2 times differentiable covariance functions with compact support.
cutoff
(hypermodel, see also below)
C(x) = phi(xB), 0 <= xA <= b
C(x) = b_0 (r - xB)^{2 c}, b <= xA <= bc
C(x) = 0, bc <= xA
The cutoff model is a functional of the covariance function phi. Since the model itself is indifferent for scale or anisotropy parameters, the latter must be given only for the submodels. See below for general comments on hypermodels.
The first parameter, a, gives the number of
subsequent models that build phi;
b>0, c>0.
The parameters r and b_0
are chosen internally such that C is a smooth function.
The parameters A and B are the inverse scale parameters for
the hypermodel and submodel, respectively. Note that cutoff
seldemly
works, if A and B are not identical.
The algorithm that checks the given parameters knows only about some few necessary conditions. Hence it is not ensured that the cutoff-model is a valid covariance function for any choice of phi and the parameters.
For certain models phi, i.e. stable
,
whittle
and gencauchy
, some sufficient conditions
are known.
dampedcosine
C(x)= exp(-a x) cos(x)
This model is valid for dimension 1 iff a>=0, for dimension 2 iff a>=1, and for dimension 3 iff a >= sqrt(3).
exponential
C(x)=exp(-x)
This model is a special case of the whittlematern
model
(for a=1/2 there)
and the stable
class (for a=1).
fractalB
(fractal Brownian motion)
gamma(x) = x^a
The parameter a is in (0,2]. (Implemented for up to three dimensions)
FD
C(k) = (-1)^k G(1-a/2)^2/(G(1-a/2+k)G(1-a/2-k)) for integer k
and linearly interpolated otherwise. Here, G is the Gamma function. The parameter a is in [-1, 1). The model is defined in 1 dimension only.
Remark: the fractionally differenced process stems from time series modelling where the grid locations are multiples of the scale parameter.
fractgauss
C(x) = 0.5 (|x+1|^a - 2|x|^a + |x-1|^a)
This model is the covariance function for the fractional Gaussian noise with Hurst parameter H =a/2, a in (0,2]. In particular, the model is valid only in one dimension.
gauss
C(x)=exp(-x^2)
This model is a special case of the stable
class
(for a=2 there).
Note that the corresponding function for the random coins
method (cf. the methods based on marked point processes in
RFMethods
) is
exp(-2 x^2).
See gneiting
for an alternative model that does not have
the disadvantages of the Gaussian model.
gencauchy
(generalised cauchy
)C(x)= (1+x^a)^(-b/a)
The parameter a is in (0,2], and b
is positive.
This model allows for simulating random fields where
fractal dimension and Hurst coefficient can be chosen
independently.
gengneiting
(generalised gneiting
)C(x)=[1 + (b+1) * x] * (1-x)^(b+1) if 0<=x<=1, 0 otherwise
if a=2 then
C(x)= [1 + (b+2) * x + ((b+2)^2-1) * x^2 / 3] * (1-x)^(b+2) if 0<=x<=1, 0 otherwise
if a=3 then
C(x)=[1 + (b+3) * x + (2 * (b+3)^2 - 3) * x^2 / 5 + ((b+3)^2 - 4) * (b+3) * x^3 / 15] * (1-x)^(b+3) if 0<=x<=1, 0 otherwise
The parameter a is a positive integer; here only the cases a=1, 2, 3 are implemented. The parameter b is greater than or equal to (d + 2a +1)/2 where d is the dimension of the random field.
gneiting
C(x)= (1 + 8 s x + 25 s^2 x^2 + 32 s^3 x^3)*(1-s x)^8 if 0 <= x <= 1/s, 0 otherwise
where
s=0.301187465825.
This isotropic covariance function is valid only for dimensions less
than or equal to 3.
It is a 6 times differentiable covariance functions with compact
support.
It is an alternative to the gaussian
model since
its graph is visually hardly distinguishable from the graph of
the Gaussian model, but possesses neither the mathematical and nor the
numerical disadvantages of the Gaussian model.
This model is a special case of gengneiting
(for
a=3 and b=5 there).
Note that, in the original work by Gneiting (1999),
s = 10 sqrt(2) / 47 ~=
.3008965, a numerical value slightly deviating from the
optimal one.
C(x)=(1 + 8 x/b + 25 (x/b)^2 + 32 (x/b)^3)*(1-x/b)^8 * 2^{1-a} Gamma(a)^{-1} x^a K_a(x) if 0<=x<=b, 0 otherwise
This isotropic covariance function is valid only for dimensions less
than or equal to 3.
The parameters a and b are
positive.
This class of models with compact support
allows for smooth parametrisation of the differentiability up to
order 6.
hyperbolic
C(x)= c^(-b) (K_b(a*c))^(-1) * (c^2 +x^2)^(0.5 b) * K_b(a sqrt(c^2 + x^2))
The parameters are such that
c>=0, a>0 and
b>0,
or
c>0 , a>0 and
b=0,
or
c>0 , a>=0, and
b<0.
Note that this class is over-parametrised; always one
of the three parameters
a, c, and scale
can be eliminated in the formula. Therefore, one of these
parameters should be kept fixed in any simulation study.
The model contains as special cases the whittlematern
model and the cauchy
model, for
c=0 and a=0, respectively.
iacocesare
C(x, t) = (1+||x||^a+|t|^b)^{-c}
The parameters a and b take values in [1,2]; the parameters c must be greater than or equal to half the space-time dimension.
bessel
whittlematern
power
(a=1
there).
lgd1
(local-global distinguisher)
C(x)= 1- b(a+b)^{-1}|x|^a for |x|<= 1 and a(a+b)^{-1}|x|^-b for |x|> 1
Here b>0 and a is in (0, 1.5-d/2] for dimension d=1,2. The random field has fractal dimension d + 1 - a/2 and Hurst coefficient 1 - b/2 for b in (0,1]
mastein
(hypermodel for non-separabel space time modelling)
C(x, t)=Gamma(b + g(t)) Gamma(b + c) / [Gamma(b + g(t) + c) Gamma(b)] W_{b + g(t)}(|x - Vt|)
Gamma is the Gamma function; g is a variogram; W is the Whittle-Matern model. The first parameter, a, gives the number of subsequent models that build g. Here, the names of covariance models can also be used; the algorithm chooses the corresponding variograms then. The parameter b is the smoothness parameter of the Whittle-Matern model (for t=0) and must be positive. Finally, c must be greater than or equal to half the dimension of x. Instead of the velocity parameter V, the anisotropy matrix for the hyper model is chosen appropriately. Note that the anisotropy matrix must be such that (x,t) is transformed into a purely spatial vector, i.e. the entries in last column of the matrix are all naught. On the other hand, all entries of the anisotropy matrices in the submodels that build gamma is naught except the very last, purely temporal one.
Note, that for numerical reasons, b + g(t) may not exceed
the value 80.0. If exceeded NA
is returned or the algorithm fails.
whittlematern
.
nsst
(Non-Separable Space-Time model)
C(x,t)= psi(t)^{-f} phi(x / psi(t))
This model is used for space-time modelling where the spatial
component is isotropic.
phi is the stable
model if b=1;
phi is the whittlematern
model if b=2;
phi is the cauchy
model if b=3;
Here, a is the respective parameter for the model;
the restrictions on a are described there.
The function psi satisfies
psi^2(t) =
(t^c+1)^d if e=1
psi^2(t) = (d^{-1} t^c+1)/(t^c+1) if e=2
psi^2(t) = -log(t^c+1/d)/log d
if e=3
The parameter f must be greater than or equal to
the genuine spatial dimension of the field. Furthermore, c in (0,2] and d in (0,1).
The spatial dimension must be >=1
.
nsst2
C(x,t)= psi(t)^{-g} phi(x / psi(t))
This model is used for space-time modelling where the spatial
component is isotropic. Here
phi is the gencauchy
model
if c=1.
The parameters a and b
are the respective parameters for the model.
The function psi satisfies
psi^2(t) =
(t^d+1)^e if f=1
psi^2(t) = (e^{-1} t^d+1)/(t^d+1) if f=2
psi^2(t) = -log(t^d+1/e)/log e
if f=3
The parameter g must be greater than or equal to
the genuine spatial dimension of the field. Furthermore, d in (0,2] and e in (0,1].
Necessarily, dim>=2
.
The spatial dimension must be >=1
.
nugget
1(x==0)
If the model is used in param
-definition mode,
either param[2]
, the variance
,
or param[3]
, the nugget
, must be zero.
If the model is used in the list-definition mode,
the anisotropy matrix must be given in an anisotropic
context, but not
the scale parameter in an isotropic context.
penta
C(x)= 1 - 22/3 x^2 +33 x^4 - 77/2 x^5 + 33/2 x^7 - 11/2 x^9 + 5/6 x^11 if 0<=x<=1, 0 otherwise
valid only for dimensions less than or equal to 3. This is a 4 times differentiable covariance functions with compact support.
power
C(x)= (1-x)^a if 0<=x<=1, 0 otherwise
This covariance function is valid for dimension d if a >= (d+1)/2. For a=1 we get the well-known triangle (or tent) model, which is valid on the real line, only.
stable
.
qexponential
C(x) = (2 exp(-x)-a exp(-2x))/(2-a)
The parameter a takes values in [0,1].
spherical
C(x)= 1 - 1.5 x + 0.5 x^3 if 0<=x<=1, 0 otherwise
This isotropic covariance function is valid only for dimensions less than or equal to 3.
stable
C(x)=exp(-x^a)
The parameter a is in (0,2].
See exponential
and gaussian
for special cases.
Stein
(hypermodel, see also below)
C(x) = a_0 + a_2 (xB)^2 + phi(xB), 0 <= xA <= b
C(x) = b_0 (c - xB)^3/(xB), b <= xA <= bc
C(x) = 0, bc <= xA
The Stein model is a functional of the covariance function phi. Since the model itself is indifferent for scale or anisotropy parameters, the latter must be given only for the submodels. See below for general comments on hypermodels.
The first parameter, a, gives the number of subsequent models that build phi; b>0, c>=1. The parameters a_0, a_2 and b_0 are chosen internally such that C becomes a smooth function. The parameters A and B are the inverse scale parameters for the hypermodel and submodel, respectively.
Note that if A and B are not identical,
Stein
seldemly
works; it may also happen that unsound results
are returned without any message of failure.
The algorithm that checks the given parameters knows only about some few necessary conditions. Hence it is not ensured that the Stein-model is a valid covariance function for any choice of phi and the parameters.
For certain models phi, i.e. stable
,
whittle
, gencauchy
, and the variogram
model fractalB
some sufficient conditions are known.
steinst1
(non-separabel space time model)
C(x, t) = W_a(y) - <x, z> t W_{a-1}(y) / [(a - 1)(2a + b)]
Here, W_a is the Whittle-Matern model with smoothness parameter a; b is greater than or equal to the space-time dimension ‘dim’; y = ||(x,t)||. The components of z are given by c, d, ...; the norm of z must less than or equal to 1.
stable
.
power
.
power
.
wave
C(x)=sin(x)/x if x>0 and C(0)=1
This isotropic covariance function is valid only for dimensions less
than or equal to 3.
It is a special case of the bessel
model
(for a=0.5).
whittlematern
C(x)=W_a(x) =2^{1-a} Gamma(a)^{-1} x^a K_a(x),
The parameter a is positive.
This is the model of choice if the smoothness of a random field is to
be parametrised: if a>=(2m+1)/2 then the
graph is m times differentiable.
The model is a special case of the
hyperbolic
model (for c=0 there).
Let cov be a model given in standard notation. Then the covariance model applied with arbitrary variance and scale equals
variance * cov( (.)/scale).
For a given covariance function cov the variogram gamma equals
gamma(x) = cov(0) - cov(x).
Note that the value of the covariance function or variogram
depends also on
RFparameters
()$PracticalRange
. If the latter is
TRUE
and the covariance model is isotropic
then the covariance function is internally
rescaled such that cov(1)~=0.05 for standard
parameters (scale=1
).
The model and the parameters can be specified by three different forms; the first ‘standard’ form allows for the specification of the covariance model as given above for an isotropic random field. The second form defines isotropic nested models using matrices. The third form allows for defining anisotropic and/or space-time models using lists; here any basic models can arbitrarily be combined by multiplication and summation.
model
is a string; param
is a vector of the form
param=c(mean,variance,nugget,scale,...)
. (These components
might be given separately or bound to a simple list passed to
model
.)
The first component of param is reserved for the mean
of a random field and thus ignored in the evaluation of the covariance
function or variogram. The parameters mean, variance, nugget, and scale
must be given in this order; additional
parameters have to be supplied in case of a parametrised class of
models (e.g. hyperbolic
, see below),
in the order a, b, c.
Let cov be a model given in standard notation. Then the covariance model applied with arbitrary variance, nugget, and scale equals
nugget + variance * cov( (.)/scale).
Some models allow certain parameter combinations only for certain
dimensions. As any model valid in d dimensions is also valid in 1
dimension, the default in CovarianceFct
and Variogram
is dim=1
.
model
is a string; param
is a matrix with columns
of the form c(variance, scale, ...)
.
Except that the entries for the mean
and the nugget
are missing all explanations given above also apply here.
Each column defines a summand of the nested model. A nugget effect
is indicated by scale=0
; possibly additional parameters
are ignored.
model
is a list as specified below; param
is
missing.
model = list(l.1, OP.1, l.2, OP.2, ..., l.n)
where n is at most 10 (except cutoff embedding
is
used, see RFMethods). The lists l.i
are all either of the form l.i =
list(model=,var=,kappas=,scale=,method=)
or of the form l.i = list(model=,var=,kappas=,aniso=,method=)
.
model
is a string; var
gives the variance;
scale
is a scalar whereas aniso
is a d x d matrix, which is multiplied from the right to the
n x d matrix of points;
at the transformed points the values of the (isotropic)
random field (with scale 1) are
calculated. The dimension d of matrix must match the
number of columns of x
. The models given by l.i
can be combined by OP.i="+"
or OP.i="*"
.
method
is ignored here; it can be set in
GaussRF
.
Important! Hyper models are in an experimental stage:
(i) the (current) algorithm does not allow for a complete
check whether the parameters for a hypermodel are well chosen.
So, only use parameter combinations for which you are sure they lead to a
positive definite function.
(ii) behaviour and parameters may change in future version!
CovarianceFct
returns a vector of values of the covariance function.
Variogram
returns a vector of values of the variogram model.
PrintModelList
prints a table of the currently implemented covariance
functions and the matching methods.
PrintModelList
returns NULL
.
GetModelNames
returns a list of implemented models
Martin Schlather, martin.schlather@math.uni-goettingen.de http://www.stochastik.math.uni-goettingen.de/institute;
Yindeng Jiang jiangyindeng@gmail.com (circulant embedding methods ‘cutoff’ and ‘intrinsic’)
Overviews:
Cauchy models, generalisations and extensions
Gneiting's models
Holeeffect model
Hyperbolic model
Iaco-Cesare model
lgd
Ma-Stein model
nsst
Power model
fractalB
EmpiricalVariogram
,
GetPracticalRange
,
parameter.range
,
RandomFields
,
RFparameters
,
ShowModels
.
PrintModelList() x <- 0:100 # the following five model definitions are the same! ## (1) very traditional form (cv <- CovarianceFct(x, model="bessel", c(NA,2,1,5,0.5))) ## (2) traditional form in list notation model <- list(model="bessel", param=c(NA,2,1,5,0.5)) cv - CovarianceFct(x, model=model) ## (3) nested model definition cv - CovarianceFct(x, model="bessel", param=cbind(c(2, 5, 0.5), c(1, 0, 0))) #### most general notation in form of lists ## (4) isotropic notation model <- list(list(model="bessel", var=2, kappa=0.5, scale=5), "+", list(model="nugget", var=1)) cv - CovarianceFct(x, model=model) ## (5) anisotropic notation model <- list(list(model="bessel", var=2, kappa=0.5, aniso=0.2), "+", list(model="nugget", var=1, aniso=1)) cv - CovarianceFct(as.matrix(x), model=model) # The model gneitingdiff was defined in RandomFields v1.0. # This isotropic covariance function is valid for dimensions less # than or equal to 3 and has two positive parameters. # It is a class of models with compact support that allows for # smooth parametrisation of the differentiability up to order 6. # The former model `gneitingdiff' must now be coded as gneitingdiff <- function(p){ list(list(m="gneiting", v=p[2], s=p[6]*p[4]), "*", list(m="whittle", k=p[5], v=1.0, s=p[4]), "+", list(m="nugget", v=p[3])) } # and then param <- c(NA, runif(5,max=10)) CovarianceFct(0:100,gneitingdiff(param)) ## instead of formerly CovarianceFct(x,"gneitingdiff",param) # definition of a hypermodel is more complex model <- list(list(model="mastein", var=1, aniso=c(1, -0.5, 0, 0), kappa=c(1, 0.5, 1.5)), "(", list(model="exp", var=1, aniso=c(0, 0, 0, 1))) CovarianceFct(cbind(0:10, 0:10), model=model)