[R-sig-Geo] 'LDLfactor' error in 'krige' function

Edzer Pebesma edzer.pebesma at uni-muenster.de
Tue Nov 17 13:16:18 CET 2009


I just want to point out that "krige" has no problem with constant
observations, as long as it is provided with a valid (i.e. semi negative
definite, or something like that) variogram model. The problem is to
automatically fit such a function from data that are constant, as they
have zero (co)variance; this is done by automap/autofitvariogram and the
like. Replacing an invalid (zero) variogram model with e.g. a
(numerically) small nugget effect would already help, but raise two
issues: (i) what is numerically small, and (ii) is that a realistic
model for your data? Are near-zero prediction variances realistic for
any process with constant measured values?
--
Edzer

Mauricio Zambrano wrote:
> Dear Paul and Edzer,
>
>
> 2009/11/17 Tomislav Hengl <hengl at spatial-analyst.net>:
>   
>> Hi Paul, Edzer,
>>
>> I understand why the singular matrix problem happens and I know that there is not really a
>> mathematical solution around it:
>>
>>     
>>> x <- matrix(runif(100), nrow=10)
>>> x.i <- solve(x)
>>> str(x.i)
>>>       
>>  num [1:10, 1:10] 0.8191 -1.0293 0.0826 1.068 -0.2106 ...
>> # add a 'singular' column
>>     
>>> x[,1:10] <- rep(1, 10)
>>> x.i <- solve(x)
>>>       
>> Error in solve.default(x) :
>>  Lapack routine dgesv: system is exactly singular
>>
>>
>> However, I would very much support if you would integrate an "if" loop to check if it will happen,
>> and then mask the prediction location using "NA".
>>     
>
>   
>> I mean, at the moment every time we want to run predictions, even if only at a single prediction
>> location the model fails, we are not able to generate any output (this is sometimes really
>> frustrating).
>>     
>
> I agree with Tom that it may be really frustrating not to get any
> output, even most when this situation happens within a loop that
> involves many time steps. I know that the user can easily get rid of
> this manually for a single prediction, but it should be better if the
> check could be integrated into the 'krige' or the 'autoKrige'
> function, but of course this is your decision.
>
>
>   
>> Hence, I would support that you allow us to run predictions for all locations first, and then let
>> the users judge if one should increase the search radius, remove some too-uniform predictors etc
>> etc.
>>     
>
> In case you could allow us to run the predictions first, it shouldn't
> be better to mask the prediction location with the constant value that
> caused the error instead of NA ?. Or to have a flag that allow the
> user to choose if to get an NA or the constant value ?
>
>
> Kinds,
>
> Mauricio
>
>   

-- 
Edzer Pebesma
Institute for Geoinformatics (ifgi), University of Münster
Weseler Straße 253, 48151 Münster, Germany. Phone: +49 251
8333081, Fax: +49 251 8339763 http://ifgi.uni-muenster.de/
http://www.springer.com/978-0-387-78170-9 e.pebesma at wwu.de



More information about the R-sig-Geo mailing list