georob (version 0.3-6)

georobModelBuilding: S3 Methods for Stepwise Building Fixed-Effects Models for Class georob

Description

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.

Usage

# 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)

Arguments

object, fit

an object of class georob, see georobObject.

data

an optional data frame.

direction

the mode of stepwise search, see step.

fixed,fixed.add1.drop1

logical controlling whether the variogram parameters are not adjusted when adding or dropping model terms by add1 and drop1 (default TRUE), see Details.

fixed.step

logical controlling whether the variogram parameters are not adjusted after having called add1 and drop1 in step (default TRUE), see Details.

k

numeric specifying the 'weight' of the equivalent degrees of freedom (=: edf) part in the AIC formula, see extractAIC.

keep

a filter function whose input is a fitted model object and the associated AIC statistic, and whose output is arbitrary, see step.

name

a function for extracting a suitable name/description from a fitted model object. By default the name is queried by calling formula, see waldtest.

ncores

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.

REML

logical controlling whether the restricted log-likelihood should be extracted (default TRUE).

scale

numeric, currently not used, see extractAIC.

scope

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.

steps

the maximum number of steps to be considered (default is 1000), see step.

test

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.

trace

if positive, information is printed during the running of step, see step.

use.fitted.param

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).

vcov

a function for estimating the covariance matrix of the regression coefficients, see waldtest.

verbose

positive integer controlling logging of diagnostic messages to the console during model fitting, see georob (default 0).

warn

logical scalar controlling whether warnings should be suppressed.

...

additional arguments passed to methods (see in particular waldtest.default).

Details

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.

See Also

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.

Examples

Run this code
# 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 DataCamp Workspace