K {adiv} | R Documentation |

The functions `K`

, `Kstar`

and `Kw`

calculate Blomberg et al. (2003) statistics *K*, and *K** and Pavoine and Ricotta (2013) statistic *Kw*, respectively. Then they perform a permutation test where species identities are maintained in the phylogeny while the trait values of species are randomly shuffled (permuted) (Pavoine and Ricotta 2013).

K(phyl, trait, nrep = 999, alter = c("greater", "less", "two-sided")) Kstar(phyl, trait, nrep = 999, alter = c("greater", "less", "two-sided")) Kw(phyl, trait, nrep = 999, alter = c("greater", "less", "two-sided"))

`phyl` |
an object inheriting the class |

`trait` |
a vector with the trait value for each species (tip) in the phylogenetic tree. Trait values for species must be in the same order as species in the phylogenetic tree. |

`nrep` |
a numeric: the number of randomizations. |

`alter` |
a string specifying the alternative hypothesis; it must be one of |

Blomberg et al. (2003) introduced two statistics of phylogenetic signal:

*K = MSE0 / MSE*

*K* = MSE* / MSE*

where *MSE* is the mean squared error of the trait values calculated using the variance-covariance matrix derived from the phylogenetic tree, *MSE0* is the mean squared error of the tip trait values, measured from a phylogenetically correct mean of tip trait values and *MSE** is the mean squared error of the tip trait values, measured from the estimate of the mean of the raw tip trait values. In both statistics *K* and *K**, the value of *MSE* will be relatively small if the phylogenetic tree accurately describes the variance-covariance pattern observed in the data, leading to high values for *K* and *K** (meaning high phylogenetic signal). In functions `K`

and `Kstar`

, *K* and *K**, respectively, are divided (normalized) by their expected value if the trait evolved under a Brownian motion along the branches of the phylogenetic tree (this expected value is invariant under permutation of trait values among the tips of the phylogeny).

To test for phylogenetic signal, Blomberg et al. (2003) actually considered neither *K* nor *K** but *MSE* as the core statistic associated with random permutations of trait values among tips of the phylogenetic tree. Although the literature on phylogenetic signal has currently mostly ignored *K** focusing on statistic *K*, *K** could thus actually have been considered as the core statistic of Blomberg et al. (2003) test for phylogenetic signal. Indeed, as *MSE** is independent of permutations of trait values among the tips of the phylogeny while *MSE0* is, Blomberg et al. (2003) approach corresponds to considering *K** and not *K* as the statistic of the test of phylogenetic signal in traits. This test is also equivalent to an alternative implemented via phylogenetically independent contrasts also proposed by Blomberg et al. (2003).

Function `KW`

implements index *Kw*, a modified version of *K** that grants a higher importance in the calculation of phylogenetic signal to the tips that have many closely related tips (Pavoine and Ricotta 2013).

In functions, `K`

, `Kstar`

and `Kw`

, I considered the same permutation scheme as in Blomberg et al. (2003) but used *K*, *K** and *Kw*, as the core statistic, respectively. The test developed by Blomberg et al. (2003) thus corresponds to function `Kstar`

.

Each function returns an object of class `randtest`

with the results of the permutation tests. (see function `randtest`

in package ade4)

Sandrine Pavoine sandrine.pavoine@mnhn.fr

Blomberg, S.P., Garland, T., Ives, A.R. (2003) Testing for phylogenetic signal in comparative data: behavioral traits are more labile. *Evolution*, **57**, 717–745.

Pavoine, S., Ricotta, C. (2013) Testing for phylogenetic signal in biological traits: the ubiquity of cross-product statistics. *Evolution*, **67**, 828–840.

## Not run: if(require(ape) && require(ade4)){ data(rockfish) phy <- read.tree(text=rockfish$tre) theK <- K(phy, rockfish$traits[phy$tip.label, 1]) theK plot(theK) theKstar <- Kstar(phy, rockfish$traits[phy$tip.label, 1]) theKstar plot(theKstar) theKw <- Kw(phy, rockfish$traits[phy$tip.label, 1]) theKw plot(theKw) } ## End(Not run)

[Package *adiv* version 2.1.1 Index]