Prints the results of a Moran's I test on the residuals of a model.
print_moran(
model,
caption = NULL,
verbose = TRUE
)
A model fitted with rf()
, rf_repeat()
, or rf_spatial()
.
Character, caption of the output table, Default: NULL
Logical, if TRUE
, the resulting table is printed into the console, Default: TRUE
Prints a table in the console using the huxtable package.
if(interactive()){
#loading example data
data(plant_richness_df)
data(distance.matrix)
#fitting 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],
distance.matrix = distance_matrix,
distance.thresholds = c(0, 1000, 2000),
n.cores = 1,
verbose = FALSE
)
#printing Moran's I of model's residuals
print_moran(rf.model)
}