Returns model predictions from a model fitted with rf(), rf_repeat(), or rf_spatial().

get_predictions(model)

Arguments

model

A model produced by rf(), rf_repeat(), or rf_spatial().

Value

A vector with predictions, or median of the predictions across repetitions if the model was fitted with rf_repeat().

Examples

if(interactive()){

#loading example data
data(plant_richness_df)

#fitting a random forest model
rf.model <- rf(
  data = plant_richness_df,
  dependent.variable.name = "richness_species_vascular",
  predictor.variable.names = colnames(plant_richness_df)[5:21],
  n.cores = 1,
  verbose = FALSE
)

#get vector of predictions
x <- get_predictions(rf.model)
x

}