compare.cv {automap}R Documentation

Comparing the results of cross-validations

Description

Allows comparison of the results from several outcomes of autoKrige.cv in both statistics and spatial plots (bubble plots).

Usage

compare.cv(..., 
	   col.names, 
	   bubbleplots = FALSE, 
	   zcol = "residual", 
	   layout, 
	   key.entries, 
	   reference = 1, 
	   plot.diff = FALSE,
       digits = 4,
       ggplot = FALSE,
       addPoly = NULL) 

Arguments

...

autoKrige.cv objects that are compared to each other. Also accepts the output form krige.cv, these objects are transformed to autoKrige.cv objects.

col.names

Names for the different objects in .... This defaults to the names of the objects in ....

bubbleplots

logical, if TRUE then bubble plots of the objects in ... are drawn using the same value for the color breaks.

zcol

Which column in the objects in ... is going to be drawn in the bubbleplots. Options are: var1.pred, var1.var, observed, residual and zscore.

layout

layout of the bubbleplot, e.g. c(2,2). The argument gives the number of rows and columns in which the set of bubbleplots is to be drawn. Useful defaults are selected.

key.entries

A list of numbers telling what the key entries in the bubbleplots are. See bubble for more details.

reference

An integer telling which of the objects should be taken as a reference if plot.diff equals TRUE. reference equal to 1 means that the first object is the reference, reference equal to 2 means that the second object is the reference etc.

plot.diff

logical, if plot.diff is TRUE the number specified in reference defines the CV object that is taken as a reference What is shown in the plot is reference data squared minus the other data squared. So the color red means that the CV is doing worse than the reference, vice-versa for green. This is very useful to see where the differences between the results are spatially and if there is a pattern.

digits

The number of significant digits in the resulting data.frame.

ggplot

logical, determines if spplot or ggplot2 is used to make the spatial plot of the cross-validation residuals. Note that the plot.diff and reference arguments are obsolete when ggplot equals TRUE.

addPoly

if this object contains a SpatialPolygons* object, it is added to the plot as layout. Note that this only works when ggplot equals TRUE.

Value

A data.frame with for each cross-validation result a number of diagnostics:

mean_error

The mean of the cross-validation residual. Ideally small.

me_mean

mean error divided by the mean of the observed values, measure for how large the mean_error is in contrast to the mean of the dataset

MSE

Mean Squared error.

MSNE

Mean Squared Normalized Error, mean of the squared z-scores. Ideally small.

cor_obspred

Correlation between the observed and predicted values. Ideally 1.

cor_predres

Correlation between the predicted and the residual values. Ideally 0.

RMSE

Root Mean Squared Error of the residual. Ideally small.

RMSE_sd

RMSE divided by the standard deviation of the observed values. Provides a measure variation of the residuals vs the variation of the observed values.

URMSE

Unbiased Root Mean Squared Error of the residual. Ideally small.

iqr

Interquartile Range of the residuals. Ideally small.

Author(s)

Paul Hiemstra, paul@numbertheory.nl

See Also

krige.cv, bubble, autofitVariogram, autoKrige.cv,

Examples

# Load the data
library(sp)
data(meuse)
coordinates(meuse) = ~x+y
data(meuse.grid)
gridded(meuse.grid) = ~x+y

# Perform cross-validation
kr.cv = autoKrige.cv(log(zinc)~1, meuse, model = c("Exp"), nfold = 10)
kr_dist.cv = autoKrige.cv(log(zinc)~sqrt(dist), meuse, 
       model = c("Exp"), nfold = 10)
kr_dist_ffreq.cv = autoKrige.cv(log(zinc)~sqrt(dist)+ffreq, 
       meuse, model = c("Exp"), nfold = 10)

# Compare the results
compare.cv(kr.cv, kr_dist.cv, kr_dist_ffreq.cv)
compare.cv(kr.cv, kr_dist.cv, kr_dist_ffreq.cv, 
           bubbleplots = TRUE)
compare.cv(kr.cv, kr_dist.cv, kr_dist_ffreq.cv, 
           bubbleplots = TRUE, col.names = c("OK","UK1","UK2"))
compare.cv(kr.cv, kr_dist.cv, kr_dist_ffreq.cv, 
           bubbleplots = TRUE, col.names = c("OK","UK1","UK2"), 
           plot.diff = TRUE)

library(ggplot2)
compare.cv(kr.cv, kr_dist.cv, kr_dist_ffreq.cv, 
           bubbleplots = TRUE, col.names = c("OK","UK1","UK2"), 
           ggplot = TRUE)


[Package automap version 1.1-9 Index]