Learn R Programming

spatialRF (version 1.1.5)

default_distance_thresholds: Default distance thresholds for spatial predictors

Description

Generates four evenly-spaced distance thresholds for spatial predictor generation, ranging from 0 to half the maximum distance in the matrix.

Usage

default_distance_thresholds(distance.matrix = NULL)

Value

Numeric vector of length 4 with distance thresholds (floored to integers).

Arguments

distance.matrix

Numeric distance matrix (typically square and symmetric). Default: NULL.

Details

The maximum threshold is set to half the maximum distance to avoid spatial predictors based on distances that are too large to capture meaningful spatial autocorrelation. The four thresholds are evenly spaced using seq() with length.out = 4.

See Also

Other preprocessing: auto_cor(), auto_vif(), case_weights(), double_center_distance_matrix(), is_binary(), make_spatial_fold(), make_spatial_folds(), the_feature_engineer(), weights_from_distance_matrix()

Examples

Run this code
data(plants_distance)

thresholds <- default_distance_thresholds(
  distance.matrix = plants_distance
)

thresholds
# Example output: c(0, 3333, 6666, 10000)
# Four evenly-spaced thresholds from 0 to max(plants_distance)/2

Run the code above in your browser using DataLab