Title: | PaleoPhyloGeographic Modeling of Climate Niches and Species Distributions |
---|---|
Description: | Reconstruction of paleoclimate niches using phylogenetic comparative methods and projection reconstructed niches onto paleoclimate maps. The user can specify various models of trait evolution or estimate the best fit model, include fossils, use one or multiple phylogenies for inference, and make animations of shifting suitable habitat through time. This model was first used in Lawing and Polly (2011), and further implemented in Lawing et al (2016) and Rivera et al (2020). Lawing and Polly (2011) <doi:10.1371/journal.pone.0028554> "Pleistocene climate, phylogeny and climate envelope models: An integrative approach to better understand species' response to climate change" Lawing et al (2016) <doi:10.1086/687202> "Including fossils in phylogenetic climate reconstructions: A deep time perspective on the climatic niche evolution and diversification of spiny lizards (Sceloporus)" Rivera et al (2020) <doi:10.1111/jbi.13915> "Reconstructing historical shifts in suitable habitat of Sceloporus lineages using phylogenetic niche modelling.". |
Authors: | A. Michelle Lawing [aut, cph], Alexandra Howard [aut, cre], Maria-Aleja Hurtado-Materon [aut] |
Maintainer: | Alexandra Howard <[email protected]> |
License: | GPL (>= 3) |
Version: | 1.0.3 |
Built: | 2024-12-09 07:02:53 UTC |
Source: | CRAN |
Adds a fossil as a tip to a specified phylogeny given either an age range that the fossil occurs in, a specific edge that the fossil diverged from, or both. If the specific edge placement for the fossil is unknown, then this function randomly places the fossil on any edge that is within the age range.
addFossil(tree, mintime = 0, maxtime = NA, name = "fossil", edge = NA)
addFossil(tree, mintime = 0, maxtime = NA, name = "fossil", edge = NA)
tree |
An object of the class "phylo" |
mintime |
The minimum age of the fossil. If no minimum time is specified, the default value is 0. |
maxtime |
The maximum age of the fossil. If no maximum time is specified, the default value is the maximum tree age. |
name |
The name of the fossil to appear as a tip.label. |
edge |
The edge on the tree where the fossil presumably diverged. If no edge is specified, then the function randomly selects an edge within the age range of the fossil. |
There are several random components to this function. First, if an edge is not specified to place a fossil, then an edge is randomly selected that is within the age range of the fossil. Second, the exact placement of the node leading to the fossil is randomly selected within the age range specified. Third, the length of the edge leading to the fossil is randomly selected with constraints on the maximum length of the edge, where the maximum length of the edge cannot render the fossil younger than the minimum time of occurrence as specified in the mintime argument.
An object of the class "phylo".
A. Michelle Lawing, Alexandra F. C. Howard
mytree <- phytools::pbtree(n=20) newtree <- addFossil(mytree, mintime = max(mytree$edge.length)/2, maxtime= max(mytree$edge.length)) plot(newtree)
mytree <- phytools::pbtree(n=20) newtree <- addFossil(mytree, mintime = max(mytree$edge.length)/2, maxtime= max(mytree$edge.length)) plot(newtree)
This function retrieves the bioclimatic variables described in Nix & Busby (1986) for the specified variables and the specified time period.
getBioclimVars(occurrences, which.biovars=c(1:19), use.paleoclimate=TRUE, paleoclimateUser=NULL, layerAge=c(0:20))
getBioclimVars(occurrences, which.biovars=c(1:19), use.paleoclimate=TRUE, paleoclimateUser=NULL, layerAge=c(0:20))
occurrences |
a matrix or data.frame with three columns and rows to represent individuals. The first column must be species name for extant occurrences or the age in closest Ma for fossil occurrences. Second and third column must be Longitude and Latitude. |
which.biovars |
a vector of the numbers of the bioclimatic variables that should be returned. The bioclimatic variables number correspond to the table at (https://www.worldclim.org/data/bioclim.html). |
use.paleoclimate |
if left blank, default North America paleoclimate data is used. If FALSE, user submitted paleoclimate must be provided |
paleoclimateUser |
list of data frames with paleoclimates, must be dataframes with columns: GlobalID, Longitude, Latitude, bio1, bio2,...,bio19. |
layerAge |
vector with the ages of the paleoclimate dataframes, if using user submitted paleoclimate data |
The occurrences argument should contain all extant or all fossils. Columns should be in the format: Species, Longitude, Latitude for extant data.
If using the provided paleoclimate data:
Modern time period uses the Hijmans et al. (2005) high resolution climate interpolations.
The time period 10 Ma uses the GCM by Micheels et al (2011) for the Tortonian.
The time period 15 Ma uses the GCM by Krapp & Jungclaus (2011) for the Middle Miocene.
For the one million year intervals outside the modern and past GCMs, the climate was interpolated based on the benthic marine foram stable oxygen isotope ratio curve from Ruddiman et al 1989. The scale of these variables is at a 50 km equidistant point grain size.
Returns a data frame with the original occurrences input appended with columns of bioclimate variables as specified. If fossils are included, the returned bioclimate variables are from the closest 1 Ma interval of isotopically scaled climate.
A. Michelle Lawing, Alexandra F. C. Howard, Maria-Aleja Hurtado-Materon
Hijmans, R. J. et al. (2005) Very high resolution interpolated climate surfaces for global land areas
Krapp, M. and Jungclaus, J. H. (2011) The Middle Miocene climate as modeled in an atmosphere-ocean-biosphere model. Climate of the Past 7(4):1169-1188
Micheels, A. et al. (2011) Analysis of heat transport mechanisms from a Late Miocene model experiment with a fully-coupled atmosphere-ocean general circulation model. Palaeogeography, Palaeoclimatology, Palaeocology 304: 337-350
Nix, H. and Busby, J. (1986) BIOCLIM, a bioclimatic analysis and prediction system. CSIRO annual report. CSIRO Division of Water and Land Resources, Canberra.
Ruddiman, W. F. et al. (1989) Pleistocene evolution: Northern hemisphere ice sheets and North Atlantic Ocean. Paleoceanography 4: 353-412
data(occurrences) biooccur <- getBioclimVars(occurrences,which.biovars=c(3,5)) #returns data frame with bioclimate variables 3 and 5 for occurrence data
data(occurrences) biooccur <- getBioclimVars(occurrences,which.biovars=c(3,5)) #returns data frame with bioclimate variables 3 and 5 for occurrence data
This function gets the bioclimate envelopes of species and nodes.
getEnvelopes(treedata_min, treedata_max, node_est)
getEnvelopes(treedata_min, treedata_max, node_est)
treedata_min |
tree data object with min estimate of the climate envelope for each species. |
treedata_max |
tree data object with max estimate of the climate envelope for each species |
node_est |
the estimate of all the nodes, both min and max |
Function derives the minimum, and maximum of each climate variable
An array containing climate envelopes for each node
A. Michelle Lawing, Alexandra F. C. Howard
ppgmMESS()
, nodeEstimate
, geiger::treedata
data(sampletrees) data(occurrences) tree <- sampletrees[[25]] biooccu <- getBioclimVars(occurrences, which.biovars=1) sp_data_min<- tapply(biooccu[,4],biooccu$Species,min) sp_data_max<- tapply(biooccu[,4],biooccu$Species,max) treedata_min <- geiger::treedata(tree,sp_data_min,sort=TRUE,warnings=F) treedata_max <- geiger::treedata(tree,sp_data_max,sort=TRUE,warnings=F) full_est <- nodeEstimateEnvelopes(treedata_min,treedata_max) node_est <- full_est$est example_getEnvelopes <- getEnvelopes(treedata_min, treedata_max, node_est)
data(sampletrees) data(occurrences) tree <- sampletrees[[25]] biooccu <- getBioclimVars(occurrences, which.biovars=1) sp_data_min<- tapply(biooccu[,4],biooccu$Species,min) sp_data_max<- tapply(biooccu[,4],biooccu$Species,max) treedata_min <- geiger::treedata(tree,sp_data_min,sort=TRUE,warnings=F) treedata_max <- geiger::treedata(tree,sp_data_max,sort=TRUE,warnings=F) full_est <- nodeEstimateEnvelopes(treedata_min,treedata_max) node_est <- full_est$est example_getEnvelopes <- getEnvelopes(treedata_min, treedata_max, node_est)
This function calculates the change in suitable habitat through time in geographic space.
getGeoRate(envelope, tree, which.biovars, use.paleoclimate=TRUE, paleoclimateUser=NULL, layerAge=c(0:20))
getGeoRate(envelope, tree, which.biovars, use.paleoclimate=TRUE, paleoclimateUser=NULL, layerAge=c(0:20))
envelope |
the min and max climate envelope of each lineage for each time slice, as outputted by |
tree |
the phylogeny of all species. An object of class phylo |
which.biovars |
a vector of the numbers of the bioclimate variables to be included. The bioclimate variables number correspond to the table at (https://www.worldclim.org/data/bioclim.html). |
use.paleoclimate |
if left blank, default North America paleoclimate data is used. If FALSE, user submitted paleoclimate must be provided |
paleoclimateUser |
list of data frames with paleoclimates, must be dataframes with columns: GlobalID, Longitude, Latitude, bio1, bio2,...,bio19. (see |
layerAge |
vector with the ages of the paleoclimate dataframes, if using user submitted paleoclimate data |
Calculates rate of geographic change of all lineages. Outputs both the geographic center change, and the geographic size change.
geo_center
change in geographic center of suitable climate envelope
geo_size
change in geographic size of suitable climate envelope
time_int
time intervals
A. Michelle Lawing, Alexandra F. C. Howard, Maria A. Hurtado-Materon
getEnvelopes()
data(sampletrees) data(occurrences) data(paleoclimate) tree <- sampletrees[[25]] occu <- getBioclimVars(occurrences, which.biovars=1) sp_data_min<- tapply(occu[,4],occu$Species,min) sp_data_max<- tapply(occu[,4],occu$Species,max) treedata_min <- geiger::treedata(tree,sp_data_min,sort=TRUE,warnings=F) treedata_max <- geiger::treedata(tree,sp_data_max,sort=TRUE,warnings=F) full_est <- nodeEstimateEnvelopes(treedata_min,treedata_max) node_est <- full_est$est example_getEnvelopes <- getEnvelopes(treedata_min, treedata_max, node_est) example_getGeoRate <- getGeoRate(example_getEnvelopes, tree, which.biovars=1)
data(sampletrees) data(occurrences) data(paleoclimate) tree <- sampletrees[[25]] occu <- getBioclimVars(occurrences, which.biovars=1) sp_data_min<- tapply(occu[,4],occu$Species,min) sp_data_max<- tapply(occu[,4],occu$Species,max) treedata_min <- geiger::treedata(tree,sp_data_min,sort=TRUE,warnings=F) treedata_max <- geiger::treedata(tree,sp_data_max,sort=TRUE,warnings=F) full_est <- nodeEstimateEnvelopes(treedata_min,treedata_max) node_est <- full_est$est example_getEnvelopes <- getEnvelopes(treedata_min, treedata_max, node_est) example_getGeoRate <- getGeoRate(example_getEnvelopes, tree, which.biovars=1)
This function calculates the suitable climate for each specific lineage, starting at the tips and going back through time to the root.
getLineageClimate(envelope, tree, which.biovars, use.paleoclimate=TRUE, paleoclimateUser=NULL, layerAge=c(0:20))
getLineageClimate(envelope, tree, which.biovars, use.paleoclimate=TRUE, paleoclimateUser=NULL, layerAge=c(0:20))
envelope |
the min and max climate envelope of each lineage for each time slice, as outputted by |
tree |
the phylogeny of all species. An object of class phylo |
which.biovars |
a vector of the numbers of the bioclimate variables to be included. The bioclimate variables number correspond to the table at (https://www.worldclim.org/data/bioclim.html). |
use.paleoclimate |
if left blank, default North America paleoclimate data is used. If FALSE, user submitted paleoclimate must be provided |
paleoclimateUser |
list of data frames with paleoclimates, must be dataframes with columns: GlobalID, Longitude, Latitude, bio1, bio2,...,bio19. (see |
layerAge |
vector with the ages of the paleoclimate dataframes, if using user submitted paleoclimate data |
Calculates rate of geographic change of all lineages. Outputs both the geographic center change, and the geographic size change.
matchedClim
list of occurrences points for each lineage, for each time slice of paleoclimate data
lineage
list of lineage specific nodes, as output from phangorn::Ancestors
A. Michelle Lawing, Alexandra F. C. Howard, Maria A. Hurtado-Materon
getEnvelopes()
getGeoRate()
data(sampletrees) data(occurrences) data(paleoclimate) occu <- getBioclimVars(occurrences, which.biovars=1) tree <- sampletrees[[25]] #species minimum for biovariable 1 sp_data_min<- tapply(occu[,4],occu$Species,min) #species maximum for biovariable 1 sp_data_max<- tapply(occu[,4],occu$Species,max) #convert to treedata object treedata_min <- geiger::treedata(tree,sp_data_min,sort=TRUE,warnings=F) treedata_max <- geiger::treedata(tree,sp_data_max,sort=TRUE,warnings=F) #estimate node values using Brownian Motion full_est <- nodeEstimateEnvelopes(treedata_min,treedata_max) node_est <- full_est$est #extract only node estimates #calculate climate envelopes example_getEnvelopes <- getEnvelopes(treedata_min, treedata_max, node_est) #calculate lineage specific climate example_getLinClim <- getLineageClimate(example_getEnvelopes, tree, which.biovars=1)
data(sampletrees) data(occurrences) data(paleoclimate) occu <- getBioclimVars(occurrences, which.biovars=1) tree <- sampletrees[[25]] #species minimum for biovariable 1 sp_data_min<- tapply(occu[,4],occu$Species,min) #species maximum for biovariable 1 sp_data_max<- tapply(occu[,4],occu$Species,max) #convert to treedata object treedata_min <- geiger::treedata(tree,sp_data_min,sort=TRUE,warnings=F) treedata_max <- geiger::treedata(tree,sp_data_max,sort=TRUE,warnings=F) #estimate node values using Brownian Motion full_est <- nodeEstimateEnvelopes(treedata_min,treedata_max) node_est <- full_est$est #extract only node estimates #calculate climate envelopes example_getEnvelopes <- getEnvelopes(treedata_min, treedata_max, node_est) #calculate lineage specific climate example_getLinClim <- getLineageClimate(example_getEnvelopes, tree, which.biovars=1)
This function extracts estimated ancestral reconstructions for continuous characters any time specified along a phylogeny for all lineages present at the specified time.
getTimeSlice(timeSlice, tree, trait, model = "BM", plot.est = FALSE)
getTimeSlice(timeSlice, tree, trait, model = "BM", plot.est = FALSE)
timeSlice |
single numeric or a vector with the time (or times) to extract the estimated ancestor reconstructions. |
tree |
an object of the class "phylo" that should be dated |
trait |
a vector of both tip values and node estimates that correspond to tree |
model |
if model = "estimate", the best fit model of evolution. If the model was specified, then model is the specified model, passes to |
plot.est |
a conditional stating whether or not to plot the results |
The estimated reconstruction relies on an interpolation between node or between tip and node estimates of the trait. This method assumes a constant rate of evolution along the lineage where the interpolation is taking place.
edge
for each time specified, a vector of edges that are present during that time are returned
est
for each time specified, a vector of estimates of the ancestral reconstruction along each edge
A. Michelle Lawing, Alexandra F. C. Howard
geiger::fitContinuous()
, nodeEstimate()
data(sampletrees) data(occurrences) occurrences <- getBioclimVars(occurrences, which.biovars=1) sp_data_min<- tapply(occurrences[,4],occurrences$Species,min) treedata_min <- geiger::treedata(sampletrees[[1]], sp_data_min) ex_est <- nodeEstimate(treedata_min, 1, model = 'BM') #runs BM model ex_timeSlice <- getTimeSlice(10,treedata_min$phy,c(treedata_min$data[,1],ex_est$est))
data(sampletrees) data(occurrences) occurrences <- getBioclimVars(occurrences, which.biovars=1) sp_data_min<- tapply(occurrences[,4],occurrences$Species,min) treedata_min <- geiger::treedata(sampletrees[[1]], sp_data_min) ex_est <- nodeEstimate(treedata_min, 1, model = 'BM') #runs BM model ex_timeSlice <- getTimeSlice(10,treedata_min$phy,c(treedata_min$data[,1],ex_est$est))
This function estimates the ancestral character states for continuous characters given a model of evolution or using the best fit model of evolution from the fitContinuous function in the geiger package. The ancestral states are estimated using GLS described in Martins and Hansen (1997).
nodeEstimate(treedata.obj, traitnum, model = "BM", bounds = list(), control = list(), plot.est = FALSE)
nodeEstimate(treedata.obj, traitnum, model = "BM", bounds = list(), control = list(), plot.est = FALSE)
treedata.obj |
an object of the class "treedata". |
traitnum |
the column number of the trait within the treedata object to be reconstructed. |
model |
the model of evolution to use in the ancestral state reconstruction. Options are "estimate", "BM", "OU", "EB", "lambda", "kappa", "delta". |
bounds |
bounds used for the model, passes to |
control |
setting used for optimization of the model likelihood. Passes to |
plot.est |
logical. whether or not to plot the traitgram of the estimated ancestor states. |
See the fitContinuous()
details for descriptions of the models of evolution and parameter estimation. nodeEstimate()
currently supports the following models of evolution: Brownian motion (Felsenstein, 1973), Ornstein-Uhlenbeck (Butler and King, 2004), early-burst (Harmon et al., 2010), lambda (Pagel, 1999), kappa (Pagel, 1999), and delta (Pagel, 1999).
an object of the class "nodeEstimate".
model
if model = "estimate", the best fit model of evolution. If the model was specified, then model is the specified model.
est
the ancestral node estimates of the continuous character.
phy
the phylogeny used for the estimates, which might be transformed depending on the evolutionary model.
BM
if model = "BM", returned values from fitContinuous()
where the model is "BM"
OU
if model = "OU", returned values from fitContinuous()
where the model is "OU"
EB
if model = "EB", returned values from fitContinuous()
where the model is "EB"
lambda
if model = "lambda", returned values from fitContinuous()
where the model is "lambda"
kappa
if model = "kappa", returned values from fitContinuous()
where the model is "kappa"
delta
if model = "delta", returned values from fitContinuous()
where the model is "delta"
fitted
if model = "estimate", returned values from the best fit model of evolution.
A. Michelle Lawing, Alexandra F. C. Howard
Butler, M. A. and King, A. A. (2004) Phylogenetic comparative analysis: a modeling approach for adaptive evolution. American Naturalist, 164:683-695.
Felsenstein, J. (1973) Maximum likelihood estimation of evolutionary trees from continuous characters. American Journal of Human Genetics, 25:471-492
Harmon, L. J. et al. (2010) Early bursts of body size and shape evolution are rare in comparative data. Evolution, 64:2385-2396
Martins, E. P. and Hansen, T. F. (1997) Phylogenies and the comparative method: a general approach to incorporating phylogenetic information into the analysis of interspecific data. American Naturalist, 149, 646–667.
Pagel M. (1999) Inferring the historical patterns of biological evolution. Nature, 401:877-884
fitContinuous()
data(sampletrees) data(occurrences) occurrences <- getBioclimVars(occurrences, which.biovars=1) sp_data_min<- tapply(occurrences[,4],occurrences$Species,min) ex <- geiger::treedata(sampletrees[[1]], sp_data_min) nodeEstimate(ex, 1, model = 'OU') #runs OU model
data(sampletrees) data(occurrences) occurrences <- getBioclimVars(occurrences, which.biovars=1) sp_data_min<- tapply(occurrences[,4],occurrences$Species,min) ex <- geiger::treedata(sampletrees[[1]], sp_data_min) nodeEstimate(ex, 1, model = 'OU') #runs OU model
This function estimates climate envelopes at nodes with the optional placement of fossils on randomly assigned or specified edges on a tree.
nodeEstimateEnvelopes(treedata_min, treedata_max, fossils=FALSE, fossils.edges=FALSE, model="BM", bounds=list(), control=list(), use.paleoclimate = TRUE, paleoclimateUser = NULL, layerAge = c(0:20), which.biovars = which.biovars)
nodeEstimateEnvelopes(treedata_min, treedata_max, fossils=FALSE, fossils.edges=FALSE, model="BM", bounds=list(), control=list(), use.paleoclimate = TRUE, paleoclimateUser = NULL, layerAge = c(0:20), which.biovars = which.biovars)
treedata_min |
tree data object with min estimate of the climate envelope – list where first object is phylogeny, and second object is array of species with climate data variables (species must match) |
treedata_max |
tree data object with max estimate of the climate envelope |
fossils |
a matrix with three columns of age, longitude, and latitude, in that order, and rows that are entries for fossil occurrences. |
fossils.edges |
the edge number that the fossil occurs on |
model |
the model of evolution to use in the ancestral state reconstruction. Options are "estimate", "BM", "OU", "EB", "lambda", "kappa", "delta". |
bounds |
bounds used for the model, passes to |
control |
setting used for optimization of the model likelihood. Passes to |
use.paleoclimate |
if left blank, default North America paleoclimate data is used. If FALSE, user submitted paleoclimate must be provided |
paleoclimateUser |
list of data frames with paleoclimates, must be dataframes with columns: GlobalID, Longitude, Latitude, bio1, bio2,...,bio19. (see |
layerAge |
vector with the ages of the paleoclimate dataframes, if using user submitted paleoclimate data |
which.biovars |
A vector of the numbers of the bioclimate variables that should be returned. The bioclimate variables number correspond to the Hijmans table at (https://www.worldclim.org/data/bioclim.html). |
function adds fossils to trees according to addFossil()
, then passes to nodeEstimate()
.
an object of the class "nodeEstimate".
model
if model = "estimate", the best fit model of evolution. If the model was specified, then model is the specified model.
est
the ancestral node estimates of the continuous character.
phy
the phylogeny used for the estimates, which might be transformed depending on the evolutionary model.
BM
if model = "BM", returned values from fitContinuous()
where the model is "BM"
OU
if model = "OU", returned values from fitContinuous()
where the model is "OU"
EB
if model = "EB", returned values from fitContinuous()
where the model is "EB"
lambda
if model = "lambda", returned values from fitContinuous()
where the model is "lambda"
kappa
if model = "kappa", returned values from fitContinuous()
where the model is "kappa"
delta
if model = "delta", returned values from fitContinuous()
where the model is "delta"
fitted
if model = "estimate", returned values from the best fit model of evolution.
A. Michelle Lawing, Alexandra F. C. Howard
nodeEstimate
, fitContinuous
data(sampletrees) sampletrees <- sample(sampletrees,5) data(occurrences) occu <- getBioclimVars(occurrences, which.biovars=c(1,2)) sp_data_min<-sapply(4:5,function(x) tapply(occu[,x],occu$Species,min)) sp_data_max<-sapply(4:5,function(x) tapply(occu[,x],occu$Species,max)) ex_min <- geiger::treedata(sampletrees[[1]], sp_data_min, sort=TRUE) ex_max <- geiger::treedata(sampletrees[[1]], sp_data_max, sort=TRUE) colnames(ex_min$data)<- colnames(ex_max$data)<-c("bio1","bio2") #labels biovars nodeest<- nodeEstimateEnvelopes(treedata_min=ex_min,treedata_max=ex_max, model="BM",which.biovars=c(1,2), bounds=list(sigsq = c(min = 0, max = 1000000)))
data(sampletrees) sampletrees <- sample(sampletrees,5) data(occurrences) occu <- getBioclimVars(occurrences, which.biovars=c(1,2)) sp_data_min<-sapply(4:5,function(x) tapply(occu[,x],occu$Species,min)) sp_data_max<-sapply(4:5,function(x) tapply(occu[,x],occu$Species,max)) ex_min <- geiger::treedata(sampletrees[[1]], sp_data_min, sort=TRUE) ex_max <- geiger::treedata(sampletrees[[1]], sp_data_max, sort=TRUE) colnames(ex_min$data)<- colnames(ex_max$data)<-c("bio1","bio2") #labels biovars nodeest<- nodeEstimateEnvelopes(treedata_min=ex_min,treedata_max=ex_max, model="BM",which.biovars=c(1,2), bounds=list(sigsq = c(min = 0, max = 1000000)))
Occurrences for Sceloporus, as collected for Lawing et al 2016. Occurrence records from GBIF, and vetted using expert range maps from IUCN. See reference for further details Lawing et al (2015) Including fossils in phylogenetic climate reconstructions: A deep time perspective on the climatic niche evolution and diversification of spiny lizards (Sceloporus)
occurrences
occurrences
'occurrences' A data frame of Sceloporus occurrence records
Species name
Longitude of occurrence
Latitude of occurence
<https://www.journals.uchicago.edu/doi/10.1086/687202>
North America paleoclimate data used for running ppgm
paleoclimate
paleoclimate
'paleoclimate' A large list of paleoclimates for North America, each element in the list contains a data frame for one time period, from present to 20mya
Global ID references for location
Longitude of location
Latitude of location
Value for bioclimatic variable 1: annual mean temperature
Value for bioclimatic variable 2: mean diurnal range
Value for bioclimatic variable 3: isothermality
Value for bioclimatic variable 2: temperature seasonality
Value for bioclimatic variable 2: max temp of warmest month
Value for bioclimatic variable 2: min temp of coldest month
Value for bioclimatic variable 2: temperature annual range
Value for bioclimatic variable 2: mean temp of wettest quarter
Value for bioclimatic variable 2: mean temp of driest quarter
Value for bioclimatic variable 2: mean temp of warmest quarter
Value for bioclimatic variable 2: mean temp of coldest quarter
Value for bioclimatic variable 2: annual precipitation
Value for bioclimatic variable 2: precipitation of wettest month
Value for bioclimatic variable 2: precipitation of the driest month
Value for bioclimatic variable 2: precipitation seasonality
Value for bioclimatic variable 2: precipitation of the wettest quarter
Value for bioclimatic variable 2: precipitation of the driest quarter
Value for bioclimatic variable 2: precipitation of the warmest quarter
Value for bioclimatic variable 2: precipitation of the coldest quarter
This function creates an animated gif showing the change in modelled suitable habitat through time in geographic space.
plotAnimatedPPGM(envelope, tree, filename="ppgm.gif", which.biovars, path="", use.paleoclimate=TRUE, paleoclimateUser=NULL, layerAge=c(0:20))
plotAnimatedPPGM(envelope, tree, filename="ppgm.gif", which.biovars, path="", use.paleoclimate=TRUE, paleoclimateUser=NULL, layerAge=c(0:20))
envelope |
the min and max envelope of each lineage for each time slice |
tree |
the phylogeny or multiple phylogenies that show the relationship between species |
filename |
desired filename of output |
which.biovars |
A vector of the numbers of the bioclimate variables that should be returned. The bioclimate variables number correspond to the Hijmans table at (https://www.worldclim.org/data/bioclim.html). |
path |
path to the directory where the results should be saved |
use.paleoclimate |
if left blank, default North America paleoclimate data is used. If FALSE, user submitted paleoclimate must be provided |
paleoclimateUser |
list of data frames with paleoclimates, must be dataframes with columns: GlobalID, Longitude, Latitude, bio1, bio2,...,bio19. (see |
layerAge |
vector with the ages of the paleoclimate dataframes, if using user submitted paleoclimate data |
Requires ImageMagick or GraphicsMagick to be installed on the operating system. This is easy to do if you have macports. Just type sudo port install ImageMagick into terminal.
An animated gif of species through time
A. Michelle Lawing, Alexandra F. C. Howard, Maria-Aleja Hurtado-Materon
data(sampletrees) data(occurrences) tree <- sampletrees[[25]] biooccu <- getBioclimVars(occurrences, which.biovars=1) sp_data_min<- tapply(biooccu[,4],biooccu$Species,min) sp_data_max<- tapply(biooccu[,4],biooccu$Species,max) treedata_min <- geiger::treedata(tree,sp_data_min,sort=TRUE,warnings=F) treedata_max <- geiger::treedata(tree,sp_data_max,sort=TRUE,warnings=F) ## Not run: full_est <- nodeEstimateEnvelopes(treedata_min,treedata_max) node_est <- full_est$est example_getEnvelopes <- getEnvelopes(treedata_min, treedata_max, node_est) animatedplot <- plotAnimatedPPGM(example_getEnvelopes,tree,which.biovars=1,path=tempdir()) ## End(Not run)
data(sampletrees) data(occurrences) tree <- sampletrees[[25]] biooccu <- getBioclimVars(occurrences, which.biovars=1) sp_data_min<- tapply(biooccu[,4],biooccu$Species,min) sp_data_max<- tapply(biooccu[,4],biooccu$Species,max) treedata_min <- geiger::treedata(tree,sp_data_min,sort=TRUE,warnings=F) treedata_max <- geiger::treedata(tree,sp_data_max,sort=TRUE,warnings=F) ## Not run: full_est <- nodeEstimateEnvelopes(treedata_min,treedata_max) node_est <- full_est$est example_getEnvelopes <- getEnvelopes(treedata_min, treedata_max, node_est) animatedplot <- plotAnimatedPPGM(example_getEnvelopes,tree,which.biovars=1,path=tempdir()) ## End(Not run)
This function creates an animated gif showing the change in modeled suitable habitat through time in geographic space. It requires ImageMagick or GraphicsMagick to be previously installed in the operating system. This is easy to do if you have macports. Just type sudo port install ImageMagick into terminal.
plotAnimatedPPGMMultiPhylo(envelope, tree, filename="ppgm.gif", which.biovars, path="", use.paleoclimate=TRUE, paleoclimateUser=NULL, layerAge=c(0:20))
plotAnimatedPPGMMultiPhylo(envelope, tree, filename="ppgm.gif", which.biovars, path="", use.paleoclimate=TRUE, paleoclimateUser=NULL, layerAge=c(0:20))
envelope |
the min and max envelope of each lineage for each time slice |
tree |
the phylogeny or multiple phylogenies that show the relationship between species |
filename |
filename of output |
which.biovars |
A vector of the numbers of the bioclimate variables that should be returned. The bioclimate variables number correspond to the Hijmans table at (https://www.worldclim.org/data/bioclim.html). |
path |
path to the directory where the results should be saved |
use.paleoclimate |
if left blank, default North America paleoclimate data is used. If FALSE, user submitted paleoclimate must be provided |
paleoclimateUser |
list of data frames with paleoclimates, must be dataframes with columns: GlobalID, Longitude, Latitude, bio1, bio2,...,bio19. (see |
layerAge |
vector with the ages of the paleoclimate dataframes, if using user submitted paleoclimate data |
Requires ImageMagick or GraphicsMagick to be installed on the operating system. This is easy to do if you have macports. Just type sudo port install ImageMagick into terminal.
An animated gif of species through time
A. Michelle Lawing, Alexandra F. C. Howard
data(sampletrees) data(occurrences) sampletrees <- sample(sampletrees,5) biooccu <- getBioclimVars(occurrences, which.biovars=1) sp_data_min<- tapply(biooccu[,4],biooccu$Species,min) sp_data_max<- tapply(biooccu[,4],biooccu$Species,max) treedata_min <- treedata_max <- node_est <- envelope <- list() ## Not run: for (tr in 1:length(sampletrees)){ treedata_min[[tr]] <- geiger::treedata(sampletrees[[tr]],sp_data_min,sort=TRUE,warnings=F) treedata_max[[tr]] <- geiger::treedata(sampletrees[[tr]],sp_data_max,sort=TRUE,warnings=F) full_est <- nodeEstimateEnvelopes(treedata_min[[tr]],treedata_max[[tr]]) node_est[[tr]] <- full_est$est envelope[[tr]] <- getEnvelopes(treedata_min[[tr]], treedata_max[[tr]], node_est[[tr]]) } animatedplot <- plotAnimatedPPGMMultiPhylo(envelope,sampletrees,which.biovars=1, path=tempdir()) ## End(Not run)
data(sampletrees) data(occurrences) sampletrees <- sample(sampletrees,5) biooccu <- getBioclimVars(occurrences, which.biovars=1) sp_data_min<- tapply(biooccu[,4],biooccu$Species,min) sp_data_max<- tapply(biooccu[,4],biooccu$Species,max) treedata_min <- treedata_max <- node_est <- envelope <- list() ## Not run: for (tr in 1:length(sampletrees)){ treedata_min[[tr]] <- geiger::treedata(sampletrees[[tr]],sp_data_min,sort=TRUE,warnings=F) treedata_max[[tr]] <- geiger::treedata(sampletrees[[tr]],sp_data_max,sort=TRUE,warnings=F) full_est <- nodeEstimateEnvelopes(treedata_min[[tr]],treedata_max[[tr]]) node_est[[tr]] <- full_est$est envelope[[tr]] <- getEnvelopes(treedata_min[[tr]], treedata_max[[tr]], node_est[[tr]]) } animatedplot <- plotAnimatedPPGMMultiPhylo(envelope,sampletrees,which.biovars=1, path=tempdir()) ## End(Not run)
plotGeoRates
plotGeoRates(geo_center, geo_size, time_int, trees, path="")
plotGeoRates(geo_center, geo_size, time_int, trees, path="")
geo_center |
change in geographic center of suitable climate envelope, see |
geo_size |
change in geographic size of suitable climate envelope |
time_int |
time intervals to plot |
trees |
distribution of phylogenies |
path |
path to the directory where the results to be saved |
Creates plot with gray background of all pairwise comparisons of change in geo center and area through time. Blue points on top show the sequential change in geo center and expansion/contraction for all lineages
plots of geo rate
A. Michelle Lawing, Alexandra F. C. Howard
getGeoRates
data(sampletrees) data(occurrences) sampletrees <- sample(sampletrees,5) biooccu <- getBioclimVars(occurrences, which.biovars=1) sp_data_min<- tapply(biooccu[,4],biooccu$Species,min) sp_data_max<- tapply(biooccu[,4],biooccu$Species,max) treedata_min <- treedata_max <- node_est <- envelope <- list() geo_center<-array(NA,dim=c(100,53,21,21)) geo_size<-array(NA,dim=c(100,53,21,21)) for (tr in 1:length(sampletrees)){ treedata_min[[tr]] <- geiger::treedata(sampletrees[[tr]],sp_data_min,sort=TRUE,warnings=F) treedata_max[[tr]] <- geiger::treedata(sampletrees[[tr]],sp_data_max,sort=TRUE,warnings=F) full_est <- nodeEstimateEnvelopes(treedata_min[[tr]],treedata_max[[tr]]) node_est[[tr]] <- full_est$est envelope[[tr]] <- getEnvelopes(treedata_min[[tr]], treedata_max[[tr]], node_est[[tr]]) temp <- getGeoRate(envelope[[tr]], sampletrees[[tr]], which.biovars=1) geo_center[tr,,,]<-temp$geo_center geo_size[tr,,,]<-temp$geo_size } ## Not run: plotGeoRates(geo_center, geo_size, temp$time_int, sampletrees, path="tempdir()")
data(sampletrees) data(occurrences) sampletrees <- sample(sampletrees,5) biooccu <- getBioclimVars(occurrences, which.biovars=1) sp_data_min<- tapply(biooccu[,4],biooccu$Species,min) sp_data_max<- tapply(biooccu[,4],biooccu$Species,max) treedata_min <- treedata_max <- node_est <- envelope <- list() geo_center<-array(NA,dim=c(100,53,21,21)) geo_size<-array(NA,dim=c(100,53,21,21)) for (tr in 1:length(sampletrees)){ treedata_min[[tr]] <- geiger::treedata(sampletrees[[tr]],sp_data_min,sort=TRUE,warnings=F) treedata_max[[tr]] <- geiger::treedata(sampletrees[[tr]],sp_data_max,sort=TRUE,warnings=F) full_est <- nodeEstimateEnvelopes(treedata_min[[tr]],treedata_max[[tr]]) node_est[[tr]] <- full_est$est envelope[[tr]] <- getEnvelopes(treedata_min[[tr]], treedata_max[[tr]], node_est[[tr]]) temp <- getGeoRate(envelope[[tr]], sampletrees[[tr]], which.biovars=1) geo_center[tr,,,]<-temp$geo_center geo_size[tr,,,]<-temp$geo_size } ## Not run: plotGeoRates(geo_center, geo_size, temp$time_int, sampletrees, path="tempdir()")
plotGeoRatesCon
plotGeoRatesCon(geo_center, geo_size, time_int, trees, path="")
plotGeoRatesCon(geo_center, geo_size, time_int, trees, path="")
geo_center |
change in geographic center of suitable climate envelope |
geo_size |
change in geographic size of suitable climate envelope |
time_int |
time intervals to plot |
trees |
distribution of phylogenies |
path |
path to the directory where the results to be saved |
Creates plot with gray background of all pairwise comparisons of change in geo center and area through time. Blue points on top show the sequential change in geo center and expansion/contraction for all lineages
plots of geo rate
A. Michelle Lawing, Alexandra F. C. Howard
getGeoRates
data(sampletrees) data(occurrences) tree <- sampletrees[[25]] occurrences <- getBioclimVars(occurrences, which.biovars=1) sp_data_min<- tapply(occurrences[,4],occurrences$Species,min) sp_data_max<- tapply(occurrences[,4],occurrences$Species,max) treedata_min <- geiger::treedata(tree,sp_data_min,sort=TRUE,warnings=F) treedata_max <- geiger::treedata(tree,sp_data_max,sort=TRUE,warnings=F) full_est <- nodeEstimateEnvelopes(treedata_min,treedata_max) node_est <- full_est$est example_getEnvelopes <- getEnvelopes(treedata_min, treedata_max, node_est) example_getGeoRate <- getGeoRate(example_getEnvelopes, tree,which.biovars=1) ## Not run: plotGeoRatesCon(example_getGeoRate$geo_center,example_getGeoRate$geo_size, example_getGeoRate$time_int, trees = trees[[1]], path=tempdir()) ## End(Not run)
data(sampletrees) data(occurrences) tree <- sampletrees[[25]] occurrences <- getBioclimVars(occurrences, which.biovars=1) sp_data_min<- tapply(occurrences[,4],occurrences$Species,min) sp_data_max<- tapply(occurrences[,4],occurrences$Species,max) treedata_min <- geiger::treedata(tree,sp_data_min,sort=TRUE,warnings=F) treedata_max <- geiger::treedata(tree,sp_data_max,sort=TRUE,warnings=F) full_est <- nodeEstimateEnvelopes(treedata_min,treedata_max) node_est <- full_est$est example_getEnvelopes <- getEnvelopes(treedata_min, treedata_max, node_est) example_getGeoRate <- getGeoRate(example_getEnvelopes, tree,which.biovars=1) ## Not run: plotGeoRatesCon(example_getGeoRate$geo_center,example_getGeoRate$geo_size, example_getGeoRate$time_int, trees = trees[[1]], path=tempdir()) ## End(Not run)
Combine the node estimates based on random or specified fossil placement and plot them on a phylotraitgram in a specified directory.
plotTraitGram(treedata_min, treedata_max, node_est, fossils=FALSE, which.biovars, path="", use.paleoclimate=TRUE, paleoclimateUser=NULL, layerAge=c(0:20))
plotTraitGram(treedata_min, treedata_max, node_est, fossils=FALSE, which.biovars, path="", use.paleoclimate=TRUE, paleoclimateUser=NULL, layerAge=c(0:20))
treedata_min |
a tree data object with the min estimate of the climate envelope |
treedata_max |
a tree data object with the max estimate of the climate envelope |
node_est |
the estimate of all the nodes, both min and max |
fossils |
a matrix with four columns of min age, max age, longitude, and latitude, in that order, and rows that are entries for fossil occurrences. |
which.biovars |
A vector of the numbers of the bioclimate variables that should be returned. The bioclimate variables number correspond to the Hijmans table at (https://www.worldclim.org/data/bioclim.html). |
path |
path to the directory where the results should be saved |
use.paleoclimate |
if left blank, default North America paleoclimate data is used. If FALSE, user submitted paleoclimate must be provided |
paleoclimateUser |
list of data frames with paleoclimates, must be dataframes with columns: GlobalID, Longitude, Latitude, bio1, bio2,...,bio19. (see |
layerAge |
vector with the ages of the paleoclimate dataframes, if using user submitted paleoclimate data |
a trait gram for minimum and maximum of biovariables
A. Michelle Lawing, Alexandra F. C. Howard
plotTraitGramMultiPhylo
data(sampletrees) data(occurrences) bounds <- list(sigsq = c(min = 0, max = 1000000)) ex_mytree <- sampletrees[[3]] #single tree test_con <- ppgmConsensus(occurrences = occurrences, trees = ex_mytree, which.biovars = 1, bounds = bounds, control = list(niter = 20)) ## Not run: plotTraitGram(test_con$treedata_min,test_con$treedata_max,test_con$node_est)
data(sampletrees) data(occurrences) bounds <- list(sigsq = c(min = 0, max = 1000000)) ex_mytree <- sampletrees[[3]] #single tree test_con <- ppgmConsensus(occurrences = occurrences, trees = ex_mytree, which.biovars = 1, bounds = bounds, control = list(niter = 20)) ## Not run: plotTraitGram(test_con$treedata_min,test_con$treedata_max,test_con$node_est)
Combine the node estimates based on random or specified fossil placement and plot them on a phylotrait gram in a specified directory.
plotTraitGramMultiPhylo(treedata_min, treedata_max, node_est, fossils=FALSE, use.paleoclimate=TRUE, paleoclimateUser=NULL, layerAge=c(0:20), which.biovars, path="")
plotTraitGramMultiPhylo(treedata_min, treedata_max, node_est, fossils=FALSE, use.paleoclimate=TRUE, paleoclimateUser=NULL, layerAge=c(0:20), which.biovars, path="")
treedata_min |
tree data object with min estimate of the climate envelope |
treedata_max |
tree data object with max estimate of the climate envelope |
node_est |
the estimate of all the nodes, both min and max. Must be in format [[trees]][[permut]][2,species,trait] |
fossils |
a matrix with four columns of min age, max age, longitude, and latitude, in that order, and rows that are entries for fossil occurrences. |
use.paleoclimate |
if left blank, default North America paleoclimate data is used. If FALSE, user submitted paleoclimate must be provided |
paleoclimateUser |
list of data frames with paleoclimates, must be dataframes with columns: GlobalID, Longitude, Latitude, bio1, bio2,...,bio19. (see |
layerAge |
vector with the ages of the paleoclimate dataframes, if using user submitted paleoclimate data |
which.biovars |
A vector of the numbers of the bioclimate variables that should be returned. The bioclimate variables number correspond to the Hijmans table at (https://www.worldclim.org/data/bioclim.html). |
path |
path to the directory where the results should be saved |
plots a traitgram over multiple phylogenetic trees
a trait gram for minimum and maximum of biovariables over a distribution of phylogenetic trees
A. Michelle Lawing, Alexandra F. C. Howard
plotTraitGram
data(sampletrees) data(occurrences) bounds <- list(sigsq = c(min = 0, max = 1000000)) sample <-sample(sampletrees,5) test_ppgm <- ppgm(occurrences = occurrences,trees = sample, model = "BM", which.biovars = c(1), bounds = bounds, control = list(niter = 20)) ## Not run: plotTraitGramMultiPhylo(test_ppgm$treedata_min, test_ppgm$treedata_max,test_ppgm$node_est) ## End(Not run)
data(sampletrees) data(occurrences) bounds <- list(sigsq = c(min = 0, max = 1000000)) sample <-sample(sampletrees,5) test_ppgm <- ppgm(occurrences = occurrences,trees = sample, model = "BM", which.biovars = c(1), bounds = bounds, control = list(niter = 20)) ## Not run: plotTraitGramMultiPhylo(test_ppgm$treedata_min, test_ppgm$treedata_max,test_ppgm$node_est) ## End(Not run)
ppgm makes a paleophylogeographic species distribution model using the bioclimate envelope method for a specified time period. Currently, models are only available for North America.
ppgm(occurrences, fossils = FALSE, trees, fossils.edges = FALSE, model = "BM", permut = 1, only.biovars = TRUE, which.biovars = c(1:19), path = "", plot.TraitGram = FALSE, plot.AnimatedMaps = FALSE, plot.GeoRates = FALSE, bounds = list(), control = list(), use.paleoclimate = TRUE, paleoclimateUser = NULL, layerAge=c(0:20), verbose = TRUE)
ppgm(occurrences, fossils = FALSE, trees, fossils.edges = FALSE, model = "BM", permut = 1, only.biovars = TRUE, which.biovars = c(1:19), path = "", plot.TraitGram = FALSE, plot.AnimatedMaps = FALSE, plot.GeoRates = FALSE, bounds = list(), control = list(), use.paleoclimate = TRUE, paleoclimateUser = NULL, layerAge=c(0:20), verbose = TRUE)
occurrences |
a matrix with three columns of species name, longitude, and latitude, in that order, and rows that are entries for species occurrences. The bioclimate variables can be included for each occurrence in following columns. They must be in order 1 through 19. |
fossils |
a matrix with four columns of min age, max age, longitude, and latitude, in that order, and rows that are entries for fossil occurrences. The bioclimate variables can be included for each occurrence in following columns. They must be in order 1 through 19. All 19 variables must be included at this stage, variable selection is done with the argument: "which.biovars". |
trees |
phylogenies of species from first column of occurrences argument. Object of class multiphylo. |
fossils.edges |
a vector of edges that the fossils belong to. Must be in the same order of the fossils argument. If fossils.edges is false, the the function randomly assigns the location of the fossils depending on the age (see details for more information). |
model |
the model of evolution to use to estimate ancestor nodes. Argument is passed onto to function nodeEstimate. |
permut |
the number of times to randomly place fossils in phylogeny and estimate ancestor states. |
only.biovars |
logical. If FALSE, user must include biovariables in occurrence object. |
which.biovars |
a vector with the biovars to include in model (see www.worldclim.org for a list of biovars). If "ALL", then all 19 biovars are included in analysis. |
path |
path to the directory where the results should be saved. |
plot.TraitGram |
logical. Whether to plot a TraitGram |
plot.AnimatedMaps |
logical. Whether to plot AnimatedMaps. Requires ImageMagick to be installed on the system. |
plot.GeoRates |
logical. Whether to plot GeoRates |
bounds |
parameters for the evolutionary model selected. If none are supplied the default is used |
control |
settings used for optimisation of model likelihood. Passes to |
use.paleoclimate |
if left blank, default North America paleoclimate data is used. If FALSE, user submitted paleoclimate must be provided |
paleoclimateUser |
list of data frames with paleoclimates, must be dataframes with columns: GlobalID, Longitude, Latitude, bio1, bio2,...,bio19. |
layerAge |
vector with the ages of the paleoclimate dataframes, if using user submitted paleoclimate data |
verbose |
default true, returns all outputs. If FALSE then returns only climate envelopes and geographic data |
If the 19 bioclimate variables are not supplied with the occurrences or with the fossils, they will be extracted from the closest 50km point location in the modern or paleoclimate maps that are loaded in with this function. The paleoclimate maps are isotopically scaled between general circulation models (see Lawing and Polly 2011; Rodder et al. 2013) and modern climate (see Hijmans et al. 2005). The fossils paleoclimate data is extracted to the closest million year paleoclimate map. Paleoclimate maps are derived at one million year intervals for the past 20 Ma. The tree (phylogeny) should be dichotomous and the species names should match the names in the first column of the occurrences argument.
cem
Estimate of climate envelope for each species in present time. A data frame containing species and min mean and max of biovars specified with which.biovars
.
geo_move
data frame of RateGeoCenter and RateGeoSize
change_geo_center
array of change in geographic center of suitable climate for each lineage
change_geo_size
array of change in geographic size of suitable climate for each lineage
time_int
matrix array of time intervals
treedata_min
list of trees with minimum bioclimatic variables
treedata_max
list of trees with maximum bioclimatic variables
model_min
list of trees with minimum fitted model as specified in model
model_max
list of trees with maximum fitted model as specified in model
node_est
list of traits at each node for all trees, min and max for each species. As estimated by nodeEstimate and nodeEstimateEnvelopes
aicmin
if model is estimated, table of aic values for minimum trait values for all trees
aicmax
if model is estimated, table of aic values for maximum trait values for all trees
A. Michelle Lawing, Alexandra F. C. Howard, Maria A. Hurtado-Materon
data(sampletrees) data(occurrences) bounds <- list(sigsq = c(min = 0, max = 1000000)) test_ppgm <- ppgm(occurrences = occurrences,trees = sampletrees, model = "BM", which.biovars = c(1), bounds = bounds, control = list(niter = 20))
data(sampletrees) data(occurrences) bounds <- list(sigsq = c(min = 0, max = 1000000)) test_ppgm <- ppgm(occurrences = occurrences,trees = sampletrees, model = "BM", which.biovars = c(1), bounds = bounds, control = list(niter = 20))
ppgm makes a paleophylogeographic species distribution model using the bioclimate envelope method for a specified time period. consensus version
ppgmConsensus(occurrences, fossils = FALSE, trees, fossils.edges = FALSE, model = "BM", permut = 1, only.biovars = TRUE, which.biovars = c(1:19), path = "", plot.TraitGram = FALSE, plot.AnimatedMaps = FALSE, plot.GeoRates = FALSE, bounds = list(), control = list(), use.paleoclimate = TRUE, paleoclimateUser = NULL, layerAge = c(0:20), verbose = TRUE)
ppgmConsensus(occurrences, fossils = FALSE, trees, fossils.edges = FALSE, model = "BM", permut = 1, only.biovars = TRUE, which.biovars = c(1:19), path = "", plot.TraitGram = FALSE, plot.AnimatedMaps = FALSE, plot.GeoRates = FALSE, bounds = list(), control = list(), use.paleoclimate = TRUE, paleoclimateUser = NULL, layerAge = c(0:20), verbose = TRUE)
occurrences |
a matrix with three columns of species name, longitude, and latitude, in that order, and rows that are entries for species occurrences. The bioclimate variables can be included for each occurrence in following columns. They must be in order 1 through 19. |
fossils |
a matrix with four columns of min age, max age, longitude, and latitude, in that order, and rows that are entries for fossil occurrences. The bioclimate variables can be included for each occurrence in following columns. They must be in order 1 through 19. All 19 variables must be included at this stage, variable selection is done with the argument: "which.biovars". |
trees |
phylogeny of species from first column of occurrences argument. Object of class phylo. |
fossils.edges |
a vector of edges that the fossils belong to. Must be in the same order of the fossils argument. If fossils.edges is false, the the function randomly assigns the location of the fossils depending on the age (see details for more information). |
model |
the model of evolution to use to estimate ancestor nodes. Argument is passed onto to function nodeEstimate. |
permut |
the number of times to randomly place fossils in phylogeny and estimate ancestor states. |
only.biovars |
logical. If FALSE, user must include biovariables in occurrence object. |
which.biovars |
a vector with the biovars to include in model (see www.worldclim.org for a list of biovars). If "ALL", then all 19 biovars are included in analysis. |
path |
path to the directory where the results should be saved. |
plot.TraitGram |
logical. Whether to plot a TraitGram |
plot.AnimatedMaps |
Logical. Whether to plot AnimatedMaps. Requires ImageMagick to be installed on the system. |
plot.GeoRates |
logical. Whether to plot GeoRates |
bounds |
parameters for the evolutionary model selected. If none are supplied the default is used |
control |
settings used for optimisation of model likelihood. Passes to |
use.paleoclimate |
if left blank, default North America paleoclimate data is used. If FALSE, user submitted paleoclimate must be provided |
paleoclimateUser |
list of data frames with paleoclimates, must be dataframes with columns: GlobalID, Longitude, Latitude, bio1, bio2,...,bio19. |
layerAge |
vector with the ages of the paleoclimate dataframes, if using user submitted paleoclimate data |
verbose |
default true, returns all outputs. If FALSE then returns only climate envelopes and geographic data |
If the 19 bioclimate variables are not supplied with the occurrences or with the fossils, they will be extracted from the closest 50km point location in the modern or paleoclimate maps that are loaded in with this function. The paleoclimate maps are isotopically scaled between general circulation models (see Lawing and Polly 2011; Rodder et al. 2013) and modern climate (see Hijmans et al. 2005). The fossils paleoclimate data is extracted to the closest million year paleoclimate map. Paleoclimate maps are derived at one million year intervals for the past 20 Ma. The tree (phylogeny) should be dichotomous and the species names should match the names in the first column of the occurrences argument.
cem
Estimate of climate envelope for each species in present time. A data frame containing species and min mean and max of biovars specified with which.biovars
.
geo_move
data frame of RateGeoCenter and RateGeoSize
change_geo_center
array of change in geographic center of suitable climate for each lineage
change_geo_size
array of change in geographic size of suitable climate for each lineage
time_int
matrix array of time intervals
treedata_min
list of trees with minimum bioclimatic variables
treedata_max
list of trees with maximum bioclimatic variables
node_est
list of traits at each node for all trees, min and max for each species. As estimated by nodeEstimate and nodeEstimateEnvelopes
aicmin
if model is estimated, table of aic values for minimum trait values
aicmax
if model is estimated, table of aic values for maximum trait values
A. Michelle Lawing, Alexandra F. C. Howard, Maria A. Hurtado-Materon
data(sampletrees) data(occurrences) data(scel_fossils) bounds <- list(sigsq = c(min = 0, max = 1000000)) ex_mytree <- sampletrees[[3]] #single tree test_fossil_con <- ppgmConsensus(occurrences = occurrences, fossils = scel_fossils, trees = ex_mytree, fossils.edges = FALSE, model = "BM", permut = 5, which.biovars = 1, bounds = bounds, control = list(niter = 20))
data(sampletrees) data(occurrences) data(scel_fossils) bounds <- list(sigsq = c(min = 0, max = 1000000)) ex_mytree <- sampletrees[[3]] #single tree test_fossil_con <- ppgmConsensus(occurrences = occurrences, fossils = scel_fossils, trees = ex_mytree, fossils.edges = FALSE, model = "BM", permut = 5, which.biovars = 1, bounds = bounds, control = list(niter = 20))
This creates a MESS map for given time slices, climate envelopes, and paleoclimate models.
ppgmMESS(cem_min, cem_max, est, tree, fossils=NULL, timeslice, which.biovars, path = "", use.paleoclimate=TRUE, paleoclimateUser = NULL, layerAge=c(0:20), which.plot = c("all","mess","none"))
ppgmMESS(cem_min, cem_max, est, tree, fossils=NULL, timeslice, which.biovars, path = "", use.paleoclimate=TRUE, paleoclimateUser = NULL, layerAge=c(0:20), which.plot = c("all","mess","none"))
cem_min |
the cem min output from the ppgm function. cbind() if there are multiple variables. |
cem_max |
the cem max output from the ppgm function. cbind() if there are multiple variables. |
est |
the node_est output from the ppgm function, in list format. [tree][1][min and max][no.of species] |
tree |
the phylogeny or multiple phylogenies that show the relationship between species |
fossils |
a matrix with four columns of age to the closest million year integer, longitude, and latitude, in that order, and rows that are entries for fossil occurrences. |
timeslice |
the time in million of years ago to project MESS maps (0 to 20). can handle single timeslice or vector of times. |
which.biovars |
the biovariable number(s) between 1 and 19. |
path |
directory where plots should be stored |
use.paleoclimate |
if left blank, default North America paleoclimate data is used. If FALSE, user submitted paleoclimate must be provided |
paleoclimateUser |
list of data frames with paleoclimates, must be dataframes with columns: GlobalID, Longitude, Latitude, bio1, bio2,...,bio19. |
layerAge |
vector with the ages of the paleoclimate dataframes, if using user submitted paleoclimate data |
which.plot |
"all" plots trait maps and MESS, "mess" plots MESS map, "none" does not plot |
plots MESS maps of climate envelope model for specific time slices. Can either plot individual biovariables, or combined.
list containing array of MESS scores for bioclimatic variables
A. Michelle Lawing, Alexandra F. C. Howard, Maria-Aleja Hurtado-Materon
ppgm()
data(sampletrees) data(occurrences) sampletrees <- sample(sampletrees,5) bounds <- list(sigsq = c(min = 0, max = 1000000)) test_ppgm <- ppgm(occurrences = occurrences,trees = sampletrees, model = "BM", which.biovars = c(1,4,15), bounds = bounds, control = list(niter = 20)) #extract min climate envelope for species cem_min <- cbind(test_ppgm$cem[, 1], test_ppgm$cem[, 2], test_ppgm$cem[, 3]) cem_max <- cbind(test_ppgm$cem[, 7], test_ppgm$cem[, 8], test_ppgm$cem[, 9]) rownames(cem_min) <- rownames(cem_max) <- rownames(test_ppgm$cem) mess <- ppgmMESS(cem_min,cem_max,test_ppgm$node_est,tree=sampletrees,timeslice=10, which.biovars=c(1,4,15), path=tempdir(), which.plot="none")
data(sampletrees) data(occurrences) sampletrees <- sample(sampletrees,5) bounds <- list(sigsq = c(min = 0, max = 1000000)) test_ppgm <- ppgm(occurrences = occurrences,trees = sampletrees, model = "BM", which.biovars = c(1,4,15), bounds = bounds, control = list(niter = 20)) #extract min climate envelope for species cem_min <- cbind(test_ppgm$cem[, 1], test_ppgm$cem[, 2], test_ppgm$cem[, 3]) cem_max <- cbind(test_ppgm$cem[, 7], test_ppgm$cem[, 8], test_ppgm$cem[, 9]) rownames(cem_min) <- rownames(cem_max) <- rownames(test_ppgm$cem) mess <- ppgmMESS(cem_min,cem_max,test_ppgm$node_est,tree=sampletrees,timeslice=10, which.biovars=c(1,4,15), path=tempdir(), which.plot="none")
A sample of 100 dated phylogenies from Leache & Sites (2010), trimmed for analysis by Lawing et al (2016) Lawing et al (2016) Including fossils in phylogenetic climate reconstructions: A deep time perspective on the climatic niche evolution and diversification of spiny lizards (Sceloporus) Leache & Sites (2010) Chromosome evolution and diversification in North American Spiny Lizards (Genus Sceloporus)
sampletrees
sampletrees
'sampletrees' 100 trees as class multiPhylo
<https://www.journals.uchicago.edu/doi/10.1086/687202>
<https://karger.com/cgr/article/127/2-4/166/62387/Chromosome-Evolution-and-Diversification-in-North>
Fossil occurrences for Sceloporus, as collected for Lawing et al 2016. Occurrence records from Paleobiology Database. See reference for further details Lawing et al (2016) Including fossils in phylogenetic climate reconstructions: A deep time perspective on the climatic niche evolution and diversification of spiny lizards (Sceloporus)
scel_fossils
scel_fossils
'scel_fossils' A data frame where each row is a single fossil
Minimum age of fossil
Maximum age of fossil
Longitude of occurrence
Latitude of occurence
<https://www.journals.uchicago.edu/doi/10.1086/687202>