Learn R Programming

rtop (version 0.6-9)

checkVario: Plot variogram fitted to data with support

Description

The function will create diagnostic plots for analysis of the variograms fitted to sample variograms of data with support

Usage

# S3 method for rtop
checkVario(object, acor = 1, log = "xy", cloud = FALSE, 
           gDist = TRUE, acomp = NULL, curveSmooth = FALSE, params = list(), ...) 

# S3 method for rtopVariogramModel checkVario(object, sampleVariogram = NULL, observations = NULL, areas = NULL, dists = NULL, acomp = NULL, params = list(), compVars = list(), acor = 1, log = "xy", legx = NULL, legy = NULL, plotNugg = TRUE, curveSmooth = FALSE, ...)

Value

The function gives diagnostic plots for the fitted variograms, where the regularized variograms are shown together with the sample variograms and possibly also user defined variograms. In addition, if an rtopObject is submitted, the function will also give plots of the relationship between variance and area size and a scatter plot of the fit of the observed and regularized variogram values. The sizes of the dots are relative to the number of pairs in each group.

Arguments

object

either: object of class rtop (see rtop-package), or an object of type
rtopVariogram

acor

unit correction factor in the key, e.g. to see numbers more easily interpretable for large areas. As an example, ucor = 0.000001 when area is given in square meters and should rather be shown as square kilometers. Note that this parameter also changes the value of the nugget to the new unit.

log

text variable for log-plots, default to log-log "xy", can otherwise be set to "x", "y" or ""

cloud

logical; whether to look at the cloud variogram instead of the binned variogram

gDist

logical; whether to use ghosh-distance for semivariogram regularization instead of full integration of the semivariogram

sampleVariogram

a sample variogram of the data

observations

a set of observations

areas

either an array of areas that should be used as examples, or the number of areas per order of magnitude (similar to the parameter amul; see getRtopParams. amul from rtopObj or from the default parameter set will be used if not defined here.

dists

either an array of distances that should be used as examples, or the number of distances per order of magnitude(similar to the parameter amul; see getRtopParams. amul from rtopObj or from the default parameter set will be used if not defined here.

acomp

either a matrix with the area bins that should be visualized, or a number giving the number of pairs to show. If a sample variogram is given, the acomp pairs with highest number of pairs will be used

curveSmooth

logical or numerical; describing whether the curves in the last plot should be smoothed or not. If numeric, it gives the degrees of freedom (df) for the splines used for smoothing. See also smooth.spline

params

list of parameters to modify the default parameters of rtopObj or the default parameters found from getRtopParams

compVars

a list of variograms of gstat-type for comparison, see vgm. The names of the variograms in the list will be used in the key.

legx

x-coordinate of the legend for fine-tuning of position, see x-argument of
legend

legy

y-coordinate of the legend for fine-tuning of position, see y-argument of
legend

plotNugg

logical; whether the nugget effect should be added to the plot or not

...

arguments to lower level functions

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
# \donttest{
library(gstat)
rpath = system.file("extdata",package="rtop")
library(sf)
observations = st_read(rpath, "observations")
predictionLocations = st_read(rpath,"predictionLocations")

# Create a column with the specific runoff:
observations$obs = observations$QSUMMER_OB/observations$AREASQKM
params = list(cloud = TRUE, gDist = TRUE)
rtopObj = createRtopObject(observations, predictionLocations, 
                           params = params)

# Fit a variogram (function also creates it)
rtopObj = rtopFitVariogram(rtopObj, maxn = 2000)
checkVario(rtopObj, 
    compVars = list(first = vgm(5e-6, "Sph", 30000,5e-8), 
                   second = vgm(2e-6, "Sph", 30000,5e-8)))

rtopObj = checkVario(rtopObj, acor = 0.000001, 
          acomp = data.frame(acl1 = c(2,2,2,2,3,3,3,4,4), 
          acl2 = c(2,3,4,5,3,4,5,4,5)))
rtopObj = checkVario(rtopObj, cloud = TRUE, identify = TRUE, 
          acor = 0.000001)
# }

Run the code above in your browser using DataLab