Geostatistics for S+: Data Structures

The object-oriented nature of the framework means that it is composed of a number of data objects and functions that operate on them. Therefore, this section contains a description of the data objects that have been defined and the functions that carry out operations on those data structures. Four data objects are defined, including objects of class point, pairs, variogram, and variogram.model. The purpose and structure of each of these types of data objects are described below.


Point Object Data Structure

An object of class point represents the observed data of a spatial process. This includes the spatial location of sampling sites and the values observed at those sites. A point object is stored as a data frame. The data frame must contain one column for the X coordinate and one column for the Y coordinate of each point, as well as any number of columns representing data observed at the points. The structure of a point object is shown below:

point.object$
x
y
var1
...
varm
vector of x coordinates
vector of y coordinates
vector of the first variable
...
vector of the mth variable

Point objects are created using the point function. Point objects are used togehter with pairs objects to conduct exploratory spatial data analysis and to calculate empirical variogram estimates.


Pairs Object Data Structure

A pairs object contains information defining pairs of points contained in a point object. A pairs object is a list containing five vectors: from, to, lags, dist, and bins. The length of each of these vectors (except bins) is equal to the number of pairs of points being represented, say k. The vectors from and to contain pointers into the vectors of a point object, pointing to each member of the pair of points (e.g., from[k] points to si and to[k] points to sj). The vector dist contains the distance between the pairs of points. The vector lags contains the lag number to which each pair of points has been assigned. The vector bins contains the spatial midpoint between each lag and is used for plotting. The structure of a pairs object is shown below:

pairs.object$
from
to
lags
dist
bins
vector of indices into the point object for "from" point
vector of indices into the point object for "to" point
vector of spatial lags of each pair
vector of distances between each pair
vector of spatial midpoints of each lag (used for plotting)

Pairs objects are created using the pairs function.


Variogram Object Data Structure

An object of class variogram contains empirical variogram estimates generated from a point object and a pairs object. A variogram object is stored as a data frame containing six columns: lags, bins, classic, robust, med, and n. The length of each vector is equal to the num ber of lags in the pairs object used to create the variogram object, say l. The lags vector contains the lag numbers for each lag, beginning with one (1) and going to the number of lags (l). The bins vector contains the spatial midpoint of each lag. The classic, robust, and med vectors contain the classical, robust, and median variogram estimates for each lag, respectively (see Cressie, 1993, p. 75). The n vector contains the number of pairs of points in each lag. The structure of a variogram object is shown below:

variogram.object$
lags
bins
classic
robust
med
n
vector of lag identifiers
vector of midpoints of each lag
vector of classic variogram estimates for each lag
vector of robust variogram estimates for each lag
vector of median variogram estimates for each lag
vector of the number of pairs in each lag

Variogram objects are created using the variogram function.


Variogram model Object Data Structure

An object of class variogram.model represents a fitted variogram model generated by fitting a function to a variogram object. A variogram.model object is composed of a list consisting of a vector of parameters, parameters, and a semi-variogram model function, model. The structure of a variogram.model object is shown below:

variogram.model.object$
parameters
model
vector of fitted model parameters
function implementing a valid variogram model

Variogram model objects are created using the various model fitting routines. Currently several have been created: fit.exponential, fit.linear.


S+ GeoStat Introduction OOPLa Data Structures Functions Download

majure
Updated: 11-Dec-1995