georobThis 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, data = NULL, 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, data = NULL, 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)
an object of class georob, see
georobObject.
an optional data frame.
the mode of stepwise search, see
step.
logical controlling whether the variogram parameters are
not adjusted when
adding or dropping model terms by add1
and drop1 (default TRUE), see Details.
logical controlling whether the variogram parameters are
not adjusted after having called add1 and drop1 in
step (default TRUE), see Details.
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.
integer specifying the number of cores used for
parallelized execution of add1 and drop1. If larger than
one then the minimum of ncores, detectCores() and the number of
terms to be added or dropped determines the number of cores that is
actually used.
logical controlling whether the restricted log-likelihood
should be extracted (default TRUE).
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.
the maximum number of steps to be considered
(default is 1000), see step.
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.
if positive, information is printed during the running of
step, see step.
logical scalar controlling whether fitted
values of param (and aniso are used as initial values
when variogram parameters are fitted afresh for adding and
dropping terms from the model (default TRUE).
a function for estimating the covariance matrix of the
regression coefficients, see waldtest.
positive integer controlling logging of diagnostic
messages to the console during model fitting, see georob
(default 0).
logical scalar controlling whether warnings should be suppressed.
additional arguments passed to methods (see in particular
waldtest.default).
Note that the data frame passed as data
argument to georob must exist in the user workspace
when calling step.georob, add1.georob or drop1.georob.
For a non-robust fit the function deviance returns the residual deviance
$$(\mbox{\boldmath $Y -X \widehat{\beta}$})^{\mathrm{T}}
(\widehat{\tau}^2 \mbox{\boldmath$I$\unboldmath} +
\mbox{\boldmath$\Gamma$\unboldmath}_{\widehat{\theta}})^{-1}
(\mbox{\boldmath $Y -X \widehat{\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/\mbox{\boldmath $w$\unboldmath}\) where \(\mbox{\boldmath $w$\unboldmath}\) are
the “robustness weights” rweights, see georobObject.
logLik returns the 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.
georobIntro 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.
# NOT RUN {
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,
control = control.georob(cov.bhat = TRUE, cov.ehat.p.bhat = TRUE))
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
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