0

I apply Thiessen Polygons interpolation using the krige command in the gstat R package. Using krige without a variogram model sets automatically krige function to perform IDW, and when nmax parameter is set to 1, it is actually performing thiessen polygons interpolation. What I have is this:

dec_vor = krige(Dec ~ 1, st, grd, nmax = 1)

Then, when I want to perform cross validation, i do this:

dec_vor_cv = krige.cv(Dec ~ 1, st, nfold = 52, dec_vor)

and I get this error message:

"Error in load.variogram.model(object$model[[name]], c(i - 1, i - 1)) : 
  model should be of mode variogramModel (use function vgm)"
1
  • (perhaps better known as 'nearest neighbor' interpolation) Commented Jun 25, 2015 at 3:12

1 Answer 1

1

Although this may not be directly apparent from the documentation, the third (unnamed) argument to your krige.cv call is assumed to be a variogram model, and is absorbed by the argument model. Since dec_vor is the outcome of a call to krige, it is not, hence the error message.

It is not clear to me why you would pass dec_vor to krige.cv, as krige.cv loops over the observations in st only, nothing else.

2
  • thank you for your response! When I do not pass dec_vor to krige.cv, the command works fine. The reason why I wanted to to pass dec_vor to krige.cv is because I wanted krige.cv to evaluate dev_vor. Is this wrong? Commented Jun 25, 2015 at 8:08
  • 1
    then you should replace st with dev_vor; this will however depending on the density of grd nearly certainly give perfect results that have nothing to do with how good interpolation of st went. Commented Jun 25, 2015 at 12:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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