predict.georob: Predict Method for Robustly Fitted Spatial Linear Models

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

Robust and customary external drift kriging prediction based on a spatial linear models fitted by georob. The predict method for the class georob computes fitted values, point and block kriging predictions as well as model terms for display by termplot.

Usage

1
2
3
4
5
## S3 method for class 'georob'
predict(object, newdata, type =  c("signal", "response", "trend", "terms"), 
    terms = NULL, se.fit = TRUE, signif = 0.95, mmax = 10000, locations, 
    full.covmat = FALSE, pwidth = NULL, pheight = NULL, napp = 1, 
    extended.output = FALSE, ncores = detectCores(), verbose = 0, ...)

Arguments

object

an object of class "georob", see georobObject.

newdata

an optional data frame, SpatialPointsDataFrame, SpatialPixelsDataFrame, SpatialGridDataFrame or SpatialPolygonsDataFrame in which to look for variables with which to compute fitted values or kriging predictions.
If newdata is a SpatialPolygonsDataFrame then block kriging predictions are computed, otherwise point kriging predictions.

type

character keyword defining what target quantity should be predicted (computed). Possible values are

  • "signal": the “signal” Y(s) = x(s)^T β + B(s) of the process (default),

  • "response": the observations Y(s)=S(s) + ε(s),

  • "trend": the external drift x(s)^T β,

  • "terms": the model terms.

terms

If type = "terms", which terms (default is all terms).

se.fit

logical, only used if type is equal to "terms", see predict.lm.

signif

positive numeric equal to the tolerance or confidence level for computing respective intervals.

mmax

integer equal to the maximum number (default 10000) of prediction items, computed in a sub-task, see Details.

locations

an optional one-sided formula specifying what variables of newdata are the coordinates of the prediction points
(default: object[["locatons.objects"]]$locations).

full.covmat

logical controlling whether the full covariance matrix of the prediction errors is returned (TRUE) or only the vector with its diagonal elements (FALSE, default), see Value for an explanation of the effect of full.covmat.

pwidth, pheight, napp

numeric scalars, used to tune numeric integration of semivariances for block kriging, see preCKrige.

extended.output

logical controlling whether the covariance matrices of the kriging predictions and of the data should be computed, see Details (default FALSE).

ncores

positive integer controlling how many cores are used for parallelized computations, see Details.

verbose

positive integer controlling logging of diagnostic messages to the console.
verbose = 0 (default) largely suppresses such messages.

...

additional arguments passed to method, currently not used.

Details

The predict method for class georob uses the package parallel for parallelized computation of kriging predictions. If there are m items to predict, the task is split into ceiling(m/mmax) sub-tasks that are then distributed to ncores CPUs. Evidently, ncores = 1 suppresses parallel execution. By default, the function uses all available CPUs as returned by detectCores.
Note that if full.covmat is TRUE mmax must exceed m (and parallel execution is not possible).

The argument extended.output = TRUE is used to compute all quantities required for (approximately) unbiased back-transformation of kriging predictions of log-transformed data to the original scale of the measurements by lgnpp. In more detail, the following items are computed:

Note that the component var.pred is also present if type is equal to "trend", irrespective of the choice for extended.output. This component contains then the variances of the fitted values.

Value

If type is equal to "terms" then a vector, a matrix, or a list with prediction results along with bounds and standard errors, see predict.lm. Otherwise, the structure and contents of the output generated by predict.georob are determined by the class of newdata and the logical flags full.covmat and extended.output:

If full.covmat is FALSE then the result is an object of the same class as newdata (data frame, SpatialPointsDataFrame, SpatialPixelsDataFrame SpatialGridDataFrame,
SpatialPolygonsDataFrame). The data frame or the data slot of the Spatial...DataFrame objects have the following components:

If full.covmat is TRUE then predict.georob returns a list with the following components:

Author(s)

Andreas Papritz andreas.papritz@env.ethz.ch

References

Nussbaum, M., Papritz, A., Baltensweiler, A. and Walthert, L. (2012) Organic Carbon Stocks of Swiss Forest Soils, Institute of Terrestrial Ecosystems, ETH Zurich and Swiss Federal Institute for Forest, Snow and Landscape Research (WSL), pp. 51. http://e-collection.library.ethz.ch/eserv/eth:6027/eth-6027-01.pdf

Kuensch, H. R., Papritz, A., Schwierz, C. and Stahel, W. A. (2011) Robust estimation of the external drift and the variogram of spatial data. Proceedings of the ISI 58th World Statistics Congress of the International Statistical Institute. http://e-collection.library.ethz.ch/eserv/eth:7080/eth-7080-01.pdf

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.

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
30
31
32
33
34
35
36
37
## Not run: 
data(meuse )

data(meuse.grid)
meuse.grid.pixdf <- SpatialPixelsDataFrame(points = meuse.grid[, 1:2],
    data = meuse.grid[, -(1:2)])
  
library(constrainedKriging)
data(meuse.blocks)

r.logzn.rob <- georob(log(zinc) ~ sqrt(dist), data = meuse, locations = ~ x + y,
    variogram.model = "exponential", param = c( variance = 0.15, nugget = 0.05, scale = 200 ),
    tuning.psi = 1., control = georob.control(cov.bhat = TRUE, full.cov.bhat = TRUE,
        cov.bhat.betahat = TRUE, aux.cov.pred.target = TRUE))
        
## point predictions of log(Zn)
r.pred.points <- predict(r.logzn.rob, newdata = meuse.grid.pixdf, extended.output = TRUE,
    full.covmat = TRUE)
str(r.pred.points$pred@data)

## back-transformation of point predictions
r.backtf.pred.points <- lgnpp(r.pred.points)
str(r.backtf.pred.points$pred@data)

spplot(r.backtf.pred.points[["pred"]], zcol = "lgn.pred", main = "Zn content")

## predicting mean Zn content for whole area
r.block <- lgnpp(r.pred.points, is.block = TRUE, all.pred = r.backtf.pred.points[["pred"]])
r.block

## block predictions of log(Zn)
r.pred.block <- predict(r.logzn.rob, newdata = meuse.blocks, extended.output = TRUE,
    pwidth = 75, pheight = 75)
r.backtf.pred.block <- lgnpp(r.pred.block, newdata = meuse.grid)

spplot(r.backtf.pred.block, zcol = "lgn.pred", main = "block means Zn content")
## End(Not run)

georob documentation built on May 2, 2019, 6:53 p.m.