xvalid {geoR}R Documentation

Cross-validation using kriging

Description

This is a function to perform model validation. Options include leaving-one-out cross-validation where. each data location is removed from the data set and the variable at this location is predicted using the remaining locations, for as given model. This can be done for all or some of the locations. Alternativelly, other validation locations which are not the same as the original data locations can be used.

Usage

xvalid(geodata, coords = geodata$coords, data = geodata$data,
       model, reestimate = FALSE, variog.obj = NULL,
       output.reestimate = FALSE, locations.xvalid = "all",
       data.xvalid = NULL, messages.screen = TRUE, ...)

Details

The cross-validation uses the function krige.conv to predict at each location.

For models fitted by variofit the parameters kappa, psiA, psiR and lambda are always regarded as fixed.

See documentation of the function likfit for more details on the model and its parameters.

Value

An object of the class "xvalid" which is a list with the following components:

data the original data.
predicted the values predicted by cross-validation.
krige.var the cross-validation prediction variance.
error difference data - predicted.
std.error the errors divided by the square root of the prediction variances.
prob the cumulative probability at original value under a normal distribution with parameters given by the cross-validation results.


If reestimate = TRUE and output = TRUE additional columns are added to the data-frame. Each column will contain the values of the re-estimated parameters.

Author(s)

Paulo J. Ribeiro Jr. Paulo.Ribeiro@est.ufpr.br,
Peter J. Diggle p.diggle@lancaster.ac.uk.

References

Further information about geoR can be found at:
http://www.maths.lancs.ac.uk/~ribeiro/geoR.html.

See Also

plot.xvalid for plotting of the results, likfit, variofit for parameter estimation and krige.conv for the kriging method used for predictions.

Examples

if(is.R()) data(s100)
#
# Maximum likelihood estimation
#
s100.ml <- likfit(s100, ini = c(.5, .5), fix.nug = TRUE)
#
# Weighted least squares estimation
#
s100.var <- variog(s100, max.dist = 1)
s100.wls <- variofit(s100.var, ini = c(.5, .5), fix.nug = TRUE)
#
# Now, performing cross-validation
#
s100.xv.ml <- xvalid(s100, model = s100.ml)
s100.xv.wls <- xvalid(s100, model = s100.wls)