getAIC: Akaike's Information Criterion for SURFACE Models

Description Usage Arguments Details Value Author(s) References Examples

View source: R/getAIC.R

Description

Calculates AICc for a Hansen model using combined likelihoods across multiple traits

Usage

1
2
getAIC(L, np, n, AICc = TRUE)
npSurface(fit)

Arguments

fit

Fitted Hansen model object (the list returned by one iteration of surfaceForward or surfaceBackward

L

Log-likelihood of the model

np

Number of parameters in the model

n

Sample size (total number of trait values)

AICc

A logical indicating whether to use small-sample size corrected AIC; defaults to TRUE, and is currently set to TRUE during all calls within the surface functions

Details

The number of parameters is calculated as p = k + (k' + 2) m, where k is the number of regime shifts, k' is the number of distinct regimes, and m is the number of traits. Note that this differs from many applications of Hansen models, in that SURFACE counts regime shifts as "parameters", modeling the complexity of both the adaptive landscape (number of regimes) and the evolutionary history of the clade (number of regime shifts). For AICc, the sample size is taken to be the total number of trait values mn, where n is the number of taxa

Value

npSurface returns an integer number of parameters. getAIC returns a numeric AIC or AICc value

Author(s)

Travis Ingram

References

Ingram, T. & Mahler, D.L. (2013) SURFACE: detecting convergent evolution from comparative data by fitting Ornstein-Uhlenbeck models with stepwise AIC. Methods in Ecology and Evolution 4: 416-425.

Examples

1
2
3
4
5
6
7
8
9
data(surfaceDemo)
tree<-surfaceDemo$tree
dat<-surfaceDemo$sim$dat
olist<-convertTreeData(tree,dat)
otree<-olist[[1]]; odata<-olist[[2]]
startmod<-startingModel(otree, odata, shifts = c("6"="b")) 
np<-as.numeric(npSurface(startmod[[1]]))
LnL<-sum(sapply(startmod[[1]]$fit, function(x) summary(x)$loglik))
getAIC(LnL,np,n=ncol(dat)*nrow(dat),AICc=TRUE)

surface documentation built on Dec. 18, 2020, 5:08 p.m.