Learn R Programming

GSIF (version 0.3-1)

gstatModel-class: A class for a geostatistical model

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. GLM), variogram model, and observation locations of sampled values used to fit the model.

Arguments

Details

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

See Also

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

Examples

Run this code
## load observations:
library(plotKML)
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, family=gaussian(link="log"), meuse.grid)
show(omm@regModel)
## produce SpatialPredictions:
om.rk <- predict(omm, predictionLocations = meuse.grid)
#plotKML(om.rk)
## run a proper cross-validation:
rk.cv <- validate(omm)
## RMSE:
sqrt(mean((rk.cv$validation$var1.pred-rk.cv$validation$observed)^2))

Run the code above in your browser using DataLab