Saltar al contenido


Shape-Constrained GAMs to build Species Distribution Models under the ecological niche theory

what is it?

GAM-NICHE is a new tool developed by AZTI (Valle et al. 2023) to build Species Distribution Models (SDMs) under the ecological niche theory (Citores et al. 2020). It provides a GitHub tutorial in R language with an application to marine fish.



Species distribution models (SDMs) are numerical tools that combine observations of species occurrence or abundance at known locations with information on the environmental and/or spatial characteristics of those locations. SDMs are widely used as a tool for understanding species spatial ecology and are also known as ecological niche models (ENM) or habitat suitability models. According to ecological niche theory, species response curves are unimodal with respect to environmental gradients (Hutchinson 1957). While a variety of statistical methods have been developed for species distribution modelling, a general problem with most of these habitat modelling approaches is that the estimated response curves can display biologically implausible shapes which do not respect ecological niche theory. This is because species response curves are fit statistically with any assumption or restriction, which sometimes do not respect the ecological niche theory. To better understand species response to environmental changes, SDMs should consider theoretical background such as the ecological niche theory and pursue the unimodality of the response curve with respect to environmental gradients.

The GAM-NICHE provides a tutorial on how to use shape-constrained generalized additive models (SC-GAMs) to build SDMs under the ecological niche theory framework, based on the development and application to marine fish by Citores et al. 2020. SC-GAMs impose monotonicity and concavity constraints in the linear predictor of the GAMs and avoid overfitting. SC-GAM is an effective alternative to fitting nonsymmetric parametric response curves, while retaining the unimodality constraint, required by ecological niche theory, for direct variables and limiting factors.



The GAM-NICHE is organised following the key steps in good modelling practice of SDMs (Elith and Leathwick 2009).


Presence data of a selected species are downloaded from GBIF/OBIS global public datasets and pseudo-absence data are created.


Environmental data are downloaded from public repositories and extracted at each of the presence/pseudo-absence data points.


Based on this dataset, an exploratory analysis is conducted to help deciding on the best modelling approach.


The model is fitted to the dataset and the quality of the fit and the realism of the fitted response function are evaluated.


After selecting a threshold to transform the continuous probability predictions into binary responses, the model is validated using a k-fold approach.


Finally, the predicted maps are generated for visualization.


  • Citores, L., L. Ibaibarriaga, D. J. Lee, M. J. Brewer, M. Santos, and G. Chust. 2020. “Modelling Species Presence–Absence in the Ecological Niche Theory Framework Using Shape-Constrained Generalized Additive Models.” Ecological Modelling 418: 108926.
  • Valle, M., Citores, L., Ibaibarriaga, L., & Chust, G. (2023). GAM-NICHE: Shape-Constrained GAMs to build Species Distribution Models under the ecological niche theory. AZTI.
  • Valle, M., Ramírez-Romero, E., Ibaibarriaga, L., Citores, L., Fernandes-Salvador, J. A., & Chust, G. (2024). Pan-Atlantic 3D distribution model incorporating water column for commercial fish. Ecological Modelling, 490, 110632.