4

autoKrige in R works fine and plotting the output gives a good overview of the interpolation with standard error. Following these steps:

library(sp)
library(automap)

loadMeuse()
demo(meuse)
# Ordinary kriging
kr = autoKrige(zinc~1, meuse, meuse.grid)
plot(kr)

#Extracting parts from the autoKrige object
prediction_spdf = kr$krige_output
sample_variogram = kr$exp_var
variogram_model = kr$var_model
plot(prediction_spdf)

In the last line I only plot the extracted prediction. I also want a separate standard error plot, but I can't extract that from the autoKrige output. Anyone who knows how?

3

The krige_output component of kr is a SpatialPixelsDataFrame. Plotting it only shows the first component. The components are:

> names(kr$krige_output)
[1] "var1.pred"  "var1.var"   "var1.stdev"

So to get the kriging variance you do:

> plot(kr$krige_output[,"var1.var"])

You can also use spplot, eg for the std deviation:

> spplot(kr$krige_output,"var1.stdev")

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.