Package: spatialRF 1.1.4

spatialRF: Easy Spatial Modeling with Random Forest

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

Authors:Blas M. Benito [aut, cre, cph]

spatialRF_1.1.4.tar.gz
spatialRF_1.1.4.zip(r-4.5)spatialRF_1.1.4.zip(r-4.4)spatialRF_1.1.4.zip(r-4.3)
spatialRF_1.1.4.tgz(r-4.4-any)spatialRF_1.1.4.tgz(r-4.3-any)
spatialRF_1.1.4.tar.gz(r-4.5-noble)spatialRF_1.1.4.tar.gz(r-4.4-noble)
spatialRF_1.1.4.tgz(r-4.4-emscripten)spatialRF_1.1.4.tgz(r-4.3-emscripten)
spatialRF.pdf |spatialRF.html
spatialRF/json (API)
NEWS

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

Peer review:

Bug tracker:https://github.com/blasbenito/spatialrf/issues

Datasets:

On CRAN:

random-forestspatial-analysisspatial-regression

5.39 score 109 stars 45 scripts 256 downloads 67 exports 56 dependencies

Last updated 2 years agofrom:c004558423. Checks:OK: 7. Indexed: yes.

TargetResultDate
Doc / VignettesOKNov 06 2024
R-4.5-winOKNov 06 2024
R-4.5-linuxOKNov 06 2024
R-4.4-winOKNov 06 2024
R-4.4-macOKNov 06 2024
R-4.3-winOKNov 06 2024
R-4.3-macOKNov 06 2024

Exports:.select_by_max_vif.select_by_preference.vif_to_dfaucauto_corauto_vifbeowulf_clustercase_weightsdefault_distance_thresholdsdouble_center_distance_matrixfilter_spatial_predictorsget_evaluationget_importanceget_importance_localget_moranget_performanceget_predictionsget_residualsget_response_curvesget_spatial_predictorsis_binarymake_spatial_foldmake_spatial_foldsmemmem_multithresholdmoranmoran_multithresholdobjects_sizeoptimization_functionpcapca_multithresholdplot_evaluationplot_importanceplot_moranplot_optimizationplot_residuals_diagnosticsplot_response_curvesplot_response_surfaceplot_training_dfplot_training_df_moranplot_tuningprepare_importance_spatialprint_evaluationprint_importanceprint_moranprint_performancerank_spatial_predictorsrescale_vectorresiduals_diagnosticsresiduals_testrfrf_comparerf_evaluaterf_importancerf_repeatrf_spatialrf_tuningroot_mean_squared_errorselect_spatial_predictors_recursiveselect_spatial_predictors_sequentialstandard_errorstatistical_modethe_feature_engineerthinningthinning_til_nvifweights_from_distance_matrix

Dependencies:assertthatbase64enccachemclicodetoolscolorspacecommonmarkcpp11digestdoParalleldplyrfansifarverfastmapforeachgenericsggplot2gluegridExtragtablehtmltoolshuxtableisobanditeratorslabelinglatticelifecyclemagrittrMASSMatrixmemoisemgcvmunsellnlmepatchworkpillarpkgconfigpurrrR6rangerRColorBrewerRcppRcppEigenrlangscalesstringistringrtibbletidyrtidyselectutf8vctrsviridisviridisLitewithrxml2

Readme and manuals

Help Manual

Help pageTopics
Area under the ROC curveauc
Multicollinearity reduction via Pearson correlationauto_cor
Multicollinearity reduction via Variance Inflation Factorauto_vif
Defines a beowulf clusterbeowulf_cluster
Generates case weights for binary datacase_weights
Default distance thresholds to generate spatial predictorsdefault_distance_thresholds
Matrix of distances among ecoregion edges.distance_matrix
Double centers a distance matrixdouble_center_distance_matrix
Removes redundant spatial predictorsfilter_spatial_predictors
Gets performance data frame from a cross-validated modelget_evaluation
Gets the global importance data frame from a modelget_importance
Gets the local importance data frame from a modelget_importance_local
Gets Moran's I test of model residualsget_moran
Gets out-of-bag performance scores from a modelget_performance
Gets model predictionsget_predictions
Gets model residualsget_residuals
Gets data to allow custom plotting of response curvesget_response_curves
Gets the spatial predictors of a spatial modelget_spatial_predictors
Checks if dependent variable is binary with values 1 and 0is_binary
Makes one training and one testing spatial foldsmake_spatial_fold
Makes training and testing spatial foldsmake_spatial_folds
Moran's Eigenvector Maps of a distance matrixmem
Moran's Eigenvector Maps for different distance thresholdsmem_multithreshold
Moran's I testmoran
Moran's I test on a numeric vector for different neighborhoodsmoran_multithreshold
Shows size of objects in the R environmentobjects_size
Optimization equation to select spatial predictorsoptimization_function
Principal Components Analysispca
PCA of a distance matrix over distance thresholdspca_multithreshold
Plant richness and predictors of American ecoregionsplant_richness_df
Plots the results of a spatial cross-validationplot_evaluation
Plots the variable importance of a modelplot_importance
Plots a Moran's I test of model residualsplot_moran
Optimization plot of a selection of spatial predictorsplot_optimization
Plot residuals diagnosticsplot_residuals_diagnostics
Plots the response curves of a model.plot_response_curves
Plots the response surfaces of a random forest modelplot_response_surface
Scatterplots of a training data frameplot_training_df
Moran's I plots of a training data frameplot_training_df_moran
Plots a tuning object produced by 'rf_tuning()'plot_tuning
Prepares variable importance objects for spatial modelsprepare_importance_spatial
Prints cross-validation resultsprint_evaluation
Prints variable importanceprint_importance
Prints results of a Moran's I testprint_moran
print_performanceprint_performance
Custom print method for random forest modelsprint.rf
Ranks spatial predictorsrank_spatial_predictors
Rescales a numeric vector into a new rangerescale_vector
Normality test of a numeric vectorresiduals_diagnostics
Normality test of a numeric vectorresiduals_test
Random forest models with Moran's I test of the residualsrf
Compares models via spatial cross-validationrf_compare
Evaluates random forest models with spatial cross-validationrf_evaluate
Contribution of each predictor to model transferabilityrf_importance
Fits several random forest models on the same datarf_repeat
Fits spatial random forest modelsrf_spatial
Tuning of random forest hyperparameters via spatial cross-validationrf_tuning
RMSE and normalized RMSEroot_mean_squared_error
Finds optimal combinations of spatial predictorsselect_spatial_predictors_recursive
Sequential introduction of spatial predictors into a modelselect_spatial_predictors_sequential
Standard error of the mean of a numeric vectorstandard_error
Statistical mode of a vectorstatistical_mode
Suggest variable interactions and composite features for random forest modelsthe_feature_engineer
Applies thinning to pairs of coordinatesthinning
Applies thinning to pairs of coordinates until reaching a given nthinning_til_n
Variance Inflation Factor of a data framevif
Transforms a distance matrix into a matrix of weightsweights_from_distance_matrix