spCrossvalid {spANOVA}R Documentation

Cross-validation by kriging

Description

Compute cross-validation for an object of class spVariofit.

Usage

spCrossvalid(x, ...)

Arguments

x

an object of class spVariofit.

...

further arguments to be passed to xvalid function.

Details

This function is a wrapper to xvalid function of the package geoR. Please check its documentation for additional information.

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

the differences data - predicted value.

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.

Examples

data("crd_simulated")
dados <- crd_simulated

#Geodata object
geodados <- as.geodata(dados, coords.col = 1:2, data.col = 3,
                            covar.col = 4)
h_max <- summary(geodados)[[3]][[2]]
dist <- 0.6*h_max

# Computing the variogram
variograma <- spVariog(geodata = geodados,
                      trend = "cte", max.dist = dist, design = "crd",
                      scale = FALSE)

plot(variograma, ylab = "Semivariance", xlab = "Distance")

# Spherical Model
ols1 <- spVariofit(variograma, cov.model = "spherical", weights = "equal",
                  max.dist = dist)

#Using crossvalidation to assess the error
ols1.cv <- spCrossvalid(ols1)


[Package spANOVA version 0.99.4 Index]