[R-sig-Geo] Variance of prediction in Kriging

Robert J. Hijmans r.hijmans at gmail.com
Wed Jul 3 21:51:53 CEST 2013


Maurizio,

you can use the "index" argument for that. Following your example in
?interpolate:

library(raster)
library(gstat)

r <- raster(system.file("external/test.grd", package="raster"))
data(meuse)
coordinates(meuse) <- ~x+y
projection(meuse) <- projection(r)

gCoK <- gstat(NULL, 'log.zinc', log(zinc)~1, meuse)
gCoK <- gstat(gCoK, 'elev', elev~1, meuse)
gCoK <- gstat(gCoK, 'cadmium', cadmium~1, meuse)
gCoK <- gstat(gCoK, 'copper', copper~1, meuse)
coV <- variogram(gCoK)
plot(coV, type='b', main='Co-variogram')
coV.fit <- fit.lmc(coV, gCoK, vgm(model='Sph', range=1000))
coV.fit
plot(coV, coV.fit, main='Fitted Co-variogram')
coK <- interpolate(r, coV.fit)
coKvar <- interpolate(r, coV.fit, index=2)


unfortunately x <- interpolate(r, coV.fit, index=1:2)  does not (yet) work.

Robert

On Wed, Jun 26, 2013 at 11:34 PM, Maurizio Marchi
<mauriziomarchi85 at gmail.com> wrote:
> Hallo everybody.
> Using the krige() function of the gstat package for ordinary and universal
> kriging and the predict() function of the same package for ordinary and
> universal cokriging I obtain the prediction of the variable and also the
> variance of prediction. Is possible to do the same with the raster package,
> maybe with an option of the interpolate() function?
> Thanks,
>
> Maurizio Marchi
> Ph.D student
>
>
> --
> Maurizio Marchi
> ID skype: maurizioxyz
> *Ubuntu 12.04 (Precise Pangolin)*
> *"Il bello dell'open-source è che le domande possono essere poste alla
> fonte"*
> *utente linux 552.742*
>
>         [[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
>



More information about the R-sig-Geo mailing list