Learn R Programming

RPANDA (version 1.9)

fit_t_comp_subgroup: Fits models of trait evolution incorporating competitive interactions, restricting competition to occur only between members of a subgroup

Description

Fits matching competition (MC), diversity dependent linear (DDlin), or diversity dependent exponential (DDexp) models of trait evolution to a given dataset, phylogeny, and stochastic maps of both subgroup membership and biogeography.

Usage

fit_t_comp_subgroup(full.phylo, ana.events, clado.events, stratified=FALSE, map,data, 
	trim.class, model=c("MC","DDexp","DDlin"), par=NULL, method="Nelder-Mead", 
	bounds=NULL)

Arguments

full.phylo

an object of type 'phylo' (see ape documentation) containing all of the tips used to estimate ancestral biogeography in BioGeoBEARS

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 stochastic map was built from a stratified analysis in BioGeoBEARS

map

a phylo object created using make.simmap in phytools that contains reconstructed subgroup membership

data

a named vector of trait values for subgroup members with names matching full.phylo$tip.label

trim.class

subgroup whose members are competing

model

model chosen to fit trait data, "MC" is the matching competition model of Nuismer & Harmon 2014, "DDlin" is the diversity-dependent linear model, and "DDexp" is the diversity-dependent exponential model of Weir & Mursleen 2013.

par

vector specifying starting parameter values for maximum likelihood optimization. If unspecified, default values are used (see Details)

method

optimization algorithm to use (see optim)

bounds

(optional) list of bounds to pass to optimization algorithm (see details at optim)

Value

a list with the following elements:

LH

maximum log-likelihood value

aic

Akaike Information Criterion value

aicc

AIC value corrected for small sample size

free.parameters

number of free parameters from the model

sig2

maximum-likelihood estimate of sig2 parameter

S

maximum-likelihood estimate of S parameter of matching competition model (see Note)

b

maximum-likelihood estimate of b parameter of linear diversity dependence model

r

maximum-likelihood estimate of r parameter of exponential diversity dependence model

z0

maximum-likelihood estimate of z0, the value at the root of the tree

convergence

convergence diagnostics from optim function (see optim documentation)

Details

If unspecified, par takes the default values of var(data)/max(nodeHeights(phylo)) for sig2 and 0 for either S for the matching competition model, b for the linear diversity dependence model, or r for the exponential diversity dependence model. Values can be manually entered as a vector with the first element equal to the desired starting value for sig2 and the second value equal to the desired starting value for either S, b, or r. Note: since likelihood optimization uses sig rather than sig2, and since the starting value for is exponentiated to stabilize the likelihood search, if you input a par value, the first value specifying sig2 should be the log(sqrt()) of the desired sig2 starting value.

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 16(1): e2003563.

Drury, J., Clavel, J., Manceau, M., and Morlon, H. 2016. Estimating the effect of competition on trait evolution using maximum likelihood inference. Systematic Biology 65: 700-710

Nuismer, S. & Harmon, L. 2015. Predicting rates of interspecific interaction from phylogenetic trees. Ecology Letters 18:17-27.

Weir, J. & Mursleen, S. 2012. Diversity-dependent cladogenesis and trait evolution in the adaptive radiation of the auks (Aves: Alcidae). Evolution 67:403-416.

See Also

likelihood_subgroup_model CreateGeobyClassObject fit_t_comp

Examples

Run this code
# NOT RUN {

# }
# NOT RUN {
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)

set.seed(123)
Canidae.data<-rnorm(length(Canidae.phylo$tip.label))
names(Canidae.data)<-Canidae.phylo$tip.label
Canidae.A<-Canidae.data[which(dummy.group=="A")]

fitA<-fit_t_comp_subgroup(full.phylo=Canidae.phylo,ana.events=BGB.examples$Canidae.ana.events, 
clado.events=BGB.examples$Canidae.clado.events,stratified=FALSE,map=Canidae.simmap, 
data=Canidae.A,trim.class="A",model="DDexp")
	
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab