Empirical Variogram

DESCRIPTION:
Computes the empirical variogram for two dimensional spatial data. Multiple variograms for different directions can be computed.

USAGE:
variogram(formula, data=<<see below>>, subset=<<see below>>,
          na.action=<<see below>>, lag=<<see below>>, nlag=20,
          tol.lag=lag/2, azimuth=0, tol.azimuth=90, bandwidth=1e21,
          maxdist=<<see below>>, minpairs=6, method="classical")

REQUIRED ARGUMENTS:
formula:
formula defining the response and the predictors. In general, its form is: z ~ x + y The z variable is a numeric response. Variables x and y are the locations. All variables in the formula must be vectors of equal length with no missing values (NAs). The formula may also contain expressions for the variables, e.g. sqrt(count), log(age+1) or I(2*x). (The I() is required since the * operator has a special meaning on the right side of a formula. The right hand side may also be a call to the loc function e.g. loc(x,y). The loc function can be used to correct for geometric anisotropy, see the loc help file.

OPTIONAL ARGUMENTS:
data:
an optional data frame in which to find the objects mentioned in formula.
subset:
expression saying which subset of the rows of the data should be used in the fit. This can be a logical vector (which is replicated to have length equal to the number of observations), or a numeric vector indicating which observation numbers are to be included, or a character vector of the row names to be included.
na.action:
a function to filter missing data. This is applied to the model.frame after any subset argument has been used. The default (with na.fail) is to create an error if any missing values are found. A possible alternative is na.omit, which deletes observations that contain one or more missing values.
lag:
a numeric value, the width of the lags. If missing, lag is set to maxdist / nlag.
nlag:
an integer, the maximum number of lags to calculate.
tol.lag:
a numeric value, the distance tolerance.
azimuth:
a vector of direction angles in degrees, measured clockwise from North. A separate variogram will be estimated for each direction.
tol.azimuth:
angle tolerance in degrees. A tol.azimuth of 90 or greater (the default) results in an omnidirectional variogram.
bandwidth:
the maximum bandwidth, the deviation from the direction orthogonal to the direction angle.
maxdist:
the maximum distance to include in the returned output. The default is half the maximum distance in the data.
minpairs:
the minimum number of pairs of points (minimum value for np) that must be used in calculating a variogram value. If np is less than minpairs then that value is dropped from the variogram.
method:
a character string to select the method for estimating the variogram. The possible values are "classical" for Matherons (1963) estimate and "robust" for Cressie and Hawkins (1980) robust estimator. Only the first character of the string needs to be given.

VALUE:
an object of class "variogram" that inherits from "data.frame" with columns:
distance:
the average distance for pairs in the lag.
gamma:
the variogram estimate.
np:
the number of pairs in each lag.
azimuth:
a factor denoting the angular direction.

The return object has an attribute call with an image of the call that produced the object.


DETAILS:
Method for class "variogram" include plot, print and summary.

The variogram is a measure of spatial correlation. This function uses a modified version of the GSLIB subroutine gamv2 (Deutsch and Journel, 1992).


REFERENCES:
Cressie, Noel A. C. (1993). Statistics for Spatial Data, Revised Edition. Wiley, New York.

Cressie, N. and Hawkins, D. M. (1980). Robust estimation of the variogram. Mathematical Geology 12, 115-125.

Deutsch, Clayton V. and Journel, Andre G. (1992). GSLIB Geostatistical Software Library and User's Guide. Oxford University Press, New York.

Matheron, G. (1963). Principles of geostatistics. Economic Geology 58, 1246-1266.


SEE ALSO:
correlogram , loc , plot.variogram .

EXAMPLES:
# an omnidirectional variogram
v1 <- variogram(ore ~ easting + northing, data=iron.ore)
plot(v1)
# variograms in 0, 45, 90 and 135 degrees directions
v2 <- variogram(ore ~ loc(easting,northing), data=iron.ore,
                azimuth=c(0,45,90,135), tol.azimuth=22.5)
plot(v2)