Learn R Programming

rtop (version 0.5-5)

rtopFitVariogram: Fit variogram model to sample variogram of data with spatial support

Description

rtopFitVariogram will fit a variogram model to the estimated binned variogram or cloud variogram of data with an areal support.

Usage

## S3 method for class 'rtop':
rtopFitVariogram(object, params = list(), ...) 
## S3 method for class 'SpatialPolygonsDataFrame':
rtopFitVariogram(object, params=list(), ...) 
## S3 method for class 'SpatialPointsDataFrame':
rtopFitVariogram(object, params=list(), ...) 
## S3 method for class 'rtopVariogram':
rtopFitVariogram(object, observations, dists = NULL, 
                    params=list(), mr = FALSE, aOver = NULL, ...) 
## S3 method for class 'rtopVariogramCloud':
rtopFitVariogram(object, observations, dists = NULL, 
                    aOver = NULL, params=list(), mr = FALSE, ...)

Arguments

object
object of class rtopVariogram or rtopVariogramCloud, or an object with class rtop that includes the sample variograms. The object can also be of class Spat
observations
the observations, passed as a Spatial*DataFrame object, if object is an rtopVariogram or rtopVariogramCloud
params
a set of parameters, used to modify the standard parameters for the rtop package, set in getRtopParams. The argument params can also be used for the other methods, through
dists
either a matrix with geostatistical distances (created by a call to the function gDist or a list with the areas discretized (from a call to
mr
logical; defining whether the function should return a list with discretized elements and geostatistical distances, even if it was not called with an rtop-object as argument.
aOver
a matrix with the overlapping areas of the observations, used for computation of the nugget effect. It will normally be recomputed by the function if it is NULL and necessary
...
Other parameters to functions called from rtopFitVarigoram

Value

  • The function creates an object with the fitted variogram Model (variogramModel) and a data.frame (varFit) with the differences between the sample semivariances and the regularized semivariances. If mr = TRUE, the function also returns other objects (discretized elements and geostatistical distances, if created) as a part of the returned object. If the function is called with an rtop-object as argument, it will return an rtop-object with variogramModel and varFit added to the object, in addition to other objects created.

References

http://www.intamap.org/

See Also

rtop-package

Examples

Run this code
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")

# Setting some parameters 
params = list(gDist = TRUE, cloud = FALSE)
# Create a column with the specific runoff:
observations$obs = observations$QSUMMER_OB/observations$AREASQKM
# Build an object
rtopObj = createRtopObject(observations,predictionLocations, 
                           params = params)
# Fit a variogram (function also creates it)
rtopObj = rtopFitVariogram(rtopObj)
rtopObj$variogramModel

Run the code above in your browser using DataLab