spatialRF1.1.5 package

Easy Spatial Modeling with Random Forest

prepare_importance_spatial

Prepares variable importance objects for spatial models

print

Custom print method for random forest models

print_evaluation

Prints cross-validation results

print_importance

Prints variable importance

print_moran

Prints results of a Moran's I test

print_performance

print_performance

rank_spatial_predictors

Ranks spatial predictors

rescale_vector

Rescales a numeric vector into a new range

residuals_diagnostics

Normality test of a numeric vector

rf

Random forest models with Moran's I test of the residuals

rf_compare

Compares models via spatial cross-validation

rf_evaluate

Evaluates random forest models with spatial cross-validation

rf_importance

Contribution of each predictor to model transferability

rf_repeat

Fits several random forest models on the same data

rf_spatial

Fits spatial random forest models

rf_tuning

Tuning of random forest hyperparameters via spatial cross-validation

root_mean_squared_error

RMSE and normalized RMSE

select_spatial_predictors_recursive

Finds optimal combinations of spatial predictors

select_spatial_predictors_sequential

Sequential introduction of spatial predictors into a model

standard_error

Standard error of the mean of a numeric vector

statistical_mode

Statistical mode of a vector

the_feature_engineer

Suggest variable interactions and composite features for random forest...

thinning

Applies thinning to pairs of coordinates

thinning_til_n

Applies thinning to pairs of coordinates until reaching a given n

vif

Variance Inflation Factor of a data frame

weights_from_distance_matrix

Transforms a distance matrix into a matrix of weights

auc

Area under the ROC curve

auto_cor

Multicollinearity reduction via Pearson correlation

auto_vif

Multicollinearity reduction via Variance Inflation Factor

beowulf_cluster

Defines a beowulf cluster

case_weights

Generates case weights for binary data

default_distance_thresholds

Default distance thresholds to generate spatial predictors

double_center_distance_matrix

Double centers a distance matrix

filter_spatial_predictors

Removes redundant spatial predictors

get_evaluation

Gets performance data frame from a cross-validated model

get_importance

Gets the global importance data frame from a model

get_importance_local

Gets the local importance data frame from a model

get_moran

Gets Moran's I test of model residuals

get_performance

Gets out-of-bag performance scores from a model

get_predictions

Gets model predictions

get_residuals

Gets model residuals

get_response_curves

Gets data to allow custom plotting of response curves

get_spatial_predictors

Gets the spatial predictors of a spatial model

is_binary

Checks if dependent variable is binary with values 1 and 0

make_spatial_fold

Makes one training and one testing spatial folds

make_spatial_folds

Makes training and testing spatial folds

mem

Moran's Eigenvector Maps of a distance matrix

mem_multithreshold

Moran's Eigenvector Maps for different distance thresholds

moran

Moran's I test

moran_multithreshold

Moran's I test on a numeric vector for different neighborhoods

normality

Normality test of a numeric vector

objects_size

Shows size of objects in the R environment

optimization_function

Optimization equation to select spatial predictors

pca

Principal Components Analysis

pca_multithreshold

PCA of a distance matrix over distance thresholds

plot_evaluation

Plots the results of a spatial cross-validation

plot_importance

Plots the variable importance of a model

plot_moran

Plots a Moran's I test of model residuals

plot_optimization

Optimization plot of a selection of spatial predictors

plot_residuals_diagnostics

Plot residuals diagnostics

plot_response_curves

Plots the response curves of a model.

plot_response_surface

Plots the response surfaces of a random forest model

plot_training_df

Scatterplots of a training data frame

plot_training_df_moran

Moran's I plots of a training data frame

plot_tuning

Plots a tuning object produced by rf_tuning()

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>).

  • Maintainer: Blas M. Benito
  • License: MIT + file LICENSE
  • Last published: 2025-12-19