spatialRF1.1.4 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 spatial regression with Random Forest. Spatial predictors are surrogates of variables driving the spatial structure of a response variable. The package offers two methods to generate spatial predictors from a distance matrix among training cases: 1) Moran's Eigenvector Maps (MEMs; Dray, Legendre, and Peres-Neto 2006 <DOI:10.1016/j.ecolmodel.2006.02.015>): computed as the eigenvectors of a weighted matrix of distances; 2) RFsp (Hengl et al. <DOI:10.7717/peerj.5518>): columns of the distance matrix used as spatial predictors. Spatial predictors help minimize the spatial autocorrelation of the model residuals and facilitate an honest assessment of the importance scores of the non-spatial predictors. Additionally, functions to reduce multicollinearity, identify relevant variable interactions, tune random forest hyperparameters, assess model transferability via spatial cross-validation, and explore model results via partial dependence curves and interaction surfaces are included in the package. The modelling functions are built around the highly efficient 'ranger' package (Wright and Ziegler 2017 <DOI:10.18637/jss.v077.i01>).

  • Maintainer: Blas M. Benito
  • License: GPL-3
  • Last published: 2022-08-19