R code from: Integrating biotic factors into niche modeling
Creators: name: Jimenez, Laura
name: Marques, Roberta
name: Krüger, Rodrigo Ferreira
name: Jiménez-García, Daniel
Publisher: name: figshare
Year: 2025
Subjects: classificationCode: 310308
subject: Terrestrial ecology
classificationCode: 310303
subject: Ecological physiology

description: To delimit areas of climatic suitability where the species <i>Rhipicephalus (B.) microplus</i> can spread and areas prone to infestation (with possible negative effects on cattle production), we explored the utility of tools from the field of distributional ecology. The R code provided in this folder can be used to reproduce all the analyses and figures of the paper. We first apply a statistical model to estimate the fundamental climatic niche. Then, we propose a methodology to incorporate biotic factors into the model to approximate the species' realized niche. Using a Bayesian approach, we combined information on climatic tolerance ranges previously obtained through physiological experiments with occurrence records of the tick to approximate its potential distribution. To approximate the realized niche of the species, we used occurrence data of different wild host species to identify regions holding appropriate biotic conditions for the presence of tick populations, making them prone to infestation and of economic importance. We compared our models against models fitted with maximum entropy approaches (MaxEnt). MaxEnt did not produce biologically realistic estimates of the species' fundamental niche and showed anomalies in the predicted geographic distribution.All the files contain R code and are stored in the order in which they were used to reproduce all the analyses. Each script calls all the necessary packages in R to run the code and some scripts contain novel functions to perform specific calculations or produce a figure. We used the software RStudio 2023.06.1 and R version 4.3.1 to create and run the code.Files:0_Histograms_M_OccPnts.RCode to create histograms of environmental variables from the M hypothesis and the occurrence points to be compared with tolerance ranges from physiological experiments. Figure S1 from the Appendix resulted from running these lines of code.1_Data_exploration.RCode used to preprocess the datasets to have them ready for the analyses. Figure 2 was created with the code in this script.2_BayesModel_functions.RFunctions needed to fit a Bayesian model of the fundamental niche in an environmental space of two dimensions, and to visualize the results from the MCMC.3_BayesModel_application.RBayesian estimation of the fundamental niche of the species of interest. Needs the script 2_BayesModel_functions.R4_Visualization_results.RVisualization of different ellipse models (Model 1, Model 2, and Model 3) into a single plot in environmental space (E-space).5_Projecting_Nf_into_Gspace.RVisualization of results from Model 1, Model 2, and Model 3 in environmental space. Code used to create Figure 3 of the paper, and Figures S2-S4 from the Appendix.6_ComparisonMaxent_Nf.RComparing Model 3 against a Maxent model in geography and environmental space. Code used to create Figure 4 of the paper, and Figure S5 from the Appendix.7_Hospederos_occs_G-Espaces.RModel 3 projected into geographic and environmental spaces. Code used to create Figure 5 of the paper.8_Hosts_density_NR_1.RCode to binarize Model 3 and host density maps to combine them into a categorical map. Code used to create Figure 6 of the paper, and Figures S6 and S7 from the Appendix.