Package: CAST 1.1.0

CAST: 'caret' Applications for Spatial-Temporal Models

Supporting functionality to run 'caret' with spatial or spatial-temporal data. 'caret' is a frequently used package for model training and prediction using machine learning. CAST includes functions to improve spatial or spatial-temporal modelling tasks using 'caret'. It includes the newly suggested 'Nearest neighbor distance matching' cross-validation to estimate the performance of spatial prediction models and allows for spatial variable selection to selects suitable predictor variables in view to their contribution to the spatial model performance. CAST further includes functionality to estimate the (spatial) area of applicability of prediction models. Methods are described in Meyer et al. (2018) <doi:10.1016/j.envsoft.2017.12.001>; Meyer et al. (2019) <doi:10.1016/j.ecolmodel.2019.108815>; Meyer and Pebesma (2021) <doi:10.1111/2041-210X.13650>; Milà et al. (2022) <doi:10.1111/2041-210X.13851>; Meyer and Pebesma (2022) <doi:10.1038/s41467-022-29838-9>; Linnenbrink et al. (2024) <doi:10.5194/gmd-17-5897-2024>; Schumacher et al. (2025) <doi:10.5194/gmd-18-10185-2025>. The package is described in detail in Meyer et al. (2026) <doi:10.1007/978-3-031-99665-8_11>.

Authors:Hanna Meyer [cre, aut], Carles Milà [aut], Marvin Ludwig [aut], Jan Linnenbrink [aut], Fabian Schumacher [aut], Philipp Otto [ctb], Chris Reudenbach [ctb], Thomas Nauss [ctb], Edzer Pebesma [ctb], Jakub Nowosad [ctb], Darius Görgen [ctb]

CAST_1.1.0.tar.gz
CAST_1.1.0.zip(r-4.7)CAST_1.1.0.zip(r-4.6)CAST_1.1.0.zip(r-4.5)
CAST_1.1.0.tgz(r-4.6-any)CAST_1.1.0.tgz(r-4.5-any)
CAST_1.1.0.tar.gz(r-4.7-any)CAST_1.1.0.tar.gz(r-4.6-any)
CAST_1.1.0.tgz(r-4.6-emscripten)
manual.pdf |manual.html
DESCRIPTION |NEWS
card.svg |card.png
CAST/json (API)

# Install 'CAST' in R:
install.packages('CAST', repos = c('https://hannameyer.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/hannameyer/cast/issues

Pkgdown/docs site:https://hannameyer.github.io

Datasets:

On CRAN:

Conda:

autocorrelationcaretfeature-selectionmachine-learningoverfittingpredictive-modelingspatialspatio-temporalvariable-selection

12.45 score 133 stars 2 packages 413 scripts 4.0k downloads 219 mentions 17 exports 83 dependencies

Last updated from:139849ddbb. Checks:8 OK, 1 ERROR. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-x86_64OK324
source / vignettesOK405
linux-release-x86_64OK316
macos-release-arm64ERROR288
macos-oldrel-arm64OK262
windows-develOK377
windows-releaseOK266
windows-oldrelOK328
wasm-releaseOK155

Exports:aoabssclustered_sampleCreateSpacetimeFoldserrorProfilesffsgeodistglobal_validationknndmnndmnormalize_DIshow.aoashow.ffsshow.knndmshow.nndmshow.trainDItrainDI

Dependencies:caretclassclassIntcliclockcodetoolscpp11data.tableDBIdiagramdigestdplyre1071farverFNNforeachfuturefuture.applygenericsggplot2globalsgluegowergtablehardhatipredisobanditeratorsKernSmoothlabelinglatticelavalifecyclelistenvlubridatemagrittrMASSMatrixModelMetricsnlmennetnumDerivparallellypillarpkgconfigplyrpROCprodlimprogressrproxypurrrR6RColorBrewerRcpprecipesreshape2rlangrparts2S7scalessfshapesparsevctrsSQUAREMstringistringrsurvivalterratibbletidyrtidyselecttimechangetimeDatetwosamplestzdbunitsutf8vctrsviridisLitewithrwkzoo

Introduction to CAST
Introduction | Background | How to start | Example of a typical spatio-temporal prediction task | Description of the example dataset | Model training and prediction | Cross validation strategies for spatio-temporal data | The Standard approach: Random k-fold CV | Target-oriented validation | Removing variables that cause overfitting | Area of Applicability | Error profiles | Conclusions | Final notes | Further Reading | Tutorials | Scientific documentation of the methods | Spatial cross-validation | Spatial variable selection | Area of applicability | Applications and use cases

Last update: 2026-06-19
Started: 2022-01-27

Visualization of nearest neighbor distance distributions
Introduction | Sample data | Prediction area | Spatial random sample | Clustered sample | Distances in geographic space | Accounting for cross-validation folds | Random Cross-validation | Spatial Cross-validation | Why has spatial CV sometimes blamed for being too pessimistic ? | Nearest Neighbour Distance Matching CV | Distances in feature space | Further reading

Last update: 2026-06-19
Started: 2024-03-27

Area of applicability of spatial prediction models
Introduction | Getting started | Example 1: Using simulated data | Get data | Generate Predictors | Generate Response | Simulate sampling locations | Model training | Prepare data | Train the model | Variable importance | Predict and calculate error | AOA and LPD calculation | AOA for spatially clustered data? | Comparison prediction error with model error | Relationship between the DI/LPD and the performance measure | Example 2: A real-world example | Data and preprocessing | Model training and prediction | Prediction | AOA estimation | Final notes | Further reading

Last update: 2026-03-12
Started: 2024-03-23

Improve computation time of CAST methods
Forward feature selection | Area of applicability | trainDI | AOA for multiple rasters

Last update: 2026-03-12
Started: 2024-03-23

Nearest neighbor distance matching Cross-validation in CAST
Introduction | Cross-validation in geographical space | Evaluation of spatial predictive conditions | NNDM LOO CV for small datasets | kNNDM CV for medium and large datasets | Cross-validation in feature space | Further reading

Last update: 2026-03-12
Started: 2024-03-27