georob
This page documents the methods deviance
,
logLik
, extractAIC
, add1
, drop1
,
step
and waldtest
for the class georob
. The package
georob
provides a generic step
function and a default
method which is identical with the (non-generic) function
step
.
# S3 method for georob
deviance(object, warn = TRUE, REML = FALSE, ...)# S3 method for georob
logLik(object, warn = TRUE, REML = FALSE, ...)
# S3 method for georob
extractAIC(fit, scale = 0, k = 2, ...)
# S3 method for georob
add1(object, scope, scale = 0, test = c("none", "Chisq"), k = 2,
trace = FALSE, fixed = TRUE, use.fitted.param = TRUE, verbose = 0,
ncores = 1, ...)
# S3 method for georob
drop1(object, scope, scale = 0, test = c("none", "Chisq"), k = 2,
trace = FALSE, fixed = TRUE, use.fitted.param = TRUE, verbose = 0,
ncores = 1, ...)
step(object, ...)
# S3 method for default
step(object, scope, scale = 0,
direction = c("both", "backward", "forward"), trace = 1,
keep = NULL, steps = 1000, k = 2, ...)
# S3 method for georob
step(object, scope, scale = 0,
direction = c("both", "backward", "forward"), trace = 1,
keep = NULL, steps = 1000, k = 2,
fixed.add1.drop1 = TRUE, fixed.step = fixed.add1.drop1,
use.fitted.param = TRUE, verbose = 0, ncores = 1, ...)
# S3 method for georob
waldtest(object, ..., vcov = NULL, test = c("F", "Chisq"),
name = NULL)
The method deviance.georob
returns the deviance of the fitted
spatial linear model with the attributes log.det.covmat
containing the logarithm of the determinant of the covariance matrix
\( \tau^2 \boldsymbol{I} + \boldsymbol{\Gamma}_\theta \)
of the observations and optionally
log.det.xticovmatx
with the logarithm of the determinant of
\(
\boldsymbol{X}^\mathrm{T} (\tau^2
\boldsymbol{I} + \boldsymbol{\Gamma}_\theta)^{-1} \boldsymbol{X}
\), when REML = true
,
see Details above.
The method logLik.georob
returns an object of class logLik
with the maximized (restricted) log-likelihood, see Details above
and logLik
.
The method extractAIC.georob
returns a numeric vector of length 2
with the first and second elements giving the equivalent degrees of
freedom and the (generalized) Akaike Information Criterion for the fitted
model fit
.
The methods add1.georob
and drop1.georob
return objects of
class anova
which are data.frame
s summarizing the
differences in fit between models. In addition to the customary
variables Df
and AIC
the output contains a logical variable
Converged
which signals (non-)convergence when fitting the
respective sub-model.
The generic function step
returns the stepwise selected model plus
optionally some additional attributes depending on the method.
The methods step.default
and step.georob
return the
stepwise-selected model with up to two additional components
(anova
, keep
), see step
for details.
The method waldtest.georob
returns an object of class anova
which contains the residual degrees of freedom, the difference in degrees of freedom, Wald statistic (either "Chisq" or "F") and corresponding
p-value.
an object of class georob
, see
georobObject
.
a character keyword with the mode of stepwise search,
see step
.
a logical scalar controlling whether the
variogram parameters are not adjusted when add
ing or
drop
ping model terms by add1
and drop1
(default
TRUE
), see Details.
a logical scalar controlling whether the variogram
parameters are not adjusted after having called add1
and
drop1
in step
(default TRUE
), see Details.
a numeric specifying the 'weight' of the equivalent degrees of
freedom (=: edf) part in the AIC formula, see
extractAIC
.
a filter function whose input is a fitted model object and the
associated AIC
statistic, and whose output is arbitrary,
see step
.
a function for extracting a suitable name/description from a
fitted model object. By default the name is queried by calling
formula
, see
waldtest
.
an integer specifying the number of cores used for
parallelized execution of add1
and drop1
. If larger than
one then the minimum of ncores
, parallel::detectCores()
and the number of terms to be added or dropped determines the number of
cores that is actually used.
a logical scalar controlling whether the restricted log-likelihood
should be extracted (default TRUE
).
a numeric, currently not used, see
extractAIC
.
defines the range of models examined in the stepwise search.
This should be either a single formula, or a list containing
components upper
and lower
, both formulae,
see step
for details.
a numeric with the maximum number of steps to be considered
(default is 1000), see step
.
a character keyword specifying whether to compute the large
sample Chi-squared statistic (with asymptotic Chi-squared distribution)
or the finite sample F statistic (with approximate F distribution), see
waldtest
.
a numeric. If positive, information is printed during the
running of step
, see step
.
a logical scalar controlling whether fitted
values of param
(and aniso
are used as initial values
when variogram parameters are fitted afresh for add
ing and
drop
ping terms from the model (default TRUE
). If equal
to FALSE
then the initial values in object[["call"]]
are
used.
a function for estimating the covariance matrix of the
regression coefficients, see waldtest
.
a positive integer controlling logging of diagnostic
messages to the console during model fitting, see georob
(default 0
).
a logical scalar controlling whether warnings should be suppressed.
additional arguments passed to methods (see in particular
waldtest.default
).
Andreas Papritz papritz@retired.ethz.ch.
For a non-robust fit the function deviance
returns the residual deviance
$$(\boldsymbol{Y} - \boldsymbol{X} \widehat{\boldsymbol{\beta}})^{\mathrm{T}}
(\widehat{\tau}^2 \boldsymbol{I} +
\boldsymbol{\Gamma}_{\widehat{\theta}})^{-1}
(\boldsymbol{Y} - \boldsymbol{X} \widehat{\boldsymbol{\beta}})
$$
(see georobPackage
for an explanation of the notation).
For a robust fit the deviance is not defined. The function then computes with a warning
the deviance of an equivalent Gaussian model with heteroscedastic nugget
\(\tau^2/\boldsymbol{w}\) where \(\boldsymbol{w}\) are
the “robustness weights” rweights
, see georobObject
.
logLik
returns the maximized (restricted) log-likelihood. For
a robust fit, the log-likelihood is not defined. The function then
computes the (restricted) log-likelihood of an equivalent Gaussian model with
heteroscedastic nugget (see above).
The methods extractAIC
, add1
, drop1
and step
are used for stepwise model building.
If fixed=TRUE
or
fixed.add1.drop1=TRUE
(default) then the variogram parameters are
kept fixed at the values of object
. For
fixed=FALSE
or fixed.add1.drop1=FALSE
the variogram
parameters are fitted afresh for each model tested by add1
and
drop1
. Then either the variogram parameters in
object$initial.objects
(use.fitted.param=FALSE
) or the
fitted parameters of object
(use.fitted.param=TRUE
) are
used as initial values. For fixed.step=TRUE
the variogram
parameters are not fitted afresh by step
after the calls to
drop1
and add1
have been completed, unlike for
fixed.step=FALSE
where the parameters are estimated afresh for
the new model that minimized AIC (BIC) in the previous step.
In addition, the functions of the R package multcomp can be used to test general linear hypotheses about the fixed effects of the model.
georobPackage
for a description of the model and a brief summary of the algorithms;
georob
for (robust) fitting of spatial linear models;
georobObject
for a description of the class georob
;
profilelogLik
for computing profiles of Gaussian likelihoods;
plot.georob
for display of RE(ML) variogram estimates;
control.georob
for controlling the behaviour of georob
;
cv.georob
for assessing the goodness of a fit by georob
;
georobMethods
for further methods for the class georob
;
predict.georob
for computing robust Kriging predictions;
lgnpp
for unbiased back-transformation of Kriging prediction
of log-transformed data;
georobSimulation
for simulating realizations of a Gaussian process
from model fitted by georob
; and finally
sample.variogram
and fit.variogram.model
for robust estimation and modelling of sample variograms.
data(meuse)
## Gaussian REML fit
r.logzn.reml <- georob(log(zinc) ~ sqrt(dist), data = meuse, locations = ~ x + y,
variogram.model = "RMexp",
param = c(variance = 0.15, nugget = 0.05, scale = 200),
tuning.psi = 1000)
summary(r.logzn.reml, correlation = TRUE)
deviance(r.logzn.reml)
logLik(r.logzn.reml)
waldtest(r.logzn.reml, .~. + ffreq)
step(r.logzn.reml, ~ sqrt(dist) + ffreq + soil)
## robust REML fit
if(interactive()){
## example is run only in interactive session because cpu times exceeds 5 s
r.logzn.rob <- update(r.logzn.reml, tuning.psi = 1)
deviance(r.logzn.rob)
logLik(r.logzn.rob)
logLik(r.logzn.rob, REML=TRUE)
step(r.logzn.rob, ~ sqrt(dist) + ffreq + soil, fixed.step=FALSE, trace=2)
}
Run the code above in your browser using DataLab