1. Home
  2. FCOVARIOGRAM directive


Forms a covariogram structure containing auto-variograms of individual variates and cross-variograms for pairs from a list of variates.


PRINT = string token Controls printed output (statistics, variograms, autovariograms); default stat
METHOD = string token Specifies what to do when the measurements are not all made at the same locations (allwithcrossnugget, allnocrossnugget, commonpoints); default comm
COVARIOGRAM = pointer Pointer to store the variograms, cross-variograms and associated information for use in MCOVARIOGRAM
MAXLAG = scalar Maximum lag in all directions
STEPLENGTHS = scalar or variate Length of the step or steps in which lag is incremented
DIRECTIONS = scalar or variates Directions along which to form the variogram, scalar for a single direction in 2 dimensions, variate for several directions in 2 dimensions, and pairs of variates for 3 dimensional data
SEGMENTS = scalar Angle subtended by each segment along the DIRECTIONS
COORDSYSTEM = string token Coordinate system used for the geometry for discretizing the lag (mathematical, geographical); default math
MAXCONEDIAMETER = scalar Diameter at which the segments over which averaging is to be done should cease to expand; default * implies no limit
MINCOUNT = scalar Minimum number of points required at a particular lag point for the cross-variogram to be estimated there; default 1
DRIFT = string token Mean function (constant, linear, quadratic); default cons


DATA = variates Measurements as a variate
X1 = variates Locations of each set of measurements in the first dimension
X2 = variates Locations of each set of measurements in the second dimension (if recorded in more than 1 dimension)
X3 = variates Locations of each set of measurements in the third dimension (if recorded in 3 dimensions)


The FCOVARIOGRAM directive forms a covariogram structure containing auto- and cross-variograms for pairs from a list of variates.

The data are supplied as a list of variates using the DATA parameter, where each variate contains the measurements for each variable. The locations of the measurements are supplied using parameters X1, X2 (for two or three dimensions) and X3 (for three dimensions) parameters.

The METHOD option specifies how to calculate the cross-variograms. The setting commonpoints specifies that only those points observed in common in every sample are to be included; the method described in Section 8.3.4 of Part 2 of the Guide to the Genstat Command Language are then used. Alternatively, the setting allnocrossnugget can be used when the sampling locations do not match. This uses an algorithm outlined in Künsch, Papritz & Bassi (1997) that performs least-squares fitting of the cloud of products of differences to estimate the expected value of these products. If there are no common points, the nugget variance cannot be calculated. However, if there is partial sampling (i.e. some common points), the setting allwithcrossnugget can be used to shift the cross-variograms by the semivariance at the origin to estimate the nugget effect.

The maximum lag distance in all directions to which the variograms are calculated is set by the MAXLAG option. The increments in distance are set by the STEPLENGTH option, where you can supply a scalar to define equally-spaced steps or a variate to specify the steps themselves. The directions along which to form the variograms are supplied in degrees using the DIRECTIONS option. The geometry used for the directions is given by the COORDSYSTEM option: the setting mathematical specifies directions counter-clockwise from east, and geographical specifies clockwise from north (for the first direction only in three dimensions). Each direction is at the centre of an angular range. The angle is the same in every direction, and is defined by the SEGMENTS option. For a single direction in two dimensions the DIRECTIONS option should be set to a scalar, while for several directions it should be set to a variate. For directions in three dimensions, DIRECTIONS should specify a pair of variates. The MAXCONEDIATMETER option can be used to specify a diameter at which the segments cease to expand. For cross-variograms that are formed using all points the minimum number of points required at each lag can be specified using the MINCOUNT option.

The DRIFT option can be used to calculate the variograms after removing a systematic component. Setting the DRIFT option to linear or quadratic will fit a regression to the observations and then form the variograms on the residuals.

The COVARIOGRAM option allows you to specify pointer to save the auto-variograms, cross-variograms and associated information. Its elements contain:

1    a matrix with columns of variograms and cross-variograms and rows indexed by lags within directions;

2    a variate of counts at the lags in each direction;

3    distances of the lags in each direction;

4    horizontal angles;

5    vertical angles;

6    variances;

7    distance classes;

8    method;

9    pointer containing identifiers of the DATA variates;

10  number of dimensions.

This structure provides the information required to fit models to the covariogram using the directive MCOVARIOGRAM.

The PRINT option can be set to statistics to display statistics for each of the variates. The setting variograms displays each of the auto- and cross-variograms, while the setting autovariogram displays only the auto-variograms.


Parameters: DATA, X1, X2, X3.

Action with RESTRICT

Restrictions are ignored.


Künsch, H.R., Papritz, A. & Bassi, F. (1997) Generalized cross-covariances and their estimation. Mathematical Geology, 29, 779-799.

See also



Commands for: Spatial statistics.


" Examples 2:8.3.6, 2:8.3.7, 2:8.3.8 & 2:8.3.9 "
" Data are measurements of concentrations of trace metals in the topsoil
  of the Swiss Jura. Data analyzed are Cadmium, Nickel and Zinc taken 
  from Goovaerts prediction subset. See Goovaerts (1997) Geostatistics 
  for Natural Resources Evaluation."
FILEREAD     [PRINT=summary; NAME=\
             SEGMENTS=180; MAXCONE=500; MINCOUNT=1;\ 
             COVARIOGRAM=Save_cov] DATA=Cd,Ni,Zn; X1=X1; X2=X2
" Plot the variograms and covariograms."
GETATTRIBUTE [ATTRIBUTE=columns] Save_cov['semivar']; Lab
FRAME        11...16; YLOWER=2(0.66,0.33,0); YUPPER=2(0.98,0.65,0.32);\
             XLOWER=(0,0.5)3; XUPPER=(0.5,1)3
TEXT         scr; VALUE='clear'
PEN          1; SYMBOL='circle'
XAXIS        11...16; TITLE='Lag distance/km'; LOWER=0; LROTATION=45
YAXIS        11...16; TITLE='Semi-variance'; LOWER=0
  DGRAPH     [WINDOW=i+10; KEY=0; TITLE=Lab['columns']$[i]; SCREEN=#scr]\ 
             Save_cov['semivar']$[*;i]; Save_cov['distances']$[*;i]
  TEXT       scr; VALUE='keep'
" Model the coregionalization."
MCOVARIOGRAM [PRINT=summary,estimates; WEIGHTING=counts;\
             MAXLAG=3; MINCOUNT=20; COVARIOGRAM=Save_cov]\
             MODELTYPE=nugget,spherical,spherical; INITIAL=*,0.2,1.3;\
" Read the locations of the prediction points."
MATRIX       [ROWS=1547; COLUMNS=2] Mpoints
OPEN         '%GENDIR%/Examples/GuidePart2/Mpoints.dat'; CHANNEL=2
READ         [CHANNEL=2] Mpoints
CLOSE        2; FILETYPE=input
" Produce predictions and variances for target variable Cadmium."
COKRIGE  [PRINT=description; Y=Cd; POINTS=Mpoints; RADII=20;\
         SEARCHNEIGHBOURHOOD=local] Cd; X1=X1; X2=X2;\
         ESTIMATES=Save_est; PREDICTIONS=Predictions;\
" Plot the predictions and variances."
EQUATE   T(Mpoints); !p(Xpos,Ypos)
GROUPS   [REDEFINE=yes] Xpos,Ypos; FACTOR=Xfac,Yfac; LEVELS=Xlevs,Ylevs
TABULATE [CLASSIFICATION=Yfac,Xfac] Predictions,Variances;\
MATRIX   [ROWS=!(#Ylevs); COLUMNS=!(#Xlevs)] Mpredictions; !(#Zvals)
MATRIX   [ROWS=!(#Ylevs); COLUMNS=!(#Xlevs)] Mvariances; !(#Zvars)
XAXIS    [RESET=yes] 1
YAXIS    [RESET=yes] 1
PEN      2,3; COLOUR='azure','midnightblue'
DSHADE   [TITLE='Cokriged estimates for cadmium in the Swiss Jura';\
         YORIENTATION=normal; GRIDMETHOD=*] Mpredictions; PEN=!(2,3)\
DSHADE   [TITLE='Cokriging variances for cadmium in the Swiss Jura';\
         YORIENTATION=normal; GRIDMETHOD=*] Mvariances; PEN=!(2,3)
PEN      [RESET=yes] 1,2,3
Updated on June 19, 2019

Was this article helpful?