predict.krige
can then be called to compute
interpolation surfaces and prediction errors.
krige(formula, data=sys.parent(), subset, na.action=na.fail, covfun, nc=10000, ...)
z ~ loc(x,y)
z
is the kriging variable and
x
and
y
are the spatial locations,
that is,
z[i]
is observed at the location (
x[i],y[i]
).
The right hand side must contain a call to the function
loc
.
A polynomial trend surface is of the form:
z ~ loc(x,y) + x + y + x^2 + y^2
loc
function.
A constant term is always fit.
All terms on the right hand side must be entered with a
+
sign.
The
loc
call can include arguments
angle
and
ratio
to correct
for geometric anisotropy; see the
loc
help file.
Note that an evaluated
loc
object cannot be used in
formula
.
...
.
formula
.
formula
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.
covfun
.
"krige"
with components:
loc
function call in
formula
.
loc
function call in
formula
.
predict.krige
for computing interpolations.
The kriging system is solved using generalized
least squares (see Ripley, 1981).
The polynomial terms are scaled to (-1, 1) internally to avoid
numeric problems; the
coefficients
component returned is for these scaled
terms.
This implementation of kriging does not handle multiple observations
at a point.
Methods for objects of class
"krige"
include
predict
and
print
.
Cressie, Noel A. C. (1993).
Statistics for Spatial Data,
Revised Edition.
Wiley, New York.
Ripley, Brian D. (1981).
Spatial Statistics.
Wiley, New York
# krige the Coal Ash data with a quadratic trend in the x direction # using a spherical covariance function: kcoal <- krige(coal ~ loc(x, y) + x + x^2, data = coal.ash, covfun = spher.cov, range = 4.31, sill = 0.14, nugget = 0.89) # predictions over default 30 x 30 grid pcoal <- predict(kcoal) # plot prediction surface wireframe(fit ~ x * y, data = pcoal, screen = list(z = 300, x = -60, y = 0), drape = T)