validate: Validate a spatial model

View source: R/gmValidationStrategy.R

validateR Documentation

Validate a spatial model

Description

Validate a spatial model by predicting some values. Typically this will be a validation set, or else some subset of the conditing data.

Usage

validate(object, strategy, ...)

## S3 method for class 'LeaveOneOut'
validate(object, strategy, ...)

## S3 method for class 'NfoldCrossValidation'
validate(object, strategy, ...)

Arguments

object

spatial model object, typically of class gstat::gstat() or gmSpatialModel

strategy

which strategy to follow for the validation? see functions in 'see also' below.

...

generic parameters, ignored.

Value

A data frame of predictions (possibly with kriging variances and covariances, or equivalent uncertainty measures) for each element of the validation set

Methods (by class)

  • LeaveOneOut: Validate a spatial model

  • NfoldCrossValidation: Validate a spatial model

See Also

Other validation functions: LeaveOneOut, NfoldCrossValidation

Other accuracy functions: accuracy(), mean.accuracy(), plot.accuracy(), precision(), xvErrorMeasures.default(), xvErrorMeasures()

Examples

data("Windarling")
X = Windarling[,c("Easting","Northing")]
Z = compositions::acomp(Windarling[,c(9:12,16)])
gm = make.gmCompositionalGaussianSpatialModel(data=Z, coords=X)
vg = variogram(gm)
md = gstat::vgm(range=30, model="Sph", nugget=1, psill=1)
gs = fit_lmc(v=vg, g=gm, model=md) 
## Not run:  v1 = validate(gs, strategy=LeaveOneOut()) # quite slow 
vs2 = NfoldCrossValidation(nfolds=sample(1:10, nrow(X), replace=TRUE))
vs2
## Not run:  v2 = validate(gs, strategy=vs2) # quite slow 

gmGeostats documentation built on April 18, 2023, 5:08 p.m.