[R-sig-Geo] Filtering out measurement error with krigeST

Edzer Pebesma edzer.pebesma at uni-muenster.de
Wed Sep 9 21:53:47 CEST 2015

On 09/08/2015 03:47 PM, Andrew Zammit Mangion wrote:
> I wish to check whether I'm missing something obvious or whether what I need is still not implemented. I like to assume that my observations (Z) are different from my underlying process (Y) and that Z = Y + e. I also want to predict Y and and not Z.
> I know there is a way to do this with krige(), namely by using a variogram defined with an Err() component instead of a Nug() component. That seems to work fine. For example if I do
>     library(gstat)
>     library(sp)
>     data(meuse)
>     coordinates(meuse) = ~x+y
>     data(meuse.grid)
>     gridded(meuse.grid) = ~x+y
>     m <- vgm(.59, "Sph", 874, .04)
>     x1 <- krige(log(zinc)~1, meuse, meuse.grid, model = m)
>     m <- vgm(.59, "Sph", 874, Err=.04)
>     x2 <- krige(log(zinc)~1, meuse, meuse.grid, model = m)
> then the predictive variance of x1 and x2 are different as expected. However I don't see where I can define an Err() component when constructing a spatio-temporal variogram with vgmST (the help doesn't seem to indicate that this is possible). If I do specify and "Err" parameter in one or both of the space-time variograms (which is undoubtedly wrong, as this should be a parameter to the vgmST function if anything), no error is thrown, but the prediction variances from krigeST are  unchanged, suggesting that predictions are still being carried out on Z and not on Y. Any ideas?

It is indeed not possible with krigeST, and I will also not implement
it. The difficulty of doing so, and the need to maintain messy code
resulting from it is not worth it -- it is pretty trivial to get the
result you want by doing the following:

1. Use a model with a nugget effect, equal to (or larger than) the error
2. for cases where the prediction error is zero (prediction location
coincides with observation location) shift the prediction location with
a very small amount such that they no longer coincide, prior to kriging,
3. after kriging, subtract the error component from the prediction variance.

> Thanks for your help,
> Andrew
> --
> Andrew Zammit Mangion
> School of Mathematics and Applied Statistics,
> University of Wollongong, Australia
> 	[[alternative HTML version deleted]]
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Edzer Pebesma
Institute for Geoinformatics (ifgi),  University of Münster,
Heisenbergstraße 2, 48149 Münster, Germany; +49 251 83 33081
Journal of Statistical Software:   http://www.jstatsoft.org/
Computers & Geosciences:   http://elsevier.com/locate/cageo/
Spatial Statistics Society http://www.spatialstatistics.info

More information about the R-sig-Geo mailing list