createRtopObject. The element params below consists of
changes to the default parameters. A further description can be found
in getRtopParams. The changes below means that
the functions will use geostatistical distance instead of full regularization,
and that the variogram model will be fitted to the variogram cloud.
Most other functions in the rtop-package can take this object as an argument,
and will add the results as one or more new element(s) to this object. The data in the example below are stored as shape-files
in the extdata-directory of the rtop-pacakge, use the directory of your own data instead.
The observations consist of mean summer runoff
from 138 catchments in Upper Austria. The predictionLocations are 863 catchments
in the same region. observations and predictionLocations are stored as
SpatialPolygonsDataFrame-objects.
library(rgdal)
rpath = system.file("extdata",package="rtop")
observations = readOGR(rpath,"observations") # Create a column with the specific runoff:
observations$obs = observations$QSUMMER_OB/observations$AREASQKM
predictionLocations = readOGR(rpath,"predictionLocations")
params = list(gDist = TRUE, cloud = TRUE)
rtopObj = createRtopObject(observations, predictionLocations,
params = params)
There are help-methods available in cases when data are not available as
shape-files, or when the observations are not part of the shape-files.
See readAreaInfo and readAreas. A call to rtopVariogram adds the sample variogram to the object,
whereas
rtopFitVariogram fits a variogram model. The last function
will call rtopVariogram if rtopObj does not contain a sample variogram. rtopObj = rtopVariogram(rtopObj) rtopObj = rtopFitVariogram(rtopObj)The function
checkVario is useful to produce some
diagnostic plots for the sample variogram and the fitted variogram model. checkVario(rtopObj)The interpolation function (
rtopKrige) solves the kriging system based on the
computed regularized semivariances. The covariance matrices are created in a
separate regularization function (varMat), and are stored in
the rtop-object for easier access if it is necessary to redo parts of the
analysis, as this is the computationally expensive part of the interpolation.
Cross-validation can be called with the argument cv=TRUE, either in
params or in the call to rtopKrige.
rtopObj = rtopKrige(rtopObj)
spplot(rtopObj$predictions, col.regions = bpy.colors(),
c("var1.pred","var1.var"))
rtopObj = rtopKrige(rtopObj, cv = TRUE)
spplot(rtopObj$predictions, col.regions = bpy.colors(),
c("var1.pred","var1.var"))
Skoien J. O., R. Merz, and G. Bloschl. Top-kriging - geostatistics on stream networks. Hydrology and Earth System Sciences, 10:277-287, 2006.