gstatModel: A class for a geostatistical model

Description Details Slots Methods Note Author(s) See Also Examples

Description

A class containing fitted parameters of a geostatistical model to be used to run predictions by regression-kriging. It comprises regression model (e.g. a GLM), variogram model, and observation locations of sampled values used to fit the model.

Details

Any model passed to the regModel slot must come with generic functions such as residuals, fitted.values, summary, formula and predict.

Slots

regModel:

object of class "ANY"; output of fitting a generalized linear model (GLM) or any similar regression model

svgmModel:

object of class "data.frame"; sample variogram with semivariances and distances

vgmModel:

object of class "data.frame"; the fitted gstat variogram model parameters containing variogram model, nugget, sill, range and the five anisotropy parameters

sp:

object of class "SpatialPointsDataFrame"; observation locations

Methods

predict

signature(obj = "gstatModel"): makes predictions for a set of given predictionLocations (gridded maps) at block support corresponding to the cellsize slot in the object of class "SpatialPixelsDataFrame"; to produce predictions at point support, submit the predictionLocations as "SpatialPointsDataFrame"

validate

signature(obj = "gstatModel"): runs n-fold cross-validation of the existing gstatModel (it re-fits the model using existing formula string and model data, then estimates the mapping error at validation locations)

plot

signature(obj = "gstatModel", ...): plots goodness of fit and variogram model

Note

"SpatialPredictions" saves results of predictions for a single target variable, which can be of type numeric or factor. Multiple variables can be combined into a list. When using nsim argument with the predict method, the output result will be of type:

plotKML::RasterBrickSimulations-class

i.e. N number of equiprobable realizations. To generate an object of type:

plotKML::SpatialPredictions-class

set nsim = 0.

Author(s)

Tomislav Hengl and Gerard B.M. Heuvelink

See Also

predict.gstatModel, test.gstatModel, plotKML::SpatialPredictions-class, plotKML::RasterBrickSimulations-class, gstat::gstat, stats::glm

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
 
## load observations:
library(plotKML)
library(sp)
library(maptools)
demo(meuse, echo=FALSE)
data(meuse)
coordinates(meuse) <- ~x+y
proj4string(meuse) <- CRS("+init=epsg:28992")
## load grids:
data(meuse.grid)
coordinates(meuse.grid) <- ~x+y
gridded(meuse.grid) <- TRUE
proj4string(meuse.grid) <- CRS("+init=epsg:28992")
## fit a model:
omm <- fit.gstatModel(meuse, om~dist+ffreq, 
  fit.family=gaussian(link="log"), meuse.grid)
plot(omm)
## produce SpatialPredictions:
om.rk <- predict(omm, predictionLocations = meuse.grid)
plot(om.rk)
## run a proper cross-validation:
rk.cv <- validate(omm)
## RMSE:
sqrt(mean((rk.cv$validation$var1.pred-rk.cv$validation$observed)^2))

GSIF documentation built on May 2, 2019, 5:44 p.m.

Related to gstatModel in GSIF...