Learn R Programming

spatialRF (version 1.1.5)

get_spatial_predictors: Extract spatial predictors from spatial model

Description

Extracts the spatial predictors (Moran's Eigenvector Maps) used in a model fitted with rf_spatial().

Usage

get_spatial_predictors(model)

Value

Data frame containing the spatial predictor values for each observation, with predictors ordered by decreasing importance.

Arguments

model

Model object from rf_spatial() (must have class rf_spatial).

Details

Spatial predictors are Moran's Eigenvector Maps (MEMs) automatically generated and selected by rf_spatial() to capture spatial autocorrelation patterns in the data. This function extracts these predictors, which can be useful for understanding spatial structure or for making predictions on new spatial locations.

See Also

rf_spatial(), mem(), mem_multithreshold(), get_importance()

Other model_info: get_evaluation(), get_importance(), get_importance_local(), get_moran(), get_performance(), get_predictions(), get_residuals(), get_response_curves(), print.rf(), print_evaluation(), print_importance(), print_moran(), print_performance()

Examples

Run this code
data(plants_rf_spatial)

# Extract spatial predictors
spatial_preds <- get_spatial_predictors(plants_rf_spatial)
head(spatial_preds)

# Check dimensions
dim(spatial_preds)

# View predictor names (ordered by importance)
colnames(spatial_preds)

Run the code above in your browser using DataLab