mleRF {RandomFields} | R Documentation |
This function estimates arbitrary parts of the parameter vector of a random field specification by maximising the likelihood.
mleRF(coord, data, model, param, lower.kappa=NULL, upper.kappa=NULL, sill=NA, ...) mleRF.default(coord, data, model, param, lower.kappa=NULL, upper.kappa=NULL, sill=NA, use.naturalscaling=TRUE, PrintLevel=0, trace.optim=0, bins=20, distance.factor=0.5, upperbound.scale.factor=10, lowerbound.scale.factor=20, lowerbound.scale.LS.factor=5, upperbound.var.factor=10, lowerbound.var.factor=100, lowerbound.sill=1e-10, scale.max.relative.factor=1000, minbounddistance=0.001, minboundreldist=0.02, approximate.functioncalls=50, pch="*")
coord |
(n x 2)-matrix of coordinates. |
data |
vector of values measured at coord . |
model |
string; covariance model, see CovarianceFct , or
type PrintModelList() to get all options. |
param |
vector of parameters for a random field specification:
param=c(mean, variance, nugget, scale,...) ;
the parameters must be given
in this order. Further parameters are to be added in case of a
parametrised class of covariance functions, see
CovarianceFct .
Any components set to NA are estimated; the others
are kept fix.
|
lower.kappa |
lower bounds for additional parameters of a parametrised class. |
upper.kappa |
upper bounds for additional parameters of a parametrised class. |
sill |
If not NA the sill is kept fix. See Details. |
... |
arguments as given in mleRF.default and listed in the
following. |
use.naturalscaling |
logical. If TRUE then internally, rescaled
covariance functions will be used for which
cov(1)~=0.05. See Details. |
PrintLevel |
level to which messages are shown. See Details. |
trace.optim |
tracing of the function optim |
bins |
number of bins of the empirical variogram. See Details. |
distance.factor |
relative right bound for the bins. See Details. |
upperbound.scale.factor |
relative upper bound for scale. See Details. |
lowerbound.scale.factor |
relative lower bound for scale. See Details. |
lowerbound.scale.LS.factor |
relative lower bound for scale in an auxiliary function call. See Details. |
upperbound.var.factor |
relative upper bound for variance and nugget. See Details. |
lowerbound.var.factor |
relative lower bound for variance and nugget. See Details. |
lowerbound.sill |
absolute lower bound for variance and nugget. See Details. |
scale.max.relative.factor |
relative lower bound for scale below which an additional nugget effect is detected. See Details. |
minbounddistance |
absolute distance to the bounds below which a part of the algorithm is considered as having failed. See Details. |
minboundreldist |
relative distance to the bounds below which a part of the algorithm is considered as having failed. See Details. |
approximate.functioncalls |
approximate evaluations of the ML target function on a grid. See Details. |
pch |
character shown before each step of calculation; depending on the specification there are two to five steps. Default: "*". |
The maximisation is performed using optim
. Since optim
needs as input parameter an initial vector of parameters, mleRF
estimates this initial parameter first using an auxiliary target
function, namely weighted least squares for the empirical variogram.
If the best parameter vector of the MLE found so far is too close
to some given bounds, see the specific parameters below, it is
assumed that
optim
ran into a local minimum because of a bad starting
value by the auxiliary target function.
In this case the MLE target function is calculated on a grid, the
best parameter vector is taken, and the optimisation is restarted with
this parameter vector.
Comments on specific parameters:
lower.kappa
stable
in CovarianceFct
for example,
one may supply (vectors of) lower and upper limits by
lower.kappa
and upper.kappa
.
Note that the values of these two parameters are not
recycled if
the number of parameters of a covariance function
is a multiple of the length of lower.kappa
or
upper.kappa
.
In case a covariance model has more than one parameter, and
if the second parameter is to be estimated, say, then limits
for the first and the second parameters should be supplied.
(The function assigns the given limits to the parameters by
always starting with the first parameter, whether it is estimated
or not.)
It is advised to limit seriously the domain of the additional
parameters of the covariance model and/or the total number of
parameters to be estimated, if additional parameters
of the covariance model are also estimated.
upper.kappa
lower.kappa
.
sill
nugget
and variance
separately, they may also be estimated together under the
condition that nugget
+ variance
= sill
.
For the latter a finite value for sill
has to be supplied,
and nugget
and variance
are set to NA
.
use.naturalscaling
TRUE
then internally, rescaled
covariance functions will be used for which
cov(1)~=0.05. However this parameter
does not influence
the output of mleRF
: the parameter vector
returned by mleRF
refers
always to the standard covariance model as given in
CovarianceFct
. (In contrast to PracticalRange
in RFparameters
.)use.naturalscaling==TRUE
:
scale
and the shape parameter of a parameterised
covariance model can be estimated better if they are estimated
simultaneously.
upperbound.scale.factor
, lowerbound.scale.factor
,
etc. might be more realistic.
Disadvantages if use.naturalscaling==TRUE
:
mleRF
.
Default: TRUE
.
PrintLevel
0
.
trace.optim
trace
of
optim
. Default: 0
.
bins
20
.
distance.factor
distance.factor
* (maximum distance
between all pairs of points).
Default: 0.5
.
upperbound.scale.factor
upperbound.scale.factor
* (maximum distance
between all pairs of points).
Default: 10
.
lowerbound.scale.factor
lowerbound.scale.factor
.
Default: 20
.
lowerbound.scale.LS.factor
lowerbound.scale.LS.factor
.
Default: 5
.upperbound.var.factor
upperbound.var.factor
* var(data).
Default: 10
.
lowerbound.var.factor
lowerbound.var.factor
.
If either the nugget or the variance is fixed,
the parameter to be estimated
must also be greater than lowerbound.sill
.
Default: 100
.
lowerbound.sill
lowerbound.var.factor
.
Default: 1E-10
.
scale.max.relative.factor
scale.max.relative.factor
it is assumed that a nugget effect
is present. In case the user set nugget=0
,
the ML estimation is automatically performed
for nugget=NA
instead of nugget=0
.
Note: if scale.max.relative.factor
is greater
than lowerbound.scale.LS.factor
then
nugget
is never set to NA
as
the scale has the lower bound (minimum distance
between different pairs of points) /
lowerbound.scale.LS.factor
.
Default: 1000
.
minbounddistance
minbounddistance
to any of the bounds or if any value
has a relative distance smaller than
minboundreldist
, then it is assumed that
the MLE algorithm has dropped into a local minimum,
and it will be continued with evaluating the
ML target function on a grid, cf. the beginning paragraphs
of the Details.
Default: 0.001
.
minboundreldist
minbounddistance
.
Default: 0.02
.
approximate.functioncalls
approximate.functioncalls
.
Default: 50
.
Another maximum likelihood estimator for random fields
exists as part of the package geoR
whose homepage
is at http://www.maths.lancs.ac.uk/~ribeiro/geoR.html.
However, the philosophies of mleRF
and likfit
of the
package geoR
differ. The function likfit
offers more possibilities and higher
flexibility concerning co-variates and value transformations,
for example. By way of contrast, mleRF
is still restricted to
estimating parts of the parameter vector of a random field (as a
consistent part of the package RandomFields
). However, mleRF
allows for estimating any combination of the components of this
parameter vector. In case both functions can be used,
the parameters estimated
by likfit
and mleRF
agree in about 95
percent of the cases. Concerning the remaining cases, likfit
beats mleRF
more frequently than vice versa; however
mleRF
does not need initial values for the optimisation,
and the code of mleRF
is in general faster.
A vector of the form
c(mean,variance,nugget,sill,...)
is returned, i.e.
the parameter vector of the ML estimation including the fixed
components.
Here, the dots ...
stand for additional parameters of the covariance model, see
CovarianceFct
.
Thanks to Paulo Ribeiro for hints and comparing mleRF
to
likfit
of the package geoR
whose homepage is at
http://www.maths.lancs.ac.uk/~ribeiro/geoR.html.
This function does not depend on the value of
RFparameters()$PracticalRange
.
The function mleRF
always uses the standard specification
of the covariance model as given in CovarianceFct
.
Martin Schlather, Martin.Schlather@uni-bayreuth.de http://www.geo.uni-bayreuth.de/~martin
Ribeiro, P. and Diggle, P. (2001) Software for geostatistical analysis using R and S-PLUS: geoR and geoS, version 0.6.15. http://www.maths.lancs.ac.uk/~ribeiro/geoR.html.
CovarianceFct
,
GetPracticalRange
,
RandomFields
.
model <-"expon" param <- c(0,1,0,1) estparam <- c(NA,NA,0,NA) ## NA means here: "to be estimated" ## sequence in `estparam' is ## mean, variance, nugget, scale, (+ further model parameters) ## So, mean, variance, and scale will be estimated here. ## Nugget is fixed and equals zero. points <- 100 x <- runif(points,0,3) y <- runif(points,0,3) ## 100 random points in square [0, 3]^2 f <- GaussRF(x=x, y=y, grid=FALSE, model=model, param=param) mleRF(coord=cbind(x,y), data=f, model=model, param=estparam)