[R-sig-Geo] cross-validation

Edzer Pebesma edzer.pebesma at uni-muenster.de
Thu Feb 7 11:09:55 CET 2008


That was not the problem, the problem was that you used meuse.g instead 
of meuse.fit to pass on to gstat.cv. For meuse.g, you have perfect 
correlation between Cu and Zn, so that collocated observations (meaning 
a Zn and a Cu observation at each obs location) act as a duplicate in 
univarite kriging.

Try:

out = gstat.cv(object=meuse.fit, nmax=40, verbose=F, nfold=5)
--
Edzer

Paul Hiemstra wrote:
> Hi,
>
> You should check if you have duplicate observations, duplicate 
> observations lead to a singular matrix. Use the function zerodist() to 
> check where the observations are and remove.duplicates() to remove them.
>
> cheers,
> Paul
>
> Marta Rufino schreef:
>> Hello,
>>
>> yes, I know it is suppose to do it, but I could not find how, because 
>> it gives me an error... for example:
>>
>> require(gstat); require(lattice)
>> data(meuse)
>> coordinates(meuse) = ~x + y
>> data(meuse.grid)
>> gridded(meuse.grid) = ~x + y
>>
>> meuse.g <- gstat(id = "zn", formula = log(zinc) ~ 1, data = meuse)
>> meuse.g <- gstat(meuse.g, "cu", log(copper) ~ 1, meuse)
>>
>> meuse.g <- gstat(meuse.g, model = vgm(1, "Sph", 900, 1), fill.all = T)
>> x <- variogram(meuse.g, cutoff = 1000)
>> meuse.fit = fit.lmc(x, meuse.g)
>> plot(x, model = meuse.fit)
>> z <- predict(meuse.fit, newdata = meuse.grid)
>> spplot(z) #map
>> gstat.cv(meuse.g) #does not work...
>> gstat.cv(meuse.g, remove.all=T) #either
>> gstat.cv(meuse.g, all.residuals=T) #either
>> gstat.cv(object=meuse.g, formula = log(zinc) ~ 1, data = meuse, model 
>> = vgm(1, "Sph", 900, 1), nmax=40, verbose=F) #either :-(
>>
>> #                             # Intrinsic Correlation found. Good.
>> # [using ordinary cokriging]
>>
>> # "chfactor.c", line 130: singular matrix in function LDLfactor()
>> # Error in predict.gstat(object, newdata = data[sel, ], ...) :
>> #         LDLfactor
>>
>> Maybe an example on the help file would be nice (eheheh).. I
>> What am I missing?
>>
>>
>> Thank you very much in advance,
>> Marta
>>
>> _______________________________________________
>> 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