{"id":580,"date":"2014-04-18T10:41:13","date_gmt":"2014-04-18T15:41:13","guid":{"rendered":"http:\/\/homepages.uc.edu\/~yaozo\/wordpress\/?p=580"},"modified":"2014-04-18T10:41:13","modified_gmt":"2014-04-18T15:41:13","slug":"moran-i-ape","status":"publish","type":"post","link":"https:\/\/zhuoyao.net\/index.php\/2014\/04\/18\/moran-i-ape\/","title":{"rendered":"Moran.I {ape}"},"content":{"rendered":"<div>\n<div>\n<div>Moran&#8217;s I Autocorrelation Index<\/div>\n<\/div>\n<\/div>\n<div>\n<div>\n<div>\n<div>\n<div>Package:<\/div>\n<p>ape<\/p><\/div>\n<\/div>\n<\/div>\n<div>\n<div>\n<div>\n<div>Version:<\/div>\n<p>3.0-11<\/p><\/div>\n<\/div>\n<\/div>\n<\/div>\n<div>\n<div>\n<h3>Description<\/h3>\n<p>This function computes Moran&#8217;s I autocorrelation coefficient of\u00a0<code>x<\/code>\u00a0giving a matrix of weights using the method described by Gittleman and Kot (1990).<\/p>\n<\/div>\n<div>\n<h3>Usage<\/h3>\n<pre>Moran.I(x, weight, scaled = FALSE, na.rm = FALSE,\n          alternative = \"two.sided\")<\/pre>\n<\/div>\n<div>\n<h3>Arguments<\/h3>\n<dl>\n<dt>x<\/dt>\n<dd>a numeric vector.<\/dd>\n<dt>weight<\/dt>\n<dd>a matrix of weights.<\/dd>\n<dt>scaled<\/dt>\n<dd>a logical indicating whether the coefficient should be scaled so that it varies between -1 and +1 (default to\u00a0<code>FALSE<\/code>).<\/dd>\n<dt>na.rm<\/dt>\n<dd>a logical indicating whether missing values should be removed.<\/dd>\n<dt>alternative<\/dt>\n<dd>a character string specifying the alternative hypothesis that is tested against the null hypothesis of no phylogenetic correlation; must be of one &#8220;two.sided&#8221;, &#8220;less&#8221;, or &#8220;greater&#8221;, or any unambiguous abbrevation of these.<\/dd>\n<\/dl>\n<\/div>\n<div>\n<h3>Details<\/h3>\n<p>The matrix\u00a0<code>weight<\/code>\u00a0is used as \u201cneighbourhood\u201d weights, and Moran&#8217;s I coefficient is computed using the formula: with<\/p>\n<ul>\n<li>yi = observations<\/li>\n<li>wij = distance weight<\/li>\n<li>n = number of observations<\/li>\n<li>S0 = \\code{sum_{i=1..n} sum{j=1..n} wij}<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>The null hypothesis of no phylogenetic correlation is tested assuming normality of I under this null hypothesis. If the observed value of I is significantly greater than the expected value, then the values of\u00a0<code>x<\/code>are positively autocorrelated, whereas if Iobserved &lt; Iexpected, this will indicate negative autocorrelation.<\/p>\n<\/div>\n<div>\n<h3>Values<\/h3>\n<p>A list containing the elements:<\/p>\n<dl>\n<dt>observed<\/dt>\n<dd>the computed Moran&#8217;s I.<\/dd>\n<dt>expected<\/dt>\n<dd>the expected value of I under the null hypothesis.<\/dd>\n<dt>sd<\/dt>\n<dd>the standard deviation of I under the null hypothesis.<\/dd>\n<dt>p.value<\/dt>\n<dd>the P-value of the test of the null hypothesis against the alternative hypothesis specified in<code>alternative<\/code>.<\/dd>\n<\/dl>\n<\/div>\n<div>\n<h3>References<\/h3>\n<p>Gittleman, J. L. and Kot, M. (1990) Adaptation: statistics and a null model for estimating phylogenetic effects.\u00a0<em>Systematic Zoology<\/em>,\u00a0<strong>39<\/strong>, 227&#8211;241.<\/p>\n<\/div>\n<div>\n<h3>See Also<\/h3>\n<p><code>weight.taxo<\/code><\/p>\n<\/div>\n<div>\n<h3>Examples<\/h3>\n<p>&nbsp;<\/p>\n<div>\n<pre>tr &lt;- rtree(30)\nx &lt;- <a href=\"http:\/\/inside-r.org\/r-doc\/stats\/rnorm\">rnorm<\/a>(30)\n## weights w[i,j] = 1\/d[i,j]:\nw &lt;- 1\/cophenetic(tr)\n## set the diagonal w[i,i] = 0 (instead of Inf...):\n<a href=\"http:\/\/inside-r.org\/r-doc\/base\/diag\">diag<\/a>(w) &lt;- 0\nMoran.I(x, w)\nMoran.I(x, w, alt = \"l\")\nMoran.I(x, w, alt = \"g\")\nMoran.I(x, w, scaled = TRUE) # usualy the same<\/pre>\n<\/div>\n<p>&nbsp;<\/p>\n<\/div>\n<div>\n<h3>Author(s)<\/h3>\n<p>Julien Dutheil\u00a0<a href=\"mailto:\/\/julien.dutheil@univ-montp2.fr\">julien.dutheil@univ-montp2.fr<\/a>\u00a0and Emmanuel Paradis<\/p>\n<\/div>\n<div>\n<p>Documentation reproduced from package ape, version 3.0-11. License: GPL (&gt;= 2)<\/p>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Moran&#8217;s I Autocorrelation Index Package: ape Version: 3.0-11 Description This function computes Moran&#8217;s I autocorrelation coefficient of\u00a0x\u00a0giving a matrix of weights using the method described&hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[],"class_list":["post-580","post","type-post","status-publish","format-standard","hentry","category-r"],"_links":{"self":[{"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/posts\/580","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/comments?post=580"}],"version-history":[{"count":0,"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/posts\/580\/revisions"}],"wp:attachment":[{"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/media?parent=580"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/categories?post=580"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/tags?post=580"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}