georobModelBuilding: S3 Methods for Stepwise Building Fixed-Effects Models for...

Description Usage Arguments Details Author(s) See Also Examples

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
## S3 method for class 'georob'
deviance(object, warn = TRUE, REML = FALSE, ...)

## S3 method for class 'georob'
logLik(object, warn = TRUE, REML = FALSE, ...)

## S3 method for class 'georob'
extractAIC(fit, scale = 0, k = 2, ...)

## S3 method for class '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 class '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, ...)

## Default S3 method:
step(object, scope, scale = 0, 
    direction = c("both", "backward", "forward"), trace = 1, 
    keep = NULL, steps = 1000, k = 2, ...)

## S3 method for class 'georob'
step(object, scope, scale = 0, 
    direction = c("both", "backward", "forward"), trace = 1, 
    keep = NULL, steps = 1000, k = 2, data = NULL, 
    fixed.add1.drop1 = TRUE, fixed.step = fixed.add1.drop1,
    use.fitted.param = TRUE, verbose = 0, ncores = 1, ...)

## S3 method for class '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

For a non-robust fit the function deviance returns the residual deviance

(Y - X hatβ)^T(τ^2 I + Γ_hatθ)^{-1}(Y - X hatβ)

(see georob-package 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 τ/w where w 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.

Author(s)

Andreas Papritz [email protected]

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; georobMethods for further methods for the class georob.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
## 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)

## End(Not run)

georob documentation built on May 29, 2017, 10:51 a.m.