1. Home
  2. COKRIGE directive

COKRIGE directive

Calculates kriged estimates using a model fitted to the sample variograms and cross-variograms of a set of variates.

Options

PRINT = string token Controls printed output (description, search, weights, conditionalprobabilities, quantiles, crossvalidations); default desc
Y = variate Variate to predict in the cokriging
METHOD = string token Type of kriging (Normal, LogNormal); default Norm
X1OUTER = variate Variate containing 2 values to define the bounds of the region to be examined in the first direction; by default the whole region is used
X2OUTER = variate Variate containing 2 values to define the bounds of the region to be examined in the second direction; by default the whole region is used
X3OUTER = variate Variate containing 2 values to define the bounds of the region to be examined in the third direction; by default the whole region is used
X1INNER = variate Variate containing 2 values to define the bounds of the interpolated region in the first direction; no default
X2INNER = variate Variate containing 2 values to define the bounds of the interpolated region in the second direction; no default
X3INNER = variate Variate containing 2 values to define the bounds of the interpolated region in the third direction; no default
X1INTERVAL = scalar Distance between successive interpolations in the first direction; default 1.0
X2INTERVAL = scalar Distance between successive interpolations in the second direction; default 1.0
X3INTERVAL = scalar Distance between successive interpolations in the third direction; default 1.0
POINTS = matrix Allows the point where predictions are required to be specified explicitly if the X13INNER and X13INTERVAL options are unset, otherwise if these are set, saves the locations of the prediction points
BLOCKDIMENSIONS = variate or matrix Dimensions of the block(s) in the 3 directions, a variate defines identical blocks for each prediction point, a matrix can be used to define different block sizes for each point when the points are defined by the POINTS option; default !(0,0,0) i.e. punctual kriging at every point
POOLRADIUS = scalar Specifies the minimum distance for which points are pooled; default * i.e. no pooling
SEARCHNEIGHBOURHOOD = string token Search neighbourhood to be used (global, local); default glob
MINPOINTS = scalars Minimum number of data points from which to compute elements
MAXPOINTS = scalars Maximum number of data points in each direction from which to compute elements
RADII = scalars or variates Scalar defining the maximum distance between target point in block and usable data for each variable in 1 dimension, or radii of the ellipse or ellipsoid enclosing the usable points in 2 or 3 dimensions
ELLIPSEAXIS = scalar or variate Angle or angles defining the direction of the axis of the ellipse or ellipsoid, scalar for 2 dimensions and variate containing 3 values for 3 dimensions
DRIFT = string token Mean function for universal cokriging (constant, linear, quadratic, polygon); default cons
X1EXV = variate Variate containing locations of the explanatory model in the first dimension
X2EXV = variate Variate containing locations of the explanatory model in the second dimension (if recorded in 2 or 3 dimensions)
X3EXV = variate Variate containing locations of the explanatory model in the third dimension (if recorded in 3 dimensions)
TERMS = variates List of variates for explanatory model; default * i.e. none
POLYGONCOORDINATES = pointer Pointer containing the coordinates of polygons in 2 variates and the map unit numbers within a factor
COORDSYSTEM = string token Coordinate system used for the geometry for discretizing the lag (mathematical, geographical); default math
CPTHRESHOLD = scalar or variate Threshold(s) for calculating the conditional probabilities
PERCENTQUANTILES = scalar or variate Percentage points for which quantiles are required; default 5 and 95
LOGBASE = string token Base of antilog transformation to be applied to the predictions and variances for lognormal (co)kriging (ten, e); default * i.e. none

Parameters

DATA = variates Measurements as one or more variates
X1 = variates Locations of the measurements in the first dimension
X2 = variates Locations of the measurements in the second dimension (if recorded in 2 or 3 dimensions)
X3 = variates Locations of the measurements in the third dimension (if recorded in 3 dimensions)
PREDICTIONS = variate Kriged estimates
VARIANCES = variate Estimation variances
MEASUREMENTERROR = scalars Variance of measurement error for punctual (co)kriging
ESTIMATES = pointers Estimates for the model structure
CONDITIONALPROBABILITIES = pointers Structure to save conditional probabilities
QUANTILES = pointers Structure to save estimated quantiles
SAMPLESUPPORT = scalars Sampling size (length, area or volume according to the dimensionality of the data) of the data points

Description

The COKRIGE directive computes kriged estimates using a model fitted by MCOVARIOGRAM to the sample auto- and cross-variograms of a set of variates. The data are supplied as a list of variates using the DATA parameter. The target variable to predict is supplied using the Y option. Note that the target variable must also be present in the list of variates supplied with the DATA parameter. The locations of the measurements are supplied using the parameters X1, X2 (for two or three dimensions) and X3 (for three dimensions).

The METHOD option allows you to specify whether to perform Normal or logNormal cokriging. The lognormal setting is only available for punctual cokriging. For logNormal cokriging the LOGBASE option allows you to specify the base of the logarithms (ten or e) for back transforming the kriged predictions and variances.

By default, Genstat uses global prediction where, for each prediction, all the data values are used. However, it is often desirable to use a subset in a (spatial) neighbourhood around the prediction location. This could be for computational reasons, or to assume local first-order stationarity. You can choose whether to use a global or local search using the SEARCHNEIGHBOURHOOD option.

You can select a subset of the data to be considered when forming the cokriging system by specifying the area or volume defined by X1OUTER, X2OUTER and X3OUTER. Each of these should be set to a variate with two values to define the lower and upper limits in each direction.

You can supply the positions at which the target variable is predicted (estimated) in two ways. The first way is to generate the locations using the X13INNER and X13INTERVAL options. X1INNER, X2INNER and X3INNER are set to variates with two values to define the lower and upper limits in each direction, and the limits should not lie outside those of X1OUTER, X2OUTER and X3OUTER. X1INTERVAL, X2INTERVAL and X3INTERVAL are set to scalars to define the distance between the successive positions in the first, second and third direction. The intervals should be specified using the same units as the data. You can save the generated locations by supplying an identifier in the POINTS option. The second way is to explicitly supply the points where predictions are required. If the X13INNER and X13INTERVAL options are unset then you can use the POINTS option to supply a matrix of prediction locations.

By default the cokriging is punctual, i.e. at points that have the same size and shape as the sample support. The BLOCKDIMENSIONS option can be used to specify block cokriging. You can either specify a variate containing the dimensions of the block(s) in the three directions or alternatively supply a matrix defining different block sizes for each point when points are supplied using the POINTS option. For punctual cokriging, you can specify the variance of any measurement error using the MEASUREMENTERROR parameter.

The minimum and maximum number of points used for the kriging are set by the MINPOINTS and MAXPOINTS options, respectively.

The RADII option defines the maximum distance between the target point in a block and usable data. For an isotropic search you should supply a scalar to define the maximum distance or radii of the ellipse (two dimensions) or ellipsoid (three dimensions). For an anisotropic search you should supply the distances for each axis of the ellipse of ellipsoid. For an anisotropic search the angle or angles defining the direction of the axes of the ellipse or ellipsoid for the search are supplied using the ELLIPSEAXIS option. For two dimensions you should supply a scalar containing the angle for the first axis which is measured in degrees, counter-clockwise from East if option COORDSYSTEM is set to mathematical, or clockwise from North if COORDSYSTEM is set to geographical. For three dimensions the first value defines the angle for the first axis which is measured in degrees, counter-clockwise from East if COORDSYSTEM is set to mathematical, or clockwise from North if COORDSYSTEM is set to geographical. The second value defines the dip angle for the first axis (rotation angle around the y-axis) which is measured in degrees up from horizontal. The third value defines the rotation angle of the second and third axis around the first axis (defined by the two previous angles).

The POOLRADIUS option allows you to specify a minimum distance for which points can be pooled.

The ESTIMATES parameter allows you to specify an identifier of a data structure storing estimates of the non-linear parameters, sill values and associated information. This structure should be formed using the MCOVARIOGRAM directive.

The PRINT option controls the printed output with settings:

    description description of the length, area or volume being kriged and the model that is used,
    search the results of the search for data around each position that is kriged,
    weights the kriging weights at each position,
    crossvalidation cross-validation statistics for punctual cokriging (the cross-validation is calculated by estimating each sample point from the data after excluding the sample value),
conditionalprobabilities conditional probabilities for the values specified by the CPTHRESHOLD option,
    quantiles quantiles for the values specified by the PERCENTQUANTILES option.

Universal kriging may be invoked by setting the DRIFT option to linear or to quadratic, i.e. to be of order 1 or 2. The default is DRIFT=constant, to give ordinary cokriging. You can include explanatory variables in the mean function by listing explanatory variates with the TERMS option, and their associated coordinates using the X1EXV, X2EXV and X3EXV options. For two-dimensional cokriging, the DRIFT=polygon option allows you to specify categorical variables defined by one or more closed polygons (map units). The map units and polygons should be supplied in a pointer using the POLYGONCOORDINATES option. The pointer should contain the coordinates of the polygons in two variates (x- and y-positions) and a factor where each level defines a different map unit. If there is more than one polygon within a map unit these should be separated with a row of missing values.

You can specify the sampling support size (length, area or volume) of the data points using the SAMPLESUPPORT parameter.

The PERCENTQUANTILES option can specify percentage values for which to compute quantiles for the conditional distributions. The quantiles can be saved using the QUANTILES parameter.

The CPTHRESHOLD option allows you to specify thresholds for calculating conditional probabilities. The conditional probabilities can be saved using the CONDITIONALPROBABILITIES parameter.

The kriged predictions and variances can be saved using the PREDICTIONS and VARIANCES parameters. If a grid or volume of points has been generated using the X13INNER and X13INTERVAL options, the corresponding prediction locations can be saved using the POINTS option.

Options: PRINT, Y, METHOD, X1OUTER, X2OUTER, X3OUTER, X1INNER, X2INNER, X3INNER, X1INTERVAL, X2INTERVAL, X3INTERVAL, POINTS, BLOCKDIMENSIONS, POOLRADIUS, SEARCHNEIGHBOURHOOD, MINPOINTS, MAXPOINTS, RADII, ELLIPSEAXIS, DRIFT, X1EXV, X2EXV, X3EXV, TERMS, POLYGONCOORDINATES, COORDSYSTEM, CPTHRESHOLD, PERCENTQUANTILES, LOGBASE.

Parameters: DATA, X1, X2, X3, PREDICTIONS, VARIANCES, MEASUREMENTERROR, ESTIMATES, CONDITIONALPROBABILITIES, QUANTILES, SAMPLESUPPORT.

See also

Directives: FCOVARIOGRAM, MCOVARIOGRAM, FVARIOGRAM, KRIGE.

Procedures: DCOVARIOGRAM, KCROSSVALIDATION, MVARIOGRAM, DVARIOGRAM, DHSCATTERGRAM.

Commands for: Spatial statistics.

Example

" 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=\
             '%GENDIR%/Examples/GuidePart2/Goovaerts.dat']X1,X2,Cd,Ni,Zn
FCOVARIOGRAM [PRINT=statistics; MAXLAG=2.1; STEP=0.1; DIRECTIONS=0;\
             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
FOR [INDEX=i; NTIMES=6]
  DGRAPH     [WINDOW=i+10; KEY=0; TITLE=Lab['columns']$[i]; SCREEN=#scr]\
             Save_cov['semivar']$[*;i]; Save_cov['distances']$[*;i]
  TEXT       scr; VALUE='keep'
ENDFOR
" 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;\
             ESTIMATES=Save_est
DCOVARIOGRAM [ESTIMATES=Save_est] Save_cov
" 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;\
         VARIANCES=Variances
" Plot the predictions and variances."
VARIATE  [NVALUES=NROWS(Mpoints)] Xpos,Ypos
EQUATE   T(Mpoints); !p(Xpos,Ypos)
GROUPS   [REDEFINE=yes] Xpos,Ypos; FACTOR=Xfac,Yfac; LEVELS=Xlevs,Ylevs
TABULATE [CLASSIFICATION=Yfac,Xfac] Predictions,Variances;\
         MEANS=Zvals,Zvars
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 20, 2019

Was this article helpful?