CreateGeobyClassObject: Create merged biogeography-by-class object

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/CreateGeobyClassObject.R

Description

Create a merged biogeography-by-class object to be passed to fit_t_comp_subgroup using a stochastic map created from any model in BioGeoBEARS (see documentation in BioGeoBEARS package) and a simmap object from phytools (see documentation in phytools package).

Usage

1
2
CreateGeobyClassObject(phylo,simmap,trim.class,ana.events,clado.events,
	stratified=FALSE,rnd=5)

Arguments

phylo

the object of type 'phylo' (see ape documentation) used to build ancestral range stochastic maps in BioGeoBEARS

simmap

a phylo object created using make.simmap in phytools

trim.class

category in the simmap object that represents the subgroup of interest (see Details and Examples)

ana.events

the "ana.events" table produced in BioGeoBEARS that lists anagenetic events in the stochastic map

clado.events

the "clado.events" table produced in BioGeoBEARS that lists cladogenetic events in the stochastic map

stratified

logical indicating whether the ancestral biogeography stochastic map was built from a stratified analysis in BioGeoBEARS

rnd

an integer value indicating the number of decimals to which values should be rounded in order to reconcile class and geo.objects (default is 5)

Details

This function merges a class object (which reconstructs group membership through time) and a stochastic map of ancestral biogeography (to reconstruct sympatry through time), such that lineages can only interact when they belong to the same subgroup AND are sympatric.

This allows fitting models of competition where only sympatric members of a subgroup can compete (e.g., all lineages that share similar diets or habitats).

This function should be used to format the geography object so that it can be correctly passed to the numerical integration performed in fit_t_comp_subgroup.

Value

Returns a list with the following components:

map

a simmap object with phylogeny trimmed to subgroup of interest (including all branches determined to belong to that subgroup)

geography.object

a list with the following components:

geography.matrix

a list of matrices specifying both sympatry & group membership (==1) or allopatry and/or non-membership in the focal subgroup (==0) for each species pair for each internode interval (see Details)

times

a vector containing the time since the root of the tree at which nodes or changes in biogeographyXsubgroup membership occur (used internally in other functions)

spans

a vector specifying the distances between times (used internally in other functions)

Author(s)

Jonathan Drury [email protected]

References

Drury, J., Tobias, J., Burns, K., Mason, N., Shultz, A., and Morlon, H. in review. Contrasting impacts of competition on ecological and social trait evolution in songbirds. PLOS Biology.

Drury, J., Clavel, J., Manceau, M., and Morlon, H. 2016. Estimating the effect of competition on trait evolution using maximum likelihood inference. Systematic Biology doi 10.1093/sysbio/syw020

See Also

fit_t_comp_subgroup, CreateGeoObject_BioGeoBEARS , CreateClassObject

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
data(BGB.examples)



Canidae.phylo<-BGB.examples$Canidae.phylo
dummy.group<-c(rep("B",3),rep("A",12),rep("B",2),rep("A",6),rep("B",5),rep("A",6))
names(dummy.group)<-Canidae.phylo$tip.label

Canidae.simmap<-phytools::make.simmap(Canidae.phylo,dummy.group)

#build GeobyClass object with "A" as the focal group

Canidae.geobyclass.object<-CreateGeobyClassObject(phylo=Canidae.phylo,simmap=Canidae.simmap, 
trim.class="A",ana.events=BGB.examples$Canidae.ana.events, 
clado.events=BGB.examples$Canidae.clado.events,stratified=FALSE, rnd=5)
	
plotSimmap(Canidae.geobyclass.object$map)

hmorlon/PANDA documentation built on Sept. 29, 2018, 1:02 p.m.