Learn R Programming

rtop (version 0.6-9)

rtopVariogram: create variogram for data with spatial support

Description

rtopVariogram will create binned variogram or cloud variogram of data with an areal support.

Usage

# S3 method for rtop
rtopVariogram(object, params = list(), ...) 
# S3 method for SpatialPolygonsDataFrame
rtopVariogram(object, ...) 
# S3 method for SpatialPointsDataFrame
rtopVariogram(object, formulaString, params=list(), cloud, 
                       abins, dbins, ...) 
# S3 method for STSDF
rtopVariogram(object, formulaString, params=list(), cloud, 
                       abins, dbins, data.table = FALSE, ...)

Value

The function creates a variogram, either of type rtopVariogram or rtopVariogramCloud. This variogram is based on the variogram

function from gstat, but has additional information about the spatial size or length of the observations. An rtop-object with the variogram added is returned if the function is called with an rtop-object as argument.

For spatio-temporal objects (STSDF), the variogram is the spatially variogram, averaged for all time steps. There is a possibility to use data.table internally in this function, which can improve computation time for some cases.

Arguments

object

object of class rtop (see rtop-package) or a
SpatialPolygonsDataFrame or SpatialPointsDataFrame with information about observations. If
object is a
SpatialPointsDataFrame, it must have a column with name area.

formulaString

formula that defines the dependent variable as a linear model of independent variables; suppose the dependent variable has name z, for ordinary and simple kriging use the formula z~1; for universal kriging, suppose z is linearly dependent on x and y, use the formula z~x+y. The formulaString defaults to "value~1" if value is a part of the data set. If not, the first column of the data set is used.

params

a set of parameters, used to modify the default parameters for the rtop package, set in getRtopParams.

cloud

logical; if TRUE, calculate the semivariogram cloud, can be used to overrule the cloud parameter in params.

abins

possibility to set areal bins (not yet implemented)

dbins

possibility to set distance bins (not yet implemented)

data.table

an option to use data.table internally for the variogram computation for STSDF-objects

...

parameters to other functions called, e.g. gstat's variogram-function and to rtopVariogram.SpatialPointsDataFrame when the method is called with an object of a different class

Author

Jon Olav Skoien

References

Skoien J. O., R. Merz, and G. Bloschl. Top-kriging - geostatistics on stream networks. Hydrology and Earth System Sciences, 10:277-287, 2006.

Skoien, J. O., Bloschl, G., Laaha, G., Pebesma, E., Parajka, J., Viglione, A., 2014. Rtop: An R package for interpolation of data with a variable spatial support, with an example from river networks. Computers & Geosciences, 67.

Examples

Run this code
if (FALSE) {
library(sf)
rpath = system.file("extdata",package="rtop")
observations = st_read(rpath,"observations")
# Create a column with the specific runoff:
observations$obs = observations$QSUMMER_OB/observations$AREASQKM

vario = rtopVariogram(observations, cloud = TRUE)
}

Run the code above in your browser using DataLab