Learn R Programming

RPANDA (version 1.9)

fit_t_comp: Fits models of trait evolution incorporating competitive interactions

Description

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

Usage

fit_t_comp(phylo, data, model=c("MC","DDexp","DDlin"), pars=NULL, geography.object=NULL)

Arguments

phylo

an object of type 'phylo' (see ape documentation)

data

a named vector of trait values with names matching phylo$tip.label

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.

geography.object

a list of sympatry through time created using CreateGeoObject

pars

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

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., 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

sim_t_comp CreateGeoObject likelihood_t_MC likelihood_t_MC_geog likelihood_t_DD likelihood_t_DD_geog fit_t_comp_subgroup

Examples

Run this code
# NOT RUN {
data(Anolis.data)
geography.object<-Anolis.data$geography.object
pPC1<-Anolis.data$data
phylo<-Anolis.data$phylo

# }
# NOT RUN {
#Fit three models without biogeography to pPC1 data
MC.fit<-fit_t_comp(phylo, pPC1, model="MC")
DDlin.fit<-fit_t_comp(phylo, pPC1, model="DDlin")
DDexp.fit<-fit_t_comp(phylo, pPC1, model="DDexp")

#Now fit models that incorporate biogeography, NOTE these models take longer to fit
MC.geo.fit<-fit_t_comp(phylo, pPC1, model="MC", geography.object=geography.object)
DDlin.geo.fit<-fit_t_comp(phylo, pPC1,model="DDlin", geography.object=geography.object)
DDexp.geo.fit<-fit_t_comp(phylo, pPC1, model="DDexp", geography.object=geography.object)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab