5 Cross-Validation

The function xvalid performs cross-validation either using the leaving-one-out strategy or using a different set of locations provided by the user through the argument ‘location.xvalid’.

For the first strategy, data points are removed one by one and predicted by kriging using the remaining data. The commands below illustrates cross-validation for the models fitted by maximum likelihood and weighted least squares. In the following two calls the model parameters remains the same for the prediction at each location.


  > xv.ml <- xvalid(s100, model = ml)
  > xv.wls <- xvalid(s100, model = wls)

Graphical results are shown for the cross-validation results where the leaving-one-out strategy combined with the wls estimates for the parameters was used. Cross-validation residuals are obtained subtracting the observed data minus the predicted value. Standardised residuals are obtained dividing by the square root of the prediction variance (‘kriging variance’). By default the 10 plots shown in the Figure 10 are produced but the user can restrict the choice using the function arguments.


  > par(mfcol = c(5, 2), mar = c(3, 3, 1, 0.5), mgp = c(1.5,
  +     0.7, 0))
  > plot(xv.wls)

pict
Figure 10: Cross-validations results

A variation of this method is illustrated by the next two calls where the model parameters are re-estimated each time a point is removed from the data-set.
WARNING: RUNNING THE NEXT COMMAND CAN BE TIME-CONSUMING


  > xvR.ml <- xvalid(s100, model = ml, reest = TRUE)
  > xvR.wls <- xvalid(s100, model = wls, reest = TRUE,
  +     variog.obj = bin1)