DOI: 10.5061/dryad.44j0zpcp6
title: RRphylogeography code and data

description: 1.     One of the main goals of
 historical biogeography is understanding where species originated, and how
 climate change and ecological interactions shaped their distribution. The
 task is complicated by both active and passive mechanisms, including
 habitat tracking, the separation of species into metapopulations of
 variably interconnected demes, and long-distance dispersal which may all
 obscure the geographic signature of species origin.
 2.     Current historical biogeography
 tools use phylogenies to infer the area of origin. They work by
 discretizing the geographic range occupied by the species into distinct
 areas and then applying ancestral character estimation to identify the
 area occupied at speciation. These methods are powerful and can account
 for different modes of speciation. Yet, they are bound to assume that the
 discrete areas currently occupied by the species are faithful
 representation of their climatic and historic affiliation and ignore
 metapopulation structures. Still, most methods cannot take advantage from
 the fossil information or work with phylogenies including extinct species.
 Although explicit bioclimatic modeling is now possible under some
 implementations, these limitations are partly unresolved, which burdens
 the accuracy of the area of origin estimation process.
 3.     We present a new tool written
 in R, named RRphylogeography, meant to find the area of origin of species,
 and to locate feasible zones of contact between species throughout their
 history. RRphylogeography starts from the bioclimatic modelling of the
 species, identifies potential habitat patches occupied during speciation,
 and finds the habitat patches most likely to represent the area of origin
 or contact.
description: Literature overview and simulations (the data), R coding (the
 software)
description: Supporting Code and Data to replicate RRphylogeography simulations and
 compare them to other historical biogeography methods. **IMPORTANT
 NOTICE**: Please unzip compressed files and store them as individual
 folders named as the corresponding zip file. Then, gather the RRgeo R
 package, supporting code files and data in the same folder. The final
 “RRphylogeography code and data” folder should include: gen3sis: folder
 clim_variables: folder occurrences_data: folder input_mask: tiff file
 Workspace: folder R_functions: folder RRgeo: zipped R package ##
 Repository content: ### 1. Guidance vignettes (including annotated and
 explained code lines): Simulation-instructions (.pdf)
 RRphylogeography-routine (.pdf) Herodotools-and-BioGeoBEARS-routine (.pdf)
 Machuruku-routine (.pdf) Machuruku-RRphylo-routine (.pdf) ### 2. Data
 (automatically loaded into the R workspace by executing the scripts):
 gen3sis: part of the example data provided within the gen3sis package
 which we used to simulate data to apply RRphylogeography clim_variables:
 CESM1.2 and BIOME4 paleoclimatic simulations at 0, 1000, 2000, and 3000
 kyrs. Each folder contains the data for individual time bins in the form
 of annual and monthly precipitation (in mm), temperature (in °C), Leaf
 Area Index (LAI - g*C/m^2), and Net Primary Productivity (NPP - g*C/m^2)
 in tif format. occurrences_data: occurrence data per simulation and
 speciation type formatted to run ENphylo_modeling (.RDA). In each file, a
 list of data.frame per species, containing its occurrences in binary
 format (ones for presence, zero for background points) along with the
 explanatory continuous climatic variables (after Variance Inflation Factor
 selection) and the time bin where the occurrences fall. input_mask: raster
 file including the study area at 0.5*0.5 grid resolution (.tiff)
 Workspace: R workspace including the result of Variance Inflation Factor
 selection on climatic variables (vif_RR.RData). ### 3. R\_functions (.R)
 Auxiliary functions (automatically loaded into the R workspace by
 executing the scripts). Modified versions of the EcoPast functions
 “occ.desaggregation.RASTER” (used to remove duplicated points falling into
 the same raster cell) and “fix.coastal.points” (used to shift points to
 the nearest non-NA cell of a base raster within a maximum distance) to
 deal with SpatRaster class objects. EcoPast is available at:
 [https://github.com/francesco-carotenuto/EcoPast/tree/master](https://github.com/francesco-carotenuto/EcoPast/tree/master) ### 4. Package ‘RRgeo’ The package including RRphylogeography and ENphylo suite of functions. ### 5. RRphylogeography\_supplementary\_information (.docx) Supplementary methods and results ### 6. Appendix\_Dataset\_1 (.xlsx) Raw occurrence data for polar and brown bears. Each occurrence is detailed with its geographical coordinates, locality name, radiometric age and uncertainty.