]> git.donarmstrong.com Git - ape.git/blob - man/MoranI.Rd
various corrections
[ape.git] / man / MoranI.Rd
1 \name{Moran.I}
2 \alias{Moran.I}
3 \title{Moran's I Autocorrelation Index}
4 \usage{
5   Moran.I(x, weight, scaled = FALSE, na.rm = FALSE,
6           alternative = "two.sided")
7 }
8 \arguments{
9   \item{x}{a numeric vector.}
10   \item{weight}{a matrix of weights.}
11   \item{scaled}{a logical indicating whether the coefficient should be
12     scaled so that it varies between -1 and +1 (default to
13     \code{FALSE}).}
14   \item{na.rm}{a logical indicating whether missing values should be
15     removed.}
16   \item{alternative}{a character string specifying the alternative
17     hypothesis that is tested against the null hypothesis of no
18     phylogenetic correlation; must be of one "two.sided", "less", or
19     "greater", or any unambiguous abbrevation of these.}
20 }
21 \description{
22   This function computes Moran's I autocorrelation coefficient of
23   \code{x} giving a matrix of weights using the method described by
24   Gittleman and Kot (1990).
25 }
26 \details{
27   The matrix \code{weight} is used as ``neighbourhood'' weights, and
28   Moran's I coefficient is computed using the formula:
29   \deqn{I = \frac{n}{S_0} \frac{\sum_{i=1}^n\sum_{j=1}^n w_{i,j}(y_i -
30       \overline{y})(y_j - \overline{y})}{\sum_{i=1}^n {(y_i -
31         \overline{y})}^2}}{\code{I = n/S0 * (sum\{i=1..n\} sum\{j=1..n\} wij(yi - ym))(yj - ym)
32       / (sum\{i=1..n\} (yi - ym)^2)}}
33   with
34   \itemize{
35     \item \eqn{y_i}{yi} = observations
36     \item \eqn{w_{i,j}}{wij} = distance weight
37     \item \eqn{n} = number of observations
38     \item \eqn{S_0}{S0} = \eqn{\sum_{i=1}^n\sum_{j=1}^n wij}{\code{sum_{i=1..n} sum{j=1..n} wij}}
39   }
40
41   The null hypothesis of no phylogenetic correlation is tested assuming
42   normality of I under this null hypothesis. If the observed value
43   of I is significantly greater than the expected value, then the values
44   of \code{x} are positively autocorrelated, whereas if Iobserved <
45   Iexpected, this will indicate negative autocorrelation.
46 }
47 \value{
48   A list containing the elements:
49
50   \item{observed}{the computed Moran's I.}
51   \item{expected}{the expected value of I under the null hypothesis.}
52   \item{sd}{the standard deviation of I under the null hypothesis.}
53   \item{p.value}{the P-value of the test of the null hypothesis against
54     the alternative hypothesis specified in \code{alternative}.}
55 }
56 \references{
57   Gittleman, J. L. and Kot, M. (1990) Adaptation: statistics and a null
58   model for estimating phylogenetic effects. \emph{Systematic Zoology},
59   \bold{39}, 227--241.
60 }
61 \author{Julien Dutheil \email{julien.dutheil@univ-montp2.fr} and
62   Emmanuel Paradis}
63 \seealso{
64   \code{\link{weight.taxo}}
65 }
66 \examples{
67 tr <- rtree(30)
68 x <- rnorm(30)
69 ## weights w[i,j] = 1/d[i,j]:
70 w <- 1/cophenetic(tr)
71 ## set the diagonal w[i,i] = 0 (instead of Inf...):
72 diag(w) <- 0
73 Moran.I(x, w)
74 Moran.I(x, w, alt = "l")
75 Moran.I(x, w, alt = "g")
76 Moran.I(x, w, scaled = TRUE) # usualy the same
77 }
78 \keyword{models}
79 \keyword{regression}