fields {fields}R Documentation

fields - tools for spatial data


Fields is a collection of programs for curve and function fitting with an emphasis on spatial data and spatial statistics. The major methods implemented include cubic and thin plate splines, universal Kriging and Kriging for large data sets. One main feature is any covariance function implemented in R can be used for spatial prediction.

fields stives to have readable and tutorial code. Take a look at the source code for Krig and Krig.engine.default to see how things work "under the hood".

Some major methods include:

The Krig function allow you to supply a covariance function that is written in native S/R code. See (stationary.cov) that includes several families of covariances and distance metrics including the Matern and great circle distance.

Some other noteworthy functions are

There are also generic functions that support these methods such as

plot - diagnostic plots of fit
summary- statistical summary of fit
print- shorter version of summary
surface- graphical display of fitted surface
predict- evaluation fit at arbitrary points prediction standard errors at arbitrary points.
sim.rf- Simulate a random fields on a 2-d grid.

To get started, try some of the examples from help files for Tps or Krig. See also the manual/tutorial at

Graphics tips: help( fields.hints) gives some R code tricks for setting up common legends and axes. And has little to do with this package!

Testing: See help(fields.tests) for testing fields.


This is software for statistical research and not for commercial uses. The authors do not guarantee the correctness of any function or program in this package. Any changes to the software should not be made without the authors permission.


# some air quality data:
y<- ozone2$y[16,]

# pixel plot of spatial data
quilt.plot( x,y)
US( add=TRUE) # add US map

fit<- Tps(x,y)
# fits a GCV thin plate smoothing spline surface to ozone measurements.
# Hey, it does not get any easier than this!

summary(fit) #diagnostic summary of the fit 

plot(fit) # four diagnostic plots of  fit and residuals.

surface(fit) # contour/image plot of the fitted surface
US( add=TRUE, col="magenta", lwd=2) # US map overlaid
title("Daily max 8 hour ozone in PPB,  June 19th, 1987")

[Package fields version 3.3.1 Index]