[R-sig-Geo] cross-validation

Paul Hiemstra p.hiemstra at geo.uu.nl
Wed Feb 6 22:54:22 CET 2008


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
>   


-- 
Drs. Paul Hiemstra
Department of Physical Geography
Faculty of Geosciences
University of Utrecht
Heidelberglaan 2
P.O. Box 80.115
3508 TC Utrecht
Phone:     +31302535773
Fax:    +31302531145
http://intamap.geo.uu.nl/~paul




More information about the R-sig-Geo mailing list