fields {fields}R Documentation

fields - tools for spatial data

Description

fields is a collection of functions for curve and function fitting with an emphasis on spatial data and spatial statistics. It was developed over 20+ years to provide easy to use but sophisticated tools for analyzing spatial data, particularly that encountered in the environmental sciences. For the impatient users, jump to the examples below to see how easy this is use. Please send bugs and questions to Doug Nychka, nychka@mines.edu. Positive comments are also welcome!

The major methods implemented include cubic and thin plate splines, universal Kriging and Kriging for large data sets. A more modern framework for Kriging is spatial process estimation with covariance parameters determined by maximum likelihood and the uncertainty derived from assumptions of a Gaussian process. Throughout we try to include reasonable defaults in functions that reflect our experience with analyzing spatial data. For example, the Matern covariance function is the default choice for the main spatial method.

A key feature of this package is any covariance function implemented in R code can be used for spatial prediction through the spatial functions. Another important feature is that fields will take advantage of compactly supported covariance functions in a seamless way through the spam package. See library( help=fields) for a listing of all the fields contents. We also recommend the thoughtful vignette created by Ashton Weins, Mitchell Krock, and Emma Lilly (fieldsVignette.pdf) in the fields github repository.

fields strives to have readable and tutorial code. Take a look at the source code for mKrig to see how things work "under the hood". E.g. how a linear algebra computation is overloaded to handle sparse matrices and how an output object is built up sequentially throughout a computation.

The fields source code is liberally commented. Unfortunately on loading this package, R will strip comments from the source for efficiency. You can go to CRAN fields page to download the latest "tarball" ( aka Package Source) and unzip to get code with comments. We also keep the most recent version of this package at the fields github repository. and for commented source go to the the subdirectory fields/R. This may be a more recent version, however, than what is posted to CRAN.

Details

Major methods

Other noteworthy functions

Generic functions that support the methods

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
predictSE- prediction standard errors at arbitrary points.
sim.rf- Simulate a random fields on a 2-d grid.

Getting Started

Try some of the examples from help files for spatialProcess or Tps.

Some fields datasets

DISCLAIMER:

The authors can not guarantee the correctness of any function or program in this package.

Examples

# some air quality data, daily surface ozone measurements for 
# the Midwest:

data(ozone2)
s<-ozone2$lon.lat
y<- ozone2$y[16,] # June 18, 1987 

# quick plot of spatial data with map
bubblePlot( s,y)
US( add=TRUE) # add US map

# fitting a thin plate spline surface (always a good place to 
# start). Here the  default smoothing (aka lambda) found by cross-validation
  fit0<- Tps(s,y)
# fits a GCV thin plate smoothing spline surface to ozone measurements.
# Hey, it does not get any easier than this!

  summary(fit0) #diagnostic summary of the fit 
  set.panel(2,2)
  plot(fit0) # four diagnostic plots of fit and residuals.

# quick plot of predicted surface
  set.panel()
  surface(fit0) # contour/image plot of the fitted surface
# see also predictSurface for more control over the evaluation grid
#
  US( add=TRUE, col="magenta", lwd=2) # US map overlaid
  title("Daily max 8 hour ozone in PPB,  June 18th, 1987")

####
  fit2<- spatialProcess( s,y)
# a "Kriging" model. The covariance defaults to a Matern 
# with smoothness 1.0.
# the nugget, sill and range parameters are found by maximum likelihood
# summary, plot, and surface also work for \code{fit2} !

  surface(fit2) # 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 18th, 1987")
## Not run: 
# And 20 approximate conditional draws of the spatial field on a grid
# with uncertainty in the 120PPB contour 
   look<- simLocal.spatialProcess(fit2, M=20)
for( k in 1:20){
contour( look$x, look$y, look$z[,,k], add=TRUE, level=c(120),
  col="white",  drawlabels=FALSE)
}


## End(Not run)  


[Package fields version 16.2 Index]