2
$\begingroup$

I'm investigating cokriging using various metals in the Meuse dataset but the variances output by R when I predict values at gridded points differ substantially from the variances produced by cross validation.

library(sp)
library(gstat)
data(meuse)
meuselog<-meuse
meuselog["logcadmium"]<-log1p(meuselog$cadmium)
meuselog["logcopper"]<-log(meuselog$copper)
coordinates(meuselog) = ~x+y
proj4string(meuselog)<-CRS("+init=epsg:28992")

data(meuse.grid)
coordinates(meuse.grid) = ~x+y
proj4string(meuse.grid)<-CRS("+init=epsg:28992")
gridded(meuse.grid)=TRUE

lcu.vgm <- variogram(logcopper~1, meuselog)
lcu.fit <- fit.variogram(lcu.vgm, model = vgm(0.5,"Sph",900,0.1))

#Cokriging - copper and cadmium
coppercd<- gstat(NULL, id = "logcopper", form = logcopper ~ 1, data=meuselog)
coppercd<- gstat(coppercd, id = "logcadmium", form = logcadmium ~ 1, data=meuselog)
coppercd.cross<-variogram(coppercd)
plot(coppercd.cross)
# Add variogram models to the gstat object and fit them using LMC
coppercd<-gstat(coppercd, id = "logcopper", model = lcu.fit, fill.all=T)
coppercd<-fit.lmc(coppercd.cross,coppercd)

coppercd.ck <- predict(coppercd, meuse.grid)
set.seed(1234)
coppercd.cv <- gstat.cv(coppercd,nfold=10)
summary(coppercd.ck)
summary(coppercd.cv)

Is there a reason why the range of variances is so different in the two summaries? I've also seen cases where the range of predicted values from applying the cokriging to the grid is much smaller than the range of predicted values given by the cross validation procedure - if this is the case, am I applying the cokriging technique incorrectly to the grid?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.