8

I was following this wiki article related to ordinary kriging

enter image description here

Now my covariance matrix looks like this, for 4 variables

1   0.740818220681718   0.548811636094027   0.406569659740599
0.740818220681718   1   0.740818220681718   0.548811636094027
0.548811636094027   0.740818220681718   1   0.740818220681718
0.406569659740599   0.548811636094027   0.740818220681718   1

Well the relation between semvariogram and variogram is given by

$\gamma(h)/(C0) = 1 - C(h)/C(0)$

So, I calculated the $\gamma(h)$ as well. Now when I try to calculate the weights as

A = 1.0000    0.7408    0.5488    1.0000
    0.7408    1.0000    0.7408    1.0000
    0.5488    0.7408    1.0000    1.0000
    1.0000    1.0000    1.0000         0 

B =  0.4066
    0.5488
    0.7408
    1.0000

I am taking the fourth variable as missing

 [W;mu] = inv(A)*B =  0.1148
                      0.0297
                      0.8555
                     -0.1997

The above was by using covariance. Now using semi variance I had

A = 0         0.2592    0.4512    1.0000
    0.2592         0    0.2592    1.0000
    0.4512    0.2592         0    1.0000
    1.0000    1.0000    1.0000         0

B = 0.5934
    0.4512
    0.2592
    1.0000


inv(A)*B =  0.1148
            0.0297
            0.8555
            0.1997

As you can see the last terms are not equal. When according to the derivation they are equated or said to be equal. Any clarifications?

user34790
  • 6,049
  • 6
  • 42
  • 64
  • Any one guys. This is killing me. What am I doing wrong? – user34790 Aug 08 '13 at 23:38
  • 2
    There's nothing in the derivation that says $\mu$ must be the same in the covariance and semivariance formulations. – whuber Sep 16 '13 at 18:22
  • Not a solution (I didn't know how to post this in the comment section in a nice readable format) but have you noticed the structure of the inverse of A in the two different cases? > A = matrix(c(1.0000,0.7408,0.5488,1.0000, + 0.7408,1.0000,0.7408,1.0000, + 0.5488,0.7408,1.0000,1.0000, + 1.0000,1.0000,1.0000,0),nrow=4) > > solve(A) [,1] [,2] [,3] [,4] [1,] 1.9619812 -1.7076503 -0.2543309 0.4426230 [2,] -1.7076503 3.4153005 -1.7076503 0.1147541 [3,] -0.2543309 -1.7076503 1.9619812 0.4426230 [4,] 0.4426230 0.1147541 0.4426230 -0.7705443 > > > A = matrix(c(0,0.2592,0.4512,1.0000, + 0.2592,0,0.2592 –  Aug 17 '13 at 16:19

1 Answers1

2

I suspect that the quoted formula from the Wikipedia article results from a confusion in the notations, as if $\gamma$ was intended to be the covariance in the formula although it was formerly used for the theoretical semi-variogram, as well as the sample semi-variogram... As I understand, $x^\star$ and $x_0$ are also a same thing, the "new" location vector.

To obtain both the same Lagrange multiplier $\mu$ and the vector $\mathbf{w}$ of $n$ kriging weights with the variogram $\gamma$, you ought to use a different system $$ \begin{bmatrix} \boldsymbol{\Gamma} & -\mathbf{1} \\ -\mathbf{1}^\top & 0 \end{bmatrix} \begin{bmatrix} \mathbf{w} \\ \mu \end{bmatrix} = \begin{bmatrix} \boldsymbol{\gamma}^\star \\ -1 \end{bmatrix} $$ where $\boldsymbol{\Gamma}$ is the $n \times n$ matrix $\boldsymbol{\Gamma} = \left[ \gamma(\mathbf{x}_i,\,\mathbf{x}_j)\right]_{i,j}$ and $\boldsymbol{\gamma}^\star$ is the vector $\boldsymbol{\gamma}^\star = \left[ \gamma(\mathbf{x}^\star,\,\mathbf{x}_i)\right]_{i}$ involving the new location $\mathbf{x}^\star$ and $\mathbf{1}$ is a vector of ones with length $n$.

See (up to notations changes) Statistics for Spatial Data by N. Cressie p. 121 in the revised edition.

## using the covariance 
Acov <-  matrix(c(1.0000, 0.7408, 0.5488, 1.0000,
                  0.7408, 1.0000, 0.7408, 1.0000,
                  0.5488, 0.7408, 1.0000, 1.0000,
                  1.0000, 1.0000, 1.0000, 0.0000),
                nrow=4) 
Bcov <- c(0.4066, 0.5488, 0.7408, 1.0000)
## using the variogram 
Avario <- matrix(-1, nrow = 4, ncol = 4)
Avario[1:3, 1:3] <- 1 - Acov[1:3, 1:3]
Avario[4, 4] <- 0
Bvario <- 1 - Bcov
Bvario[4] <- -1
## compare
cbind(cov = solve(Acov, Bcov), vario = solve(Avario, Bvario))
Yves
  • 4,313
  • 1
  • 13
  • 34