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
.CovarianceFct
, or
type PrintModelList()
to get all options.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 fuNA
the sill is kept fix. See Details.mleRF.default
and listed in the
following.TRUE
then internally, rescaled
covariance functions will be used for which
cov(1)$\approx$0.05. See Details.optim
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
.mleRF
to
likfit
of the package geoR
whose homepage is at
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
If a covariance function possesses additional parameters, seestable
inCovarianceFct
for example,
one may supply (vectors of) lower and upper limits bylower.kappa
andupper.kappa
.
Note that the values of these two parameters arenotrecycled if
the number of parameters of a covariance function
is a multiple of the length oflower.kappa
orupper.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 firstandthe 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
Seelower.kappa
.sill
Additionally to estimatingnugget
andvariance
separately, they may also be estimated together under the
condition thatnugget
+variance
=sill
.
For the latter a finite value forsill
has to be supplied,
andnugget
andvariance
are set toNA
.use.naturalscaling
logical. IfTRUE
then internally, rescaled
covariance functions will be used for which
cov(1)$\approx$0.05. However this parameter
does not influence
the output ofmleRF
: the parameter vector
returned bymleRF
refersalwaysto the standard covariance model as given inCovarianceFct
. (In contrast toPracticalRange
inRFparameters
.)
Advantages ifuse.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.use.naturalscaling==TRUE
:mleRF
.TRUE
.PrintLevel
0 : no message
1 : error messages
2 : warnings
3 : minimum debugging information
5 : extended debugging information, including graphics
Default:0
.trace.optim
see control parametertrace
ofoptim
. Default:0
.bins
number of bins for the empirical variogram (used in the
auxiliary target function, which is described at the beginning
of the Details). Default:20
.distance.factor
right boundary of the last
bin is calculated asdistance.factor
* (maximum distance
between all pairs of points).
Default:0.5
.upperbound.scale.factor
The upper bound for the scale is determined
asupperbound.scale.factor
* (maximum distance
between all pairs of points).
Default:10
.lowerbound.scale.factor
The lower bound for the scale is determined
as (minimum distance
between different pairs of points) /lowerbound.scale.factor
.
Default:20
.lowerbound.scale.LS.factor
For the auxiliary target function a different lower bound
for the scale is used. It is determined as (minimum distance
between different pairs of points) /lowerbound.scale.LS.factor
.
Default:5
.
upperbound.var.factor
The upper bound for the variance and the nugget is determined
asupperbound.var.factor
* var(data).
Default:10
.lowerbound.var.factor
The lower bound for the variance and the nugget is determined
as var(data) /lowerbound.var.factor
.
If either the nugget or the variance is fixed,
the parameter to be estimated
must also be greater thanlowerbound.sill
.
Default:100
.lowerbound.sill
Seelowerbound.var.factor
.
Default:1E-10
.scale.max.relative.factor
If the initial scale value for the ML estimation
obtained by the auxiliary target function is
less than (minimum distance
between different pairs of points) /scale.max.relative.factor
it is assumed that a nugget effect
is present. In case the user setnugget=0
,
the ML estimation is automatically performed
fornugget=NA
instead ofnugget=0
.
Note: ifscale.max.relative.factor
is greater
thanlowerbound.scale.LS.factor
thennugget
is never set toNA
as
the scale has the lower bound (minimum distance
between different pairs of points) /lowerbound.scale.LS.factor
.
Default:1000
.minbounddistance
If any value of the parameter vector
returned from the ML estimation
is closer thanminbounddistance
to any of the bounds or if any value
has a relative distance smaller thanminboundreldist
, 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
Seeminbounddistance
.
Default:0.02
.approximate.functioncalls
In case the parameter vector is too close to the given
bounds, the ML target function is evaluated on a grid
to get a new initial value for the ML estimation.
The number of points of the grid is approximatelyapproximate.functioncalls
.
Default:50
.geoR
whose homepage
is at 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.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)
Run the code above in your browser using DataLab