VARIOG2D A Computer Program For Estimati PDF
VARIOG2D A Computer Program For Estimati PDF
VARIOG2D A Computer Program For Estimati PDF
Abstract
VARIOG2D is a Fortran-77 program that provides four basic operations for semi-variogram analysis: inference of
the experimental semi-variogram, estimation of the variance–covariance matrix of the experimental semi-variogram,
fitting a theoretical model by non-linear generalised least squares and estimation of the uncertainty of the semi-
variogram model parameters. Although software for estimating the semi-variogram by the method of moments is
widely available, there is no generally available software for assessing the uncertainty of the experimental semi-
variogram. VARIOG2D provides the exact variance–covariance matrix of the experimental semi-variogram, which can
be used for attaching standard errors to the experimental semi-variogram, for assessing the correlation between the
different semi-variogram lag estimates and for fitting a model by generalised least squares. In addition, the generalised
least-squares fitting procedure allows an evaluation of the uncertainty of the experimental semi-variogram and of the
semi-variogram model parameters. A case study shows the application of the variance–covariance matrix of the
experimental semi-variogram and the performance and capabilities of the program. # 2001 Published by Elsevier
Science Ltd.
Keywords: Geostatistics; Variance–covariance matrix; Standard error; Generalised least squares; Soil science
experimental semi-variogram and the uncertainty of tolerance and dk is the mean distance between the
semi-variogram model parameters. The exact variance– points of the kth class defined as
covariance matrix of the experimental semi-variogram NðkÞ
estimates the former uncertainty, and the approximate 1 X ‘
dk ¼ X X2‘ ; ð4Þ
variance–covariance matrix of the semi-variogram NðkÞ ‘¼1 1
model parameters assesses the latter uncertainty. The
variance–covariance matrix of the experimental semi- where x‘1 x‘2 is the Euclidean norm used to compute
variogram may be used on its own; for example, the distance between two points.
standard errors may be attached to each semi-variogram In practice, the experimental semi-variogram may be
lag estimate as well as confidence regions that include a calculated for different directions, and irregularly
given confidence level for all the semi-variogram lags located data require an angle tolerance as well as a
simultaneously. Other examples of application are distance tolerance. Other parameters that must be
based on the use of the variance–covariance matrix for specified are the number of lags K, and the length of
fitting a theoretical model to the experimental semi- the elemental lag h. The semi-variogram will be
variogram by generalised least squares, which takes into calculated at lags (h; 2h; . . . ; Kh}. An angle tolerance of
account both the estimation variance of each semi- 908 defines an omni-directional semi-variogram. Prac-
variogram lag and the correlation between semi- tical details of this calculation may be found in Isaaks
variogram lag estimates. and Srivastava (1989). ^gðdk Þ is known as the empirical,
There are different methods of approximation for the experimental or estimated semi-variogram and it is
evaluation of the uncertainty of semi-variogram model estimated at only the K specified lags and possibly for
parameters, i.e. the transfer of uncertainty in the different directions; each particular value is also known
experimental semi-variogram into uncertainty of the as semi-variogram lag estimate.
semi-variogram model parameters. One method is to
use non-linear generalised least squares to fit a
theoretical model to the experimental semi-variogram 3. Uncertainty evaluation
and to use classic inversion theory to estimate the
variance–covariance matrix of the semi-variogram The uncertainty of the experimental semi-variogram is
model parameter estimates. A more detailed description defined by its variance–covariance matrix, which is the
of the different steps of semi-variogram analysis is given K
K matrix G where the kk0 element is equal to
below. ½Gkk0 ¼ Cov½^gðdk Þ; ^gðdk0 Þ ð5Þ
and the diagonal elements give the variance of the semi-
2. Semi-variogram estimation variogram estimates
½Gkk ¼ Cov½^gðdk Þ; ^gðdk Þ ¼ Var½^gðdk Þ: ð6Þ
The semi-variogram is defined as (Matheron, 1965)
n o An exact evaluation of G is given in Pardo-Igúzquiza
gðhÞ ¼ 12E ½Zðx þ hÞ ZðxÞ2 ð1Þ and Dowd (2000), where the kk0 element is given by
½Gkk0 ¼ Covf^gðdk Þ; ^gðdk0 Þg
and is normally estimated by the method of moments
(Journel and Huijbregts, 1978) NðkÞ
X NðkXÞ
0
1 1 ‘s 2
¼ ½C ;
1 X
NðhÞ NðkÞNðk Þ ‘¼1 s¼1 2 11
0
^gðhÞ ¼ ½Zðx þ hÞ ZðxÞ2 ; ð2Þ
2NðhÞ ‘¼1 ‘s 2 ‘s 2 ‘s 2
þ 12½C12 þ 12½C21 þ 12½C22
where NðhÞ is equal to the number of pairs of values in ‘s ‘s ‘s ‘s ‘s ‘s ‘s ‘s
C11 C12 C21 C22 C11 C21 C12 C22
which the separation distance is equal to h. If the data
are irregularly located, Eq. (2) takes the form ‘s ‘s
þ C11 ‘s ‘s
C22 þ C12 C21 ð7Þ
NðkÞ
X
1 where ‘s
C12¼ EfZ1‘ Z2s g, ‘s
C21 ¼ EfZ2‘ Z1s g, ‘s
C11 ¼ EfZ1‘ Z1s g,
^gðdk Þ ¼ ½Z1‘ Z2‘ 2 ; ð3Þ
2NðkÞ ‘s
C22 ¼ EfZ2‘ Z2s g.
‘¼1
In the calculation of the covariance between the kth
where Z1‘
Zðx‘1 Þ is the first value of the ‘th pair lag and the k0 th lag of the experimental semi-variogram,
of experimental data used in the computation of ^gðdk Þ, ‘ is the index for the data pairs of the kth lag and s is the
Z2‘ Zðx‘2 Þ is the second value of the ‘th pair of index for the data pairs for the k0 th lag, 1 is the subscript
experimental
‘ data used in the computation of ^gðdk Þ, for the first datum of the pair for any lag and 2 is the
x x‘ 2 ½hk e; hk þ e, in which e is a distance subscript for the second datum of the pair for any lag.
1 2
E. Pardo-Igúzquiza, P.A. Dowd / Computers & Geosciences 27 (2001) 549–561 551
Any statistical approach to obtaining the result variogram model value for lag di and with semi-
expressed by Eq. (7) requires assumptions about the variogram model parameters y.
statistical behaviour of the random function Z. For our The minimisation of Eq. (8) is non-linear in the semi-
purposes we have assumed that Z is a second-order variogram model parameters.
stationary random function and, solely for the evalua-
tion of fourth-order moments, that Z is Gaussian
(Pardo-Igúzquiza and Dowd, 2001). Eq. (7) explicitly 5. Uncertainty of semi-variogram model parameters
takes into account the spatial location of the
experimental data, the correlation between the experi- Once a theoretical model has been fitted to the
mental data and the multiple re-use of experimental experimental semi-variogram, the uncertainty of interest
data to form pairs for the computation of the semi- is that of the semi-variogram model parameters. The
variogram lag estimates. The variance–covariance main problem is how to transfer the uncertainty of the
matrix may be used to calculate standard errors of the experimental semi-variogram into the uncertainty of
semi-variogram estimates (one confidence interval for the semi-variogram model parameters. There are various
each lag) or to give confidence regions that include a possibilities, one of which is provided by generalised
given confidence level for all the semi-variogram lag least-squares model fitting. An approximate variance–
estimates simultaneously. The Bonferroni method can covariance matrix of the estimated semi-variogram
be used to obtain rectangular confidence regions or a model parameters, under the assumption that their
parametric method may be used to obtain multi- distribution is Gaussian, is given by standard non-linear
dimensional elliptical regions (Pardo-Igúzquiza and inversion theory as the matrix C (Manke, 1984; Wood-
Dowd, 2001). bury and Sudicky, 1991)
The program has three different operating modes PTOL lag length tolerance
characterised by differences in the input and the output. TANG angle tolerance
CRESUL name of the output file that will contain
Operating mode 1:
the results
Input
The first line specifies the operating mode, i.e. the tasks
* Parameter file. to be performed by the program. The second line
Output specifies the name of the input data file. Each record of
* Experimental semi-variogram. the input file must contain the X co-ordinate, Y co-
ordinate and attribute value for each observation and
Operating mode 2: the values must be separated by at least one blank space.
Input The third line specifies the number of geographical
* Parameter file. directions for calculating the experimental semi-vario-
* Semi-variogram model file. gram. The maximum number of directions is set to 4 in
the matrix dimensions in the program but, obviously,
Output
may be increased to any number subject to computer
* Experimental semi-variogram. memory restrictions. The next lines, in number equal to
* Variance–covariance matrix of the experimental semi- the number of directions specified in the third line, must
variogram. contain the direction angles defining each direction. The
Operating mode 3: angle must be in degrees and is measured counter-
clockwise from the X-axis (or E–W direction) to the
Input desired directions. For example, if the four main
* Parameter file. geographical directions are required, i.e. E–W, NE–SW,
* Semi-variogram model file. N–S and NW–SE, the specified direction angles are 0,
* Parameters to be estimated by non-linear GLS. 45, 90 and 1358. The next line specifies the number of
* Bounds of the search area for the parameters in the lags, followed, in the next two lines, by the lag tolerance
parameter space. and the angle tolerance. If an omni-directional semi-
Output variogram is required, the angle tolerance should be
* Experimental semi-variogram. specified as 908. The name of the output file that will
* Variance–covariance matrix of the experimental contain the results is specified in the last line. Table 1
semi-variogram. shows a parameter file that will be used in Section 7. In
* Estimates of semi-variogram model parameters. addition to the contents of the parameter file listed
* Variance–covariance matrix of the estimates of semi- above, the name of the file that contains the semi-
variogram model parameters. variogram model must be entered for operating modes 2
and 3. This file has the following format:
Operating mode 1 is used for estimating the experi-
mental semi-variogram without any further calculation. PE nugget variance
Operating mode 2 also estimates the experimental semi- NE number of nested structures (apart from the
variogram but, in addition, evaluates its variance– nugget variance)
covariance matrix. In addition to the mode 2 functions, IT(1) type of semi-variogram model for the first
operating mode 3 fits a model to the experimental semi- structure
variogram by non-linear GLS and evaluates the
variance–covariance matrix of the semi-variogram Table 1
model parameters. Example of parameter file
All three operating modes of VARIOG2D require an
input parameter file with the following content: 1
R5.DAT
4
IOPERA operating mode (1, 2 or 3) 0.0
CDATA name of the input data file containing the 45.0
experimental data (X, Y, Value) 90.0
NDIR number of directions 135.0
AAX(1) first direction angle 6
... 30.0
AAX(NDIR) NDIRth direction angle 20.0
15.0
NPAS number of lags
R5VAR.VAR
PAS lag length
E. Pardo-Igúzquiza, P.A. Dowd / Computers & Geosciences 27 (2001) 549–561 553
Table 5
Example of output file (part only) in operating model 2. Complete output file contains variance–covariance matrix plus standard
deviation correlation matrix, for all possible combinations of directions. Full table is available on server at http://www.iamg.org/
CGEditor/index.htm
4 1.337726
6 0.000000E+00
26.376070 1.284335 140 1.926213E01
53.294190 1.390069 124 2.001382E01
85.990930 1.463858 138 2.027539E01
119.824400 1.381955 368 1.788677E01
155.510000 1.279237 187 2.044454E01
185.253200 1.166164 124 2.394554E01
6 45.000000
37.091290 1.411779 135 1.942542E01
71.955820 1.237810 90 2.277560E01
92.406430 1.463447 249 1.831311E01
124.161300 1.475325 266 1.856410E01
151.235100 1.423416 233 1.869772E01
179.806300 1.175616 329 1.812790E01
6 90.000000
26.416770 9.567161E01 143 1.911242E01
52.762370 1.185899 133 1.951052E01
86.957570 1.518181 181 1.931973E01
121.114900 1.297260 462 1.748244E01
155.784800 1.302162 302 1.823519E01
185.052100 1.313904 239 1.837432E01
6 135.000000
37.325600 1.2935547 130 1.966582E01
72.123780 1.560415 78 2.374251E01
91.867920 1.197152 222 1.903037E01
123.927200 1.340467 222 1.926820E01
151.546600 1.353018 178 2.038161E01
180.050000 1.194308 232 2.064019E01
Variance–covariance matrix
Direction 1 and direction 1
0.0371 0.0239 0.0234 0.0232 0.0226 0.0218
0.0239 0.0401 0.0243 0.0236 0.0221 0.0204
0.0234 0.0243 0.0411 0.0239 0.0221 0.0201
0.0232 0.0236 0.0239 0.0320 0.0243 0.0229
0.0226 0.0221 0.0221 0.0243 0.0418 0.0316
0.0218 0.0204 0.0201 0.0229 0.0316 0.0573
Direction 1 and direction 2
0.0238 0.0241 0.0240 0.0238 0.0237 0.0233
0.0240 0.0244 0.0249 0.0248 0.0242 0.0236
0.0234 0.0247 0.0248 0.0255 0.0245 0.0238
0.0235 0.0238 0.0245 0.0247 0.0248 0.0241
0.0228 0.0227 0.0227 0.0225 0.0237 0.0236
0.0218 0.0207 0.0211 0.0196 0.0220 0.0222
Direction 1 and direction 3
0.0232 0.0236 0.0241 0.0238 0.0237 0.0236
0.0233 0.0237 0.0241 0.0242 0.0242 0.0239
0.0233 0.0237 0.0239 0.0241 0.0237 0.0239
0.0234 0.0239 0.0240 0.0243 0.0240 0.0234
0.0234 0.0239 0.0241 0.0237 0.0236 0.0230
0.0230 0.0230 0.0228 0.0220 0.0219 0.0215
Direction 1 and direction 4
0.0240 0.0238 0.0239 0.0235 0.0231 0.0226
0.0242 0.0250 0.0247 0.0244 0.0239 0.0230
0.0236 0.0244 0.0251 0.0250 0.0243 0.0231
0.0237 0.0244 0.0250 0.0253 0.0253 0.0247
0.0229 0.0221 0.0239 0.0239 0.0247 0.0263
0.0217 0.0208 0.0215 0.0215 0.0229 0.0271
556 E. Pardo-Igúzquiza, P.A. Dowd / Computers & Geosciences 27 (2001) 549–561
each pair of directions. The matrices are repeated in the VARANI: VARANI evaluates the semi-variogram
form standard deviation-correlation. function between two locations. It is possible to evaluate
In operating mode 3 the output includes, in addition an isotropic model as well as a range anisotropic model.
to that generated by operating mode 2, the value of the GLSVAR: This subroutine evaluates the uncertainty
fitting function (Eq. (9)) at the minimum, the estimates of the semi-variogram model parameter estimates.
of the semi-variogram model parameters and their The assessment is made by estimating the variance–
standard error, and the complete variance–covariance covariance matrix of the estimates given in Eq. (9).
matrix and standard deviation-correlation matrix of the MATINV: This subroutine evaluates the inverse of a
estimates. matrix by its LU decomposition. It uses two other
Examples of the output file for operating models 1, 2 subroutines, LUDCMP and LUBKSB, the description
and 3 are shown in Tables 4–6, respectively, and were and code of which is given in Press et al. (1992, pp.
obtained by running VARIOG2D with the data file 287–288). Basically LUDCMP performs the LU
discussed in Section 7. decomposition and LUBKSB gives the inverse matrix
The function of each external subroutine is explained from the LU decomposition.
below. MATPROC: This subroutine calculates the product
CHIFIT2: This subroutine performs the non-linear matrix of two matrices.
GLS fitting using the experimental semi-variogram and
the variance–covariance matrix of the experi-mental
semi-variogram calculated in the main program 7. Case study
VARIOG2D.
EVALUA: This subroutine evaluates the objective Operating mode 3 will not be required for every
function given by Eq. (8). application as the output from modes 1 or 2 may
Table 6
Example of output file in operating model 3. In addition to information shown in table, mode 3 output file includes information in
mode 2 output file (Table 5). Only additional information is shown here
contain the desired results. The results provided by number that appears in the first line changed from 1
operating mode 1 are not new and may be obtained to 2.
from a variety of widely available software. The The program requests the semi-variogram model file
originality of VARIOG2D lies in the tasks performed and, for a pure nugget effect, the file shown in Table 2 is
by operating modes 2 and 3. The three operating modes entered. The output file obtained from running the
are illustrated by a case study of steady-state infiltration program in mode 2 is shown in Table 5. Assuming that
(in m s1 105) soil science data. The original 157 the pure nugget effect model is correct, the variance–
observations are given in Loague and Gander (1990, covariance matrix of the experimental semi-variogram
Table 5). The spatial locations of the data on a quasi- has been calculated by the program. The experimental
regular grid are shown in Fig. 2A. A contour map of the semi-variogram and the experimental semi-variogram
data set is shown in Fig. 2B. 2 SE (obtained from the diagonal of the variance–
The first step is to run the program in mode 1 to covariance matrix) for the four principal geographical
obtain the experimental semi-variogram. The experi- directions are shown in Figs. 3A–D. The semi-vario-
mental semi-variogram is calculated for the four gram estimate for the first lag in the N–S direction is
principal geographical directions (E–W, NE–SW, significant (i.e. differs from the assumed pure nugget
N–S and NW–SE) and for 6 lags along each direction effect model) at the 95% confidence level as the
with an elementary lag length of 30 m, lag tolerance confidence interval for that lag (0.574, 1.338) does not
of 20 m and angle tolerance of 158. The parameter contain the pure nugget effect value of 1.34 (m s1 105)2
file is shown in Table 1. The experimental semi- assumed as the model.
variogram is shown in Fig. 3 and the output file is It would seem that a more appropriate model is an
shown in Table 2. anisotropic model with the longest range in approxi-
As a first approximation we can assume a pure nugget mately the N–S direction and the shortest range in the
effect and run VARIOG2D in operating mode 2. The perpendicular direction and with a significant propor-
parameter file is that shown in Table 1 but with the tion of the variance modelled as a nugget effect. Using
Fig. 2. (A) Locations of 157 steady-state infiltration data. (B) Contour plot with contour interval of 0.5 m s1 105 and using inverse
distance weighting procedure for interpolation, i.e. without assuming any particular stochastic model. X and Y co-ordinates are given
in meters in both figures.
558 E. Pardo-Igúzquiza, P.A. Dowd / Computers & Geosciences 27 (2001) 549–561
Fig. 4. Directional variograms and 95% confidence limits for each variogram lag using 2 SE obtained from variance–convariance
matrix of experimental variogram (g: experimental variogram) for directions: (A) E–W; (B) NE–SW; (C) N–S and (D) NW–SE.
560 E. Pardo-Igúzquiza, P.A. Dowd / Computers & Geosciences 27 (2001) 549–561
Fig. 4. (Continued).
important for small numbers of experimental data where measure of its uncertainty. VARIOG2D provides a tool
the uncertainty has important consequences for applica- for solving the problem.
tions. In addition, VARIOG2D provides non-linear,
generalised least-squares fitting of a theoretical model to
the experimental semi-variogram and evaluates the
uncertainty of the semi-variogram model parameter Acknowledgements
estimates by calculating their variance–convariance
matrices. It should become good geostatistical practice The authors wish to thank the reviewers for their
to report the experimental semi-variogram with some constructive comments.
E. Pardo-Igúzquiza, P.A. Dowd / Computers & Geosciences 27 (2001) 549–561 561