Package: flexsdm 1.4.2

Santiago J.E. Velazco

flexsdm: Flexible Species Distribution Modeling Workflow

Provides a flexible and comprehensive workflow for species distribution modeling, from data preparation (occurrence filtering, calibration areas, pseudo-absence and background sampling, data partitioning, and collinearity reduction) to model fitting, tuning, evaluation, prediction, ensemble modeling, and post-processing. The package is described in Velazco et al. (2022) <doi:10.1111/2041-210X.13874>. Implemented methods include the Shape metric to measure model extrapolation of Velazco et al. (2023) <doi:10.1111/ecog.06992>, ensembles of small models of Breiner et al. (2015) <doi:10.1111/2041-210X.12403> and Breiner et al. (2018) <doi:10.1111/2041-210X.12957>, Gaussian process models of Golding and Purse (2016) <doi:10.1111/2041-210X.12523>, and occurrence-based constraints for post-processing predictions of Mendes et al. (2020) <doi:10.1016/j.ecolmodel.2020.109180>.

Authors:Santiago J.E. Velazco [aut, cre], Brooke Rose [aut], André F.A. Andrade [aut], Ignacio Minoli [aut], Janet Franklin [aut]

flexsdm_1.4.2.tar.gz
flexsdm_1.4.2.zip(r-4.7-x86_64)flexsdm_1.4.2.zip(r-4.7-arm64)flexsdm_1.4.2.zip(r-4.6-x86_64)flexsdm_1.4.2.zip(r-4.6-arm64)
flexsdm_1.4.2.tar.gz(r-4.7-arm64)flexsdm_1.4.2.tar.gz(r-4.7-x86_64)flexsdm_1.4.2.tar.gz(r-4.6-arm64)flexsdm_1.4.2.tar.gz(r-4.6-x86_64)
flexsdm_1.4.2.tgz(r-4.6-emscripten)
manual.pdf |manual.html✨
DESCRIPTION |NEWS
card.svg |card.png
flexsdm/json (API)

# Install 'flexsdm' in R:
install.packages('flexsdm', repos = c('https://cran.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/sjevelazco/flexsdm/issues

Pkgdown/docs site:https://sjevelazco.github.io

Uses libs:
  • c++– GNU Standard C++ Library v3
Datasets:
  • abies - A data set containing localities and environmental condition of an Abies (fir tree) species in California, USA
  • backg - A data set containing environmental conditions of background points
  • hespero - A data set containing localities of Hesperocyparis stephensonii species in California, USA
  • palms - A data set containing presences of palms species from Southern Brazil
  • spp - A data set containing presences and absences of three virtual species

On CRAN:

Conda:

cpp

4.62 score 104 scripts 57 exports 55 dependencies

Last updated from:76614d412b. Checks:10 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-arm64OK247
linux-devel-x86_64OK230
source / vignettesOK297
linux-release-arm64OK259
linux-release-x86_64OK289
windows-devel-arm64OK383
windows-devel-x86_64OK263
windows-release-arm64OK390
windows-release-x86_64OK188
wasm-releaseOK146

Exports:calib_areacorrect_colinvardata_bpdpdata_pdpenv_outliersesm_gamesm_gauesm_gbmesm_glmesm_maxesm_netesm_svmextra_evalextra_truncatefit_domfit_ensemblefit_gamfit_gaufit_gbmfit_glmfit_maxfit_netfit_raffit_svmget_absencesget_blockhomogenize_nainterpmap_env_distmsdm_posteriorimsdm_prioriocc_reprojoccfilt_envoccfilt_geooccfilt_selectp_bpdpp_extrap_pdppart_randompart_sbandpart_sblockpart_senvplot_ressample_backgroundsample_pseudoabssdm_directorysdm_evalsdm_extractsdm_predictsdm_summarizesdm_uncertaintysdm_varimptune_gbmtune_maxtune_nettune_raftune_svm

Dependencies:clicodetoolscpp11doParalleldotCall64dplyrevaluatefarverfieldsforeachgbmgenericsggplot2glmnetgluegtablehighrisobanditeratorskernlabknitrlabelinglatticelifecyclemagrittrmapsMatrixmaxnetmgcvnlmennetpatchworkpillarpkgconfigR6randomForestRColorBrewerRcppRcppEigenrlangS7scalesshapespamspThinsurvivalterratibbletidyselectutf8vctrsviridisLitewithrxfunyaml

flexsdm: Modeling a rare species
Intro | Data | Delimit calibration area | Create pseudo-absence data | Partition data for evaluating models | Extracting environmental values | Modeling | Standard models | Ensemble of small models | Comparing our models | Conclusions | References

Last update: 2026-10-24
Started: 2026-10-24

flexsdm: Overview of Modeling functions
Introduction | Installation | Project directory setup | Data, species occurrence and background data | 1. Fit and validate models | 2. Model Ensemble | 3. Fit and validate models with Ensemble of Small Model approach

Last update: 2026-10-24
Started: 2026-10-24

flexsdm: Overview of Post-modeling functions
Introduction | Installation | Project directory setup | Species occurrence, presence/absense and environmental data | 1. Fit and ensemble the models above | 2. Merge model performance tables | 3. Raster interpolation between two time periods | 4. Measure model extrapolation | 5. Correction of suitability based on extrapolation | 6. Create spatial predictor variables to reduce overprediction of species distribution models | 7. Methods to correct overprediction of species distribution models based on occurrences and suitability patterns

Last update: 2026-10-24
Started: 2026-10-24

flexsdm: Overview of Pre-modeling functions
Introduction | Installation | Project Directory Setup | Data, species occurrence and background data | Geographic region | Calibration area | 1. Buffer | 2. Minimum convex polygon | 3. Buffered minimum convex polygon | 4. Mask | Reducing collinearity among the predictors | Environmental predictors | 1. Pearson correlation | 1. Stephenson, N. 1998. Actual evapotranspiration and deficit: biologically meaningful correlates of vegetation distribution across spatial scales. Journal of biogeography 25:855–870. | 2. Woodward, F. I., M. R. Lomas, and C. K. Kelly. 2004. Global climate and the distribution of plant biomes. Philosophical transactions of the Royal Society of London. Series B, Biological sciences 359:1465–1476. | 2. Variance inflation factor | 3. Principal component analysis | 4. Factorial analysis | 5. Comments | Data filtering | Environmental filtering | Geographical filtering | Data partitioning | 1. Conventional data partitioning methods (part_random) | 2. Spatial band cross-validation (part_sband) | 3. Spatial block cross-validation (part_sblock) | 4. Environmental and spatial cross-validation (part_senv) | Background and pseudo-absence sampling | 1. Sample background | 2. Sample pseudo-absences | Extracting environmental values

Last update: 2026-10-24
Started: 2026-10-24

flexsdm: Red Fir example
title: 'flexsdm: Red Fir example'output: rmarkdown::html_vignettevignette: >%\VignetteIndexEntry | Example of full modeling process | Study species & overview of methods | Delimit of a calibration area | Occurrence filtering | Block partition with 4 folds | Pseudo-absence/background points (using partition previously created as a mask) | Fit models with tune_max, fit_gau, and fit_glm | Fit an ensemble model | Project the ensemble model | Constrain the model with msdm_posterior

Last update: 2026-10-24
Started: 2026-10-24

flexsdm: Tools to explore extrapolation in SDMs
Introduction | Data | Delimit calibration area | Create pseudo-absence data | Partition data for evaluating models | Extracting environmental values | Modeling | Comparing our models | Partial dependence plots to explore the impact of predictor conditions on suitability | Extrapolation evaluation | Truncating SDMs predictions based on extrapolation thresholds

Last update: 2026-10-24
Started: 2026-10-24

Species distribution modeling for several species and climate change scenarios
Introduction | Required packages | 1. Directory Setup | 2. Load Species Occurrence Data | 3. Environmental Data | 4. Define species training area | 5. Evaluate Species-Specific Multicollinearity | 6. Correct Multicollinearity | 7. Process environmental PCA for all species | 8. Occurrence Sample Bias Correction | 9. Sample Pseudo-Absences & Background points | 10. Data Partitioning | 11. Configuration of output directories and data used during model fitting | 12. Main loop by species for model fitting, evaluation and prediction | 13. Visualization of spatial predictions | 14. Visualize future projections | 15. Conclusion | 1. Initial Setup | 2. Data Preparation | 4. Deine model calibration area | 5. Evaluate species-specific predictor collinearity | 6. Correct predictor collinearity | 7. Environmental PCA for all species | 8. Occurrence sample bias correciton | 9. Pseudo-absence Generation | 11. Configure and organize output directory | 12. Modeling | 13. Visualize spatial predictions | 16. Other examples of entire modeling workflows with flexsdm.

Last update: 2026-10-24
Started: 2026-10-24

Where flexsdm was cited?
Cite our package as | 2026 (n = 42) | 2025 (n = 46) | 2024 (n = 49) | 2023 (n = 13) | 2022 (n = 2)

Last update: 2026-10-24
Started: 2026-10-24

Readme and manuals

Help Manual

Help pageTopics
A data set containing localities and environmental condition of an Abies (fir tree) species in California, USAabies
A data set containing environmental conditions of background pointsbackg
Delimit calibration area for constructing species distribution modelscalib_area
Collinearity reduction of predictor variablescorrect_colinvar
Calculate data to construct partial dependence surface plotsdata_bpdp
Calculate data to construct partial dependence plotsdata_pdp
Integration of outliers detection methods in environmental spaceenv_outliers
Fit and validate Generalized Additive Models based on Ensembles of Small Models approachesm_gam
Fit and validate Gaussian Process models based on Ensembles of Small Models approachesm_gau
Fit and validate Generalized Boosted Regression models based on Ensembles of Small Models approachesm_gbm
Fit and validate Generalized Linear Models based on Ensembles of Small Models approachesm_glm
Fit and validate Maximum Entropy Models based on Ensemble of Small of Model approachesm_max
Fit and validate Neural Networks based on Ensembles of Small of Models approachesm_net
Fit and validate Support Vector Machine models based on Ensembles of Small of Models approachesm_svm
Measure model extrapolation based on Shape extrapolation metricextra_eval
Truncate suitability predictions based on an extrapolation valueextra_truncate
Fit and validate Domain modelsfit_dom
Ensemble model fitting and validationfit_ensemble
Fit and validate Generalized Additive Modelsfit_gam
Fit and validate Gaussian Process modelsfit_gau
Fit and validate Generalized Boosted Regression modelsfit_gbm
Fit and validate Generalized Linear Modelsfit_glm
Fit and validate Maximum Entropy modelsfit_max
Fit and validate Neural Networks modelsfit_net
Fit and validate Random Forests modelsfit_raf
Fit and validate Support Vector Machine modelsfit_svm
Build a presence-absence database from multi-species occurrence dataget_absences
Transform a spatial partition layer to the same spatial properties as environmental variablesget_block
A data set containing localities of Hesperocyparis stephensonii species in California, USAhespero
Homogenize cells with NAs across all layershomogenize_na
Raster interpolation between two time periodsinterp
Calculate environmental distance between presences and projection datamap_env_dist
Methods to correct overprediction of species distribution models based on occurrences and suitability patterns.msdm_posteriori
Create spatial predictor variables to reduce overprediction of species distribution modelsmsdm_priori
Reproject location coordinates to a new coordinate reference systemocc_reproj
Perform environmental filtering on species occurrencesoccfilt_env
Perform geographical filtering on species occurrencesoccfilt_geo
Select filtered occurrencesoccfilt_select
Bivariate partial dependence plotp_bpdp
Graphical exploration of extrapolation or suitability pattern in the environmental and geographical spacep_extra
Partial Dependent Plotp_pdp
A data set containing presences of palms species from Southern Brazilpalms
Conventional data partitioning methodspart_random
Spatial band cross-validationpart_sband
Spatial block cross-validationpart_sblock
Environmental and spatial cross-validationpart_senv
Plot different resolutions to be used in part_sblockplot_res
Sample background pointssample_background
Sample pseudo-absencessample_pseudoabs
Create directories for saving the outputs of the flexsdmsdm_directory
Calculate different model performance metricssdm_eval
Extract environmental data values from a spatial raster based on x and y coordinatessdm_extract
Spatial predictions from individual and ensemble modelssdm_predict
Merge model performance tablessdm_summarize
Calculate species distribution model uncertaintysdm_uncertainty
Calculate permutation-based variable importance scores for SDMssdm_varimp
A data set containing presences and absences of three virtual speciesspp
Fit and validate Generalized Boosted Regression models with exploration of hyper-parameters that optimize performancetune_gbm
Fit and validate Maximum Entropy models with exploration of hyper-parameters that optimize performancetune_max
Fit and validate Neural Networks models with exploration of hyper-parameterstune_net
Fit and validate Random Forest models with exploration of hyper-parameters that optimize performancetune_raf
Fit and validate Support Vector Machine models with exploration of hyper-parameters that optimize performancetune_svm