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

Keith Dunnigan keith at statkingconsulting.com
Wed Sep 12 16:58:50 CEST 2007


Edzer and List,

  Success!  Thanks so much to Edzer and all who took the time to write.


  I adjusted the x coordinates by a small amount such that no two x
coordinates were exactly the same, then recalculated the covariance
matrix and the negative eigenvalues disappeared.

  However several cases of duplicate eigenvalues appeared.  My strong
suspicion is that they were not truly identical, but only identical to
the resolution given by my software (8 places behind the decimal).  This
especially so as most values in the covariance matrix were zero to
several places behind the decimal.  Nonetheless to make myself feel
better, I tweaked the adjustment of the x coordinates a bit further and
that did the trick.  No duplicate or negative eigenvalues.


  So thanks again, your suggestions were right on and helped me out a
great deal!

  Warmest Regards,

  Keith Dunnigan
  Statking Consulting
  Cincinnati Ohio


-----Original Message-----
From: r-sig-geo-bounces at stat.math.ethz.ch
[mailto:r-sig-geo-bounces at stat.math.ethz.ch] On Behalf Of Keith Dunnigan
Sent: Wednesday, September 12, 2007 9:01 AM
To: Edzer J. Pebesma
Cc: r-sig-geo at stat.math.ethz.ch
Subject: Re: [R-sig-Geo] Positive Definite Covariance Matrix for
GridSampled Data

Edzer,

  Thanks again, sorry if I misread you.  Thanks also to James Holland
Jones and Christopher Paciorek who responded with helpful comments.  I
will read over all of these and give it another try.

  Keith

-----Original Message-----
From: Edzer J. Pebesma [mailto:e.pebesma at geo.uu.nl] 
Sent: Wednesday, September 12, 2007 3:01 AM
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, read my suggestion good; I didn't suggest replacing all zeroes in

the distance matrix! You either rearrange points and recompute 
distances, or modify off-diagonal zero-distance entries in the 
covariance matrix.

Sounds like you modified the zero entries on the diagonal as well.
--
Edzer

Keith Dunnigan wrote:
> 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