spatialRF: Easy Spatial Modeling with Random Forest

Automatic generation and selection of spatial predictors for Random Forest models fitted to spatially structured data. Spatial predictors are constructed from a distance matrix among training samples using Moran's Eigenvector Maps (MEMs; Dray, Legendre, and Peres-Neto 2006 <DOI:10.1016/j.ecolmodel.2006.02.015>) or the RFsp approach (Hengl et al. <DOI:10.7717/peerj.5518>). These predictors are used alongside user-supplied explanatory variables in Random Forest models. The package provides functions for model fitting, multicollinearity reduction, interaction identification, hyperparameter tuning, evaluation via spatial cross-validation, and result visualization using partial dependence and interaction plots. Model fitting relies on the 'ranger' package (Wright and Ziegler 2017 <DOI:10.18637/jss.v077.i01>).

Getting started

Package details

AuthorBlas M. Benito [aut, cre, cph] (ORCID: <https://orcid.org/0000-0001-5105-7232>)
MaintainerBlas M. Benito <blasbenito@gmail.com>
LicenseMIT + file LICENSE
Version1.1.5
URL https://blasbenito.github.io/spatialRF/
Package repositoryView on CRAN
Installation Install the latest version of this package by entering the following in R:
install.packages("spatialRF")

Try the spatialRF package in your browser

Any scripts or data that you put into this service are public.

spatialRF documentation built on Dec. 20, 2025, 1:07 a.m.