georob (version 0.3-19)

sample.variogram: Computing (Robust) Sample Variograms of Spatial Data

Description

The function sample.variogram computes the sample (empirical) variogram of a spatial variable by the method-of-moment and three robust estimators. Both omnidirectional and direction-dependent variograms can be computed, the latter for observation locations in a three-dimensional domain. There are summary and plot methods for summarizing and displaying sample variograms.

Usage

sample.variogram(object, ...)

# S3 method for default sample.variogram(object, locations, lag.dist.def, xy.angle.def = c(0, 180), xz.angle.def = c(0, 180), max.lag = Inf, estimator = c("qn", "mad", "matheron", "ch"), mean.angle = TRUE, ...)

# S3 method for formula sample.variogram(object, data, subset, na.action, locations, lag.dist.def, xy.angle.def = c(0, 180), xz.angle.def = c(0, 180), max.lag = Inf, estimator = c("qn", "mad", "matheron", "ch"), mean.angle = TRUE, ...)

# S3 method for georob sample.variogram(object, lag.dist.def, xy.angle.def = c(0, 180), xz.angle.def = c(0, 180), max.lag = Inf, estimator = c("qn", "mad", "matheron", "ch"), mean.angle = TRUE, ...)

# S3 method for sample.variogram summary(object, ...)

# S3 method for sample.variogram plot(x, type = "p", add = FALSE, xlim = c(0, max(x[["lag.dist"]])), ylim = c(0, 1.1 * max(x[["gamma"]])), col, pch, lty, cex = 0.8, xlab = "lag distance", ylab = "semivariance", annotate.npairs = FALSE, npairs.pos = 3, npairs.cex = 0.7, legend = nlevels(x[["xy.angle"]]) > 1 || nlevels(x[["xz.angle"]]) > 1, legend.pos = "topleft", ...)

Value

All methods of the generic function sample.variogram

return an object of class sample.variogram, which is a data frame with the following components:

lag.distthe mean lag distance of the lag class,
xy.anglethe angular class in the \(x\)-\(y\)-plane,
xz.anglethe angular class in the \(x\)-\(z\)-plane,
gammathe estimated semi-variance of the lag class,
npairsthe number of data pairs in the lag class,
lag.xthe \(x\)-component of the mean lag vector of the lag class,
lag.xthe \(y\)-component of the mean lag vector of the lag class,
lag.zthe \(z\)-component of the mean lag vector of the lag class.

The method summary.sample.variogram returns an object of class

summary.sample.variogram which is list with the components

log.dist, npairs, xy.angle and xz.angle, see description for object of class sample.variogram above. There is a

print method for objects of class summary.sample.variogram

which invisibly returns the object unchanged.

The method plot.sample.variogram is called for its side effects and invisibly returns the object sample.variogram unchanged.

Arguments

object

a numeric vector with the values of the response for which the sample variogram should be computed (sample.variogram.default), a formula, specifying in its left part the response variable (right part of formula is ignored, sample.variogram.formula), an object of class georob
(sample.variogram.georob) or an object of class
sample.variogram (summary.sample.variogram).

locations

a numeric matrix with the coordinates of the locations where the response was observed (sample.variogram.default) or a one-sided formula specifying the coordinates (sample.variogram.formula). The matrix may have an arbitrary number of columns for an omnidirectional variogram, but at most 3 columns if a directional variogram is computed.

data

an optional data frame, list or environment (or another object coercible by
as.data.frame to a data frame) containing the response variable and the coordinates where the data was recorded. If not found in data, the variables are taken from environment(formula), typically the environment from which sample.variogram is called.

subset

an optional vector specifying a subset of observations to be used for estimating the variogram.

na.action

a function which indicates what should happen when the data contain NAs. The default is set by the na.action argument of options, and is na.fail if that is unset. The “factory-fresh” default is na.omit. Another possible value is NULL, no action. Value na.exclude can be useful.

lag.dist.def

a numeric scalar defining a constant bin width for grouping the lag distances or a numeric vector with the bounds of a set of contiguous bins (upper bounds of bins except for the first element of lag.dist.def which is the lower bound of the first bin). This argument is mandatory.

xy.angle.def

an numeric vector defining angular classes in the horizontal plane for computing directional variograms. xy.angle.def must contain an ascending sequence of azimuth angles in degrees from north (positive clockwise to south), see Details. Omnidirectional variograms are computed with the default c(0,180).

xz.angle.def

an numeric vector defining angular classes in the \(x\)-\(z\)-plane for computing directional variograms. xz.angle.def must contain an ascending sequence of angles in degrees from zenith (positive clockwise to nadir), see Details. Omnidirectional variograms are computed with the default c(0,180).

max.lag

a positive numeric defining the largest lag distance for which semi variances should be computed (default no restriction).

estimator

a character keyword defining the estimator for computing the sample variogram. Possible values are:

  • "qn": Genton's robust Qn-estimator (default, Genton, 1998),

  • "mad": Dowd's robust MAD-estimator (Dowd, 1984),

  • "matheron": non-robust method-of-moments estimator,

  • "ch": robust Cressie-Hawkins estimator (Cressie and Hawkins, 1980).

mean.angle

a logical scalar controlling whether the mean lag vector (per combination of lag distance and angular class) is computed from the mean angles of all the lag vectors falling into a given class (TRUE, default) or from the mid-angles of the respective angular classes (FALSE).

x

an object of class sample.variogram.

type, xlim, ylim, xlab, ylab

see respective arguments of plot.default.

add

a logical scalar controlling whether a new plot should be generated (FALSE, default) or whether the information should be added to the current plot (TRUE).

col

a vector with the colours of plotting symbols for distinguishing semi variances for angular classes in the \(x\)-\(y\)-plane.

pch

a vector with the types of plotting symbols for distinguishing semi variances for angular classes in the \(x\)-\(z\)-plane.

lty

the line type.

cex

a numeric with the character expansion factor for plotting symbols.

annotate.npairs

a logical scalar controlling whether the plotting symbols should be annotated by the number of data pairs per lag class.

npairs.pos

an integer defining the position where text annotation about number of pairs should be plotted, see text.

npairs.cex

a numeric defining the character expansion for text annotation about number of pairs.

legend

a logical scalar controlling whether a legend should be plotted.

legend.pos

a character keyword defining where to place the legend, see legend for possible values.

...

additional arguments passed to plot.formula.

Author

Andreas Papritz papritz@retired.ethz.ch.

Details

The angular classes in the \(x\)-\(y\)- and \(x\)-\(z\)-plane are defined by vectors of ascending angles on the half circle. The \(i\)th angular class is defined by the vector elements, say l and u, with indices \(i\) and \(i+1\). A lag vector belongs to the \(i\)th angular class if its azimuth (or angle from zenith), say \(\varphi\), satisfies \( l < \varphi \leq u\). If the first and the last element of xy.angle.def or xz.angle.def are equal to 0 and 180 degrees, respectively, then the first and the last angular class are “joined”, i.e., if there are \(K\) angles, there will be only \(K-2\) angular classes and the first class is defined by the interval ( xy.angle.def[K-1]-180, xy.angle.def[2] ] and the last class by ( xy.angle.def[K-2], xy.angle.def[K-1]].

References

Cressie, N. and Hawkins, D. M. (1980) Robust Estimation of the Variogram: I. Mathematical Geology, 12, 115--125, tools:::Rd_expr_doi("10.1007/BF01035243").

Dowd, P. A. (1984) The variogram and Kriging: Robust and resistant estimators. In Geostatistics for Natural Resources Characterization, Verly, G., David, M., Journel, A. and Marechal, A. (Eds.) Dordrecht: D. Reidel Publishing Company, Part I, 1, 91--106, tools:::Rd_expr_doi("10.1007/978-94-009-3699-7").

Genton, M. (1998) Highly Robust Variogram Estimation. Mathematical Geology, 30, 213--220, tools:::Rd_expr_doi("10.1023/A:1021728614555").

See Also

georobPackage for a description of the model and a brief summary of the algorithms;

georob for (robust) fitting of spatial linear models;

georobObject for a description of the class georob;

profilelogLik for computing profiles of Gaussian likelihoods;

plot.georob for display of RE(ML) variogram estimates;

control.georob for controlling the behaviour of georob;

georobModelBuilding for stepwise building models of class georob;

cv.georob for assessing the goodness of a fit by georob;

georobMethods for further methods for the class georob;

predict.georob for computing robust Kriging predictions;

lgnpp for unbiased back-transformation of Kriging prediction of log-transformed data;

georobSimulation for simulating realizations of a Gaussian process from model fitted by georob.

Examples

Run this code
data(wolfcamp)

## omnidirectional sample variogram
r.sv.iso <- sample.variogram(pressure~1, data = wolfcamp,
    locations = ~x + y, lag.dist.def = seq(0, 200, by = 15))

plot(r.sv.iso, type = "l")

## direction-dependent sample variogram
r.sv.aniso <- sample.variogram(pressure~1, data = wolfcamp,
    locations = ~x + y, lag.dist.def = seq(0, 200, by = 15),
    xy.angle.def = c(0., 22.5, 67.5, 112.5, 157.5, 180.))
plot(r.sv.aniso, type = "l", add = TRUE, col = 2:5)

Run the code above in your browser using DataLab