get_predictions: Extract fitted predictions from model

View source: R/get_predictions.R

get_predictionsR Documentation

Extract fitted predictions from model

Description

Extracts fitted (in-sample) predictions from models fitted with rf(), rf_repeat(), or rf_spatial().

Usage

get_predictions(model)

Arguments

model

Model object from rf(), rf_repeat(), or rf_spatial().

Details

This function returns fitted predictions for the training data used to build the model, not predictions for new data. For out-of-sample predictions on new data use stats::predict().

Value

Numeric vector of fitted predictions with length equal to the number of training observations. For rf_repeat() models, returns the median prediction across repetitions.

See Also

rf(), rf_repeat(), rf_spatial(), get_residuals()

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

Examples

data(plants_rf)

# Extract fitted predictions
predictions <- get_predictions(plants_rf)
head(predictions)

# Check length matches number of observations
length(predictions)

# Compare with observed values to assess fit
# (observed values would be in original data)


spatialRF documentation built on Dec. 20, 2025, 1:07 a.m.