Learn R Programming

gstat (version 0.9-4)

variogram: Calculate Sample or Residual Variogram or Variogram Cloud

Description

Calculates the sample variogram from data, or in case of a linear model is given, for the residuals, with options for directional, robust, and pooled variogram, and for irregular distance intervals.

Usage

variogram(object, ...)
variogram(formula, locations, data, ...)
variogram(y, locations, X, cutoff, width, alpha, beta, tol.hor, 
    tol.ver, cressie, dX, boundaries, cloud, trend.beta, debug.level, ...)
print.variogram(v, ...)
print.variogram.cloud(v, ...)

Arguments

object
object of class gstat; in this form, direct and cross (residual) variograms are calculated for all variables and variable pairs defined in object
formula
formula defining the response vector and (possible) regressors, in case of absence of regressors, use e.g. z~1
data
data frame where the names in formula are to be found
locations
spatial data locations. For variogram.formula: a formula with only the coordinate variables in the left hand (dependent variable) side (see examples).

For variogram.default: a matrix, with the number of rows matching that of y, the number of columns sho

...
any other arguments that will be passed to variogram.default
y
vector with responses
X
(optional) matrix with regressors/covariates; the number of rows should match that of y, the number of columns equals the number of regressors (including intercept)
cutoff
spatial separation distance up to which point pairs are included in semivariance estimates
width
the width of subsequent distance intervals into which data point pairs are grouped for semivariance estimates
alpha
direction in plane (x,y), in positive degrees clockwise from positive y (North): alpha=0 for direction North (increasing y), alpha=90 for direction East (increasing x); optional a vector of directions in (x,y)
beta
direction in z, in positive degrees up from the (x,y) plane;
tol.hor
horizontal tolerance angle in degrees
tol.ver
vertical tolerance angle in degrees
cressie
logical; if TRUE, use Cressie's robust variogram estimate; if FALSE use the classical method of moments variogram estimate
dX
include a pair of data points $y(s_1),y(s_2)$ taken at locations $s_1$ and $s_2$ for sample variogram calculation only when $||x(s_1)-x(s_2)|| < dX$ with and $x(s_i)$ the vector with regressors at location $s_i$, and $||.||$ the 2-norm. This allows poole
boundaries
numerical vector with distance interval boundaries; values should be strictly increasing
cloud
logical; if TRUE, calculate the semivariogram cloud
trend.beta
vector with trend coefficients, in case they are known. By default, trend coefficients are estimated from the data.
debug.level
integer; set gstat internal debug level
v
object of class variogram or variogram.cloud to be printed

Value

  • an object of class "variogram" with the following fields:
  • npthe number of point pairs for this estimate; in case of a variogram.cloud see below
  • distthe average distance of all point pairs considered for this estimate
  • gammathe actual sample variogram estimate
  • dir.horthe horizontal direction
  • dir.verthe vertical direction
  • idthe combined id pair
  • If cloud is TRUE: an object of class "variogram.cloud", with the field np encoding the numbers of the point pair that contributed to a variogram cloud estimate, as follows. The first point is found by the integer division of np by $2^{16}$, the second point by the remainder of that division. print.variogram.cloud shows no np field, but does show in addition:
  • leftfor variogram.cloud: data id (row number) of one of the data pair
  • rightfor variogram.cloud: data id (row number) of the other data in the pair

synopsis

variogram(object, ...)

References

Cressie, N.A.C., 1993, Statistics for Spatial Data, Wiley.

http://www.gstat.org/

See Also

print.variogram, plot.variogram, plot.variogram.cloud, for variogram models: vgm, to fit a variogram model to a sample variogram: fit.variogram

Examples

Run this code
data(meuse)
# no trend:
variogram(log(zinc)~1, loc=~x+y, meuse)
# residual variogram w.r.t. a linear trend:
variogram(log(zinc)~x+y, loc=~x+y, meuse)
# directional variogram:
variogram(log(zinc)~x+y, loc=~x+y, meuse, alpha=c(0,45,90,135))

Run the code above in your browser using DataLab