[R-sig-Geo] Positive Definite Covariance Matrix for Grid Sampled Data

Christopher Paciorek paciorek at hsph.harvard.edu
Wed Sep 12 00:18:15 CEST 2007


If you want to avoid zero distances, what Edzer meant is to actually jitter the points and then recalculate the distance matrix based on the new locations.  Replacing the zeros doesn't give you a valid distance matrix because it doesn't account for having moved the two points with respect to all the other points.

For an exponential covariance that will probably be sufficient. For the Matern or squared exponential (Gaussian), if you have small distances, you may need to add a small amount of variance to the diagonals to make it numerically stable (essentially a fake nugget).  Alternatively, if you fit the covariance (based on maximum likelihood or fitting the semivariogram) and you get a non-zero nugget, that has the same effect but in that case the added variance may be substantial.

chris

 
 
>>> "Keith Dunnigan" <keith at statkingconsulting.com> 09/11/07 4:57 PM >>> 
Edzer,

  Thanks for your help!  I tried the first suggestion.., I replaced all
the zero's in the distance matrix with a different value.., but I still
have the same problem.  I get negative eigenvalues.  I tried various
constants, replacing the zero with positive numbers up to 5, with no
luck.

  Anyone have any other ideas?

  Keith

----- Original Message-----
From: Edzer J. Pebesma [mailto:e.pebesma at geo.uu.nl] 
Sent: Tuesday, September 11, 2007 2:30 PM
To: Keith Dunnigan
Cc: r- sig- geo at stat.math.ethz.ch
Subject: Re: [R- sig- Geo] Positive Definite Covariance Matrix for Grid
Sampled Data

Keith,

indeed kriging usually fails when one or more point pairs have zero 
distance. One solution in terms of distances would be to shift these 
points a bit, such that no zero distances occur anymore. In terms of the

covariances, the solution would be to lower the corresponding 
off- diagonal entries with a small amount.

If you have measurements with a known measurement error variance, it may

make sense to use this variance as the amount to subtract from all  
off- diagonal elements of the covariance matrix.

Hope this helps,
--
Edzer

Keith Dunnigan wrote:
> Hello all,
>
>  
>
>   First I would like to apologize if this question is inappropriate
for
> this list.  I am new here, I found this list doing a web search and it
> seemed like the members here would have knowledge in this area.  If
> there are more appropriate lists of forums for this question, I would
> appreciate that information.
>
>  
>
>   I do the majority of my work as a biostatistician in the
> pharmaceutical industry, so I am new to this area.  I am working on a
> couple of small projects in this area though.  I have consulted a
couple
> of basic texts ("Introduction to Geostatistics" by Kitanidis, and "An
> Introduction to Applied Geostatistics" by Isaaks & Srivastava).
>
>  
>
>   The gist of what I have gathered from my reading is that standard
> practice is not to use the actual covariance matrix calculated from
the
> data.  This is because this matrix may in general not be positive
> definite.  Instead standard practice seems to be to pick from one of
> several standard covariance models, which are guaranteed to be
positive
> definite.  After fitting the most appropriate model then, one
generates
> the covariance matrix from this model and the distance matrix.  The
> resulting matrix should be positive definite.
>
>  
>
>   The only problem is, I am not finding that to be true.  For
instance,
> when I apply the exponential model to my distance matrix and calculate
> the eigenvalues, I find that some of them are negative.  Very, very
> small, but negative (For example - 1.2 x 10exp- 13).  I applied a couple
> of models and found this to be true. Could someone help me with this?
>
>  
>
>   This is a small data set.  I have a distance matrix that is 20 by
20.
> The exponential model I have used has range parameter R = 14 and sigma
> squared parameter 86.618.  Letting the distance be x, the exponential
> model then is c(x) = sigmasq * exp( ((- 3)*x)/R .  
>
>  
>
>   My distance matrix is such that most of the covariances have very
> small values (effectively zero), except for the first couple of
> distances.  That may be the trouble, what do geo folks usually do in
> situations such as this?  I have copied the distance matrix below in
the
> case any of you wants to take a look at this.
>
>  
>
>                  0 162 232 246 474   0 162 232 246 474   0 162 232 246
> 474   0 162 232 246 474
>
>          162   0  70  84 312 162   0  70  84 312 162   0  70  84 312
162
> 0  70  84 312
>
>          232  70   0  14 242 232  70   0  14 242 232  70   0  14 242
232
> 70   0  14 242
>
>          246  84  14   0 228 246  84  14   0 228 246  84  14   0 228
246
> 84  14   0 228
>
>          474 312 242 228   0 474 312 242 228   0 474 312 242 228   0
474
> 312 242 228   0
>
>            0 162 232 246 474   0 162 232 246 474   0 162 232 246 474
0
> 162 232 246 474
>
>          162   0  70  84 312 162   0  70  84 312 162   0  70  84 312
162
> 0  70  84 312
>
>          232  70   0  14 242 232  70   0  14 242 232  70   0  14 242
232
> 70   0  14 242
>
>          246  84  14   0 228 246  84  14   0 228 246  84  14   0 228
246
> 84  14   0 228
>
>          474 312 242 228   0 474 312 242 228   0 474 312 242 228   0
474
> 312 242 228   0
>
>           0 162 232 246 474   0 162 232 246 474   0 162 232 246 474
0
> 162 232 246 474
>
>          162   0  70  84 312 162   0  70  84 312 162   0  70  84 312
162
> 0  70  84 312
>
>          232  70   0  14 242 232  70   0  14 242 232  70   0  14 242
232
> 70   0  14 242
>
>          246  84  14   0 228 246  84  14   0 228 246  84  14   0 228
246
> 84  14   0 228
>
>          474 312 242 228   0 474 312 242 228   0 474 312 242 228   0
474
> 312 242 228   0
>
>           0 162 232 246 474   0 162 232 246 474   0 162 232 246 474
0
> 162 232 246 474
>
>          162   0  70  84 312 162   0  70  84 312 162   0  70  84 312
162
> 0  70  84 312
>
>          232  70   0  14 242 232  70   0  14 242 232  70   0  14 242
232
> 70   0  14 242
>
>          246  84  14   0 228 246  84  14   0 228 246  84  14   0 228
246
> 84  14   0 228
>
>          474 312 242 228   0 474 312 242 228   0 474 312 242 228   0
474
> 312 242 228   0
>
>  
>
>   Thanks in advance for any help you can provide!  Warmest Regards,
>
>  
>
>     Keith Dunnigan
>
>     Statking Consulting
>
>     Cincinnati Ohio
>
>  
>
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R- sig- Geo mailing list
> R- sig- Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r- sig- geo
>

_______________________________________________
R- sig- Geo mailing list
R- sig- Geo at stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r- sig- geo




More information about the R-sig-Geo mailing list