1 ## gammaStat.R (2009-05-10)
3 ## Gamma-Statistic of Pybus and Harvey
5 ## Copyright 2002-2009 Emmanuel Paradis
7 ## This file is part of the R-package `ape'.
8 ## See the file ../COPYING for licensing issues.
10 gammaStat <- function(phy)
12 if (!inherits(phy, "phylo")) stop('object "phy" is not of class "phylo"')
13 N <- length(phy$tip.label)
14 bt <- sort(branching.times(phy))
15 g <- rev(c(bt[1], diff(bt))) # internode intervals are from past to present
17 stat <- sum(cumsum((2:(N - 1)) * g[-(N - 1)]))/(N - 2)
19 s <- ST * sqrt(1/(12 * (N - 2)))