kriging (version 1.1)

kriging: Ordinary Kriging

Description

Simple and highly optimized ordinary kriging algorithm to plot geographical data

Usage

kriging(x, y, response, model = "spherical", lags = 10, pixels = 100, polygons = NULL)

Arguments

x
vector of x-axis spatial points.
y
vector of y-axis spatial points.
response
vector of observed values.
model
specification of the variogram model. Choices are "spherical", "exponential" or "gaussian". Defaults to "spherical".
lags
number of lags. Defaults to 10.
pixels
maximum number of points along either axis. Defaults to 100.
polygons
list of polygons used to grid predicted values on to. The default value of NULL automatically generates an evenly spaced out rectangular grid of points spanning the range of the data.

Value

An object of class kriging that inherits from list and is composed of:
model
character; variogram model.
nugget
numeric; value of nugget parameter.
range
numeric; value of range parameter.
sill
numeric; value of sill parameter.
map
data.frame; contains the predicted values along with the coordinate covariates.
semivariogram
data.frame; contains the distance and semivariance values.

Details

The kriging algorithm assumes a minimum number of observations in order to fit the variogram model.

See Also

image.kriging, plot.kriging.

Examples

Run this code
# Krige random data for a specified area using a list of polygons
library(maps)
usa <- map("usa", "main", plot = FALSE)
p <- list(data.frame(usa$x, usa$y))

# Create some random data
x <- runif(50, min(p[[1]][,1]), max(p[[1]][,1]))
y <- runif(50, min(p[[1]][,2]), max(p[[1]][,2]))
z <- rnorm(50)

# Krige and create the map
kriged <- kriging(x, y, z, polygons=p, pixels=300)
image(kriged, xlim = extendrange(x), ylim = extendrange(y))

Run the code above in your browser using DataCamp Workspace