NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Generalized Functional Responses in Habitat Selection Fitted by Decision Trees and Random Forests

Shaykhah Aldossari, Dirk Husmeier, Jason MatthiopoulosProceedings of the International Conference on Statistics, Theory and Applications (ICSTA ...) 2021

Abstract

Species Distribution Models (SDMs) are important regression tools in the ecological sciences that can support distribution predictions using different environmental variables. Most of the research in the area of SDMs has assumed that regression coefficients in these models are fixed. However, species respond differently to different habitats depending on the habitat availability, meaning that regression coefficients change as functions of habitat availability, a phenomenon known as a functional response in habitat selection. The generalized functional response (GFR) is a varying-coefficient extension of the basic SDM framework, designed for more robust forecasts of species distributions in a rapidly changing world. The original GFR model formulated the varying regression coefficients using a polynomial function approach, which led to improvements of forecasting performance in many applications. The purpose of this paper is to improve the out-of-sample performance of the GFR model using a decision tree and Breiman's random forest algorithm. We compare the original GFR model with a decision tree and random forests using the GFR model by applying both models to a real population dataset on house sparrows. The results revealed a noticeable improvement in terms of out-of-sample $R^2$ in the decision tree and the random forest approaches over the original GFR model.

Introduction

Predicting animal distribution is a cornerstone of conservation biology. However, traditional Species Distribution Models (SDMs) often rely on the assumption that habitat preference is static. Ecologists have long recognized the "functional response" in habitat selection: an animal's preference for a specific resource changes based on its availability relative to other resources.

The Generalized Functional Response (GFR) framework addresses this by allowing regression coefficients to vary. Historically, these models utilized global polynomial functions to represent these shifts. While an improvement over fixed-coefficient models, polynomials are often too rigid to capture the complex, non-linear behavioral thresholds observed in nature. This research explores replacing these rigid functions with Machine Learning techniques—specifically Decision Trees and Random Forests—to better capture these ecological nuances.

Methods

The study proposes a hybrid modeling approach that integrates ecological theory with machine learning flexibility. Three primary models were evaluated:

  1. Baseline GFR: Utilizes a global polynomial (up to the 3rd order) to model how habitat selection coefficients vary with habitat availability.
  2. Classification and Regression Trees (CART): This approach partitions the data into "leaves" based on environmental thresholds. Within each leaf, a local GFR model is fitted. This allows the model to capture abrupt shifts in behavior at specific environmental tipping points.
  3. Random Forests (RF): An ensemble method consisting of 500 decision trees. By averaging predictions across the forest, the model reduces variance and mitigates overfitting, which is common in noisy ecological datasets.

Coefficients within tree nodes were estimated using Ordinary Least Squares (OLS). To ensure generalizability, 10-fold cross-validation was used for tree pruning.

Dataset and Validation

The models were tested using a real-world dataset of house sparrows (Passer domesticus) in Glasgow, UK. The dataset included 32 distinct colonies, with abundance data for 40 spatial cells per colony. Environmental variables included the percentage of grass, bush, and roof cover derived from satellite imagery, alongside colony size.

Performance was assessed using "leave-one-colony-out" cross-validation. This rigorous testing method ensures that the model's predictive power is evaluated on entirely unseen populations, mimicking real-world forecasting scenarios.

Results

The integration of machine learning significantly enhanced predictive accuracy. While the baseline GFR model provided a starting point, the tree-based methods demonstrated superior ability to handle the non-linearities of habitat selection.

Comparison of out-of-sample $R^2$ performance across GFR, CART, and Random Forest models.

As shown in the results, the Random Forest approach achieved a median out-of-sample $R^2$ of 0.765, a substantial increase from the 0.250 achieved by the original polynomial GFR. The mean $R^2$ also saw a significant jump from 0.160 to 0.420. These results suggest that the "wisdom of the crowd" inherent in Random Forests is particularly effective for capturing the regime shifts in animal behavior that smooth polynomials fail to detect.

Discussion and Conclusion

The findings highlight that context is paramount in ecological modeling. By moving from global to local modeling via decision trees, we can identify specific environmental thresholds where habitat selection strategies change abruptly.

While Random Forests offer high performance, they introduce a trade-off in interpretability compared to simple polynomials. Future research should focus on "opening the black box" to extract specific ecological rules from these ensembles. Additionally, while this study focused on urban house sparrows, the framework's success suggests broad applicability across different species and landscapes, offering a more robust tool for conservation planning in a changing world.

Summary updated

BibTeX
@inproceedings{aldossari2021generalized,
  author = {Shaykhah Aldossari and Dirk Husmeier and Jason Matthiopoulos},
  title = {{Generalized Functional Responses in Habitat Selection Fitted by Decision Trees and Random Forests}},
  booktitle = {Proceedings of the International Conference on Statistics, Theory and Applications (ICSTA ...)},
  year = {2021},
  doi = {10.11159/icsta21.125},
}
Figure