0

I'm looking into kriging the Meuse dataset in R. I first performed ordinary kriging using copper, using krige.cv to calculate residuals. The distribution of prediction variances given by applying krige to my grid and krige.cv was approximately the same. However, when I try doing cokriging, the cross validation prediction variances are 60-75% smaller than before, whilst the prediction variances given by "predict" are roughly the same as with ordinary kriging. Is there a reason to explain this - you can see the cokriging code below.

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)
  • I'm struggling to see what two things you are comparing here. coppercd.ck are the predictions and variances for copper and cadmium over the meuse grid, but coppercd.cv has the cross-validation prediction, variance, and residual/Z for doing CV at the 155 locations. Do you expect those Z scores to relate to the prediction errors over the meuse grid? – Spacedman Jul 1 at 14:27
  • @Spacedman I'm looking at the prediction variances of copper produced by cross validation (CV) and then by applying cokriging to the grid. My theory was that the CV variances were lower because we have the value of the covariate (cadmium) at these locations but do not at the grid points. I've also noticed that if I compared copper predictions to ordinary kriging, while the sample points in cross validation tended to change, grid point predictions changed very little. Are any CV measures such as R-Squared or RMSE valid if the grid predictions haven't substantially changed from ordinary kriging? – Ben Collister Jul 1 at 15:47

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.