next up previous contents index
Next: Prediction Up: Getting started Previous: Default program action   Contents   Index

Subsections


Modelling spatial dependence

When no prediction locations are defined in the command file, gstat starts the interactive variogram modelling user interface (example 1, example 2). Multiple variables are analyzed when they are specified with data( id) commands, each having a unique id. From this interface sample variograms, covariograms, cross variograms and cross covariograms can be calculated, viewed, and modelled (see Appendix A.1); variogram plots can be saved (e.g. as POSTSCRIPT file, see below) and printed; and modified settings of data and fitted variograms can be saved as a gstat command file. The interface has several selection items and single-key options. Summary help is obtained by pressing `H' (shift-h).

A variogram plot from gnuplot (gif terminal) is shown below:

fit.gif Help on a specific user interface item is obtained by selecting the item with the cursor keys and pressing `?'. What follows is a brief description of the visible items in the user interface:

enter/modify data
enter a new variable or modify (reload) a variable (allows only a few input options)
choose variable
choose a variable, or, if the next field is on a cross (co-) variogram, a pair of variables
calculate what
choose what to calculate (variogram, cross variogram, covariogram or cross covariogram)
cutoff, width
prompts for the cutoff (the maximum distance at which pairs of data points will be considered for inclusion in sample variogram estimates) and the lag width (the step size of distance intervals for sample variogram estimates). Non-even interval boundaries can be obtained by specifying bounds in the command file (section 4.1)
direction
enter directional parameters (direction angle and direction tolerance: the maximum deviation from this direction tolerated for a pair of data points to be included in the sample variogram estimate)
variogram model
enter a variogram model or change variogram model parameters (section 4.3)
fit method
choose a variogram fit method (or no fit)
show plot
show variogram and model (if present, and after optional fitting)

Variogram models can be fitted to the sample variogram using iterative reweighted least squares estimation [4], or can be fitted directly to the sample data using REML estimation [15]. Appendix A.1 gives details on the calculation of sample (co-) variograms and model fitting. Non-linear least squares fitting is only guaranteed to work when good initial values are provided. Therefore, and more in general, visual examination of model fit is recommended.

Variogram plots can be saved as encapsulated POSTSCRIPT file (Fig. 2.2) from gnuplot by pressing `P' or as gif file by pressing `G' (gif only when the gd library was linked to gnuplot). Plots can be customised (e.g. labels, legend, title) by first saving sample variogram estimates to a file (`e'), then saving the gnuplot commands to a file (`g'), then modifying this file and finally using gnuplot to create the POSTSCRIPT (or other graphics) file.

By default, direct and cross variograms and covariograms are calculated from ordinary least squares residuals by using a linear model (as default only an intercept, section 2.7). Generalised least squares residuals are used when the command

set gls=1;

is added to the command file (sections 2.7, 4.4).

Non-interactive variogram modelling

Variograms can also be calculated non-interactively, by adding the command

method: semivariogram;

or

method: covariogram;

to the command file (section 4.5).

Sample variograms can be saved to a file, using for instance:

variogram(zinc): 'zinc.est';

For large data sets, it may be best to calculate sample variograms non-interactively and do the modelling afterwards. This is accomplished by first saving the sample variograms to file as described above, and then to load only the sample variograms in the user interface (not the data), which is done by defining dummy data:

data(zinc); # dummy data

and a valid sample variogram, as

variogram(zinc): 'zinc.est';

or, when a variogram model should be defined ahead of fitting:

variogram(zinc): 'zinc.est', 1 Nug() + 1 Sph(800);


Variogram maps

If in addition to one of these method commands a mask map is specified, then gstat calculates the variogram map [12] for the field specified by the mask, and writes this map to the output map zincv.map

variogram(zinc): 'zinc.map';

optionally, in addition the corresponding number of data pairs can be written to the output map zincn.map when specified as

variogram(zinc): 'zince.map', 'zincn.map';

(typically a variogram map is centred around (0,0) and has map dimension and cell size similar to cutoff and interval width values).


next up previous contents index
Next: Prediction Up: Getting started Previous: Default program action   Contents   Index
Edzer Pebesma
1999-08-31