In case spatio-temporal data is provided, the function variogramST
is called with a different set of parameters.
## S3 method for class 'gstat':
variogram(object, ...)
## S3 method for class 'formula':
variogram(object, locations = coordinates(data), data, ...)
## S3 method for class 'default':
variogram(object, locations, X, cutoff, width = cutoff/15,
alpha = 0, beta = 0, tol.hor = 90/length(alpha), tol.ver =
90/length(beta), cressie = FALSE, dX = numeric(0), boundaries =
numeric(0), cloud = FALSE, trend.beta = NULL, debug.level = 1,
cross = TRUE, grid, map = FALSE, g = NULL, ..., projected = TRUE,
lambda = 1.0, verbose = FALSE, covariogram = FALSE, PR = FALSE,
pseudo = -1)
## S3 method for class 'gstatVariogram':
print(x, ...)
## S3 method for class 'variogramCloud':
print(x, ...)
gstat
; in this form, direct
and cross (residual) variograms are calculated for all variables and
variable pairs defined in object
; in case of variogram.formula
,
formula defining the response vector an~x+y
; see examples.For variogram.default: list with coordinate matrices, each with the number of
gstat
and has more than one variable; if
TRUE, all direct and cross variograms are computed; if
equal to "ST", direct and cross variograms are computed fvariogram
or variogramCloud
to be printedcutoff
and width
are given, a variogram map is returned. This requires package
sp. Alternatively, a map can be passed, of class SpatialDataFrameGrid
(see sp docs)variogram.formula
or variogram.gstat
In other cases, an object of class "gstatVariogram" with the following fields:
variogramCloud
see belowvariogramCloud
, 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 1 + the
integer division of np by the .BigInt
attribute of the returned
object, the second point by 1 + the remainder of that division.
as.data.frame.variogramCloud returns no np
field,
but does the decoding into:variogramST
for details.Cressie, N., C. Wikle, 2011, Statistics for Spatio-temporal Data, Wiley.
Pebesma, E.J., 2004. Multivariable geostatistics in S: the gstat package. Computers & Geosciences, 30: 683-691.
variogramST
for details on the spatio-temporal sample variogram.library(sp)
data(meuse)
# no trend:
coordinates(meuse) = ~x+y
variogram(log(zinc)~1, meuse)
# residual variogram w.r.t. a linear trend:
variogram(log(zinc)~x+y, meuse)
# directional variogram:
variogram(log(zinc)~x+y, meuse, alpha=c(0,45,90,135))
variogram(log(zinc)~1, meuse, width=90, cutoff=1300)
# GLS residual variogram:
v = variogram(log(zinc)~x+y, meuse)
v.fit = fit.variogram(v, vgm(1, "Sph", 700, 1))
v.fit
set = list(gls=1)
v
g = gstat(NULL, "log-zinc", log(zinc)~x+y, meuse, model=v.fit, set = set)
variogram(g)
if (require(rgdal)) {
proj4string(meuse) = CRS("+init=epsg:28992")
meuse.ll = spTransform(meuse, CRS("+proj=longlat +datum=WGS84 +ellps=WGS84"))
# variogram of unprojected data, using great-circle distances, returning km as units
variogram(log(zinc) ~ 1, meuse.ll)
}
Run the code above in your browser using DataLab