]> git.donarmstrong.com Git - ape.git/blob - man/diversi.gof.Rd
various corrections
[ape.git] / man / diversi.gof.Rd
1 \encoding{latin1}
2 \name{diversi.gof}
3 \alias{diversi.gof}
4 \title{Tests of Constant Diversification Rates}
5 \usage{
6 diversi.gof(x, null = "exponential", z = NULL)
7 }
8 \arguments{
9   \item{x}{a numeric vector with the branching times.}
10   \item{null}{a character string specifying the null distribution for
11     the branching times. Only two choices are possible: either
12     \code{"exponential"}, or \code{"user"}.}
13   \item{z}{used if \code{null = "user"}; gives the expected distribution
14     under the model.}
15 }
16 \description{
17   This function computes two tests of the distribution of branching
18   times using the \enc{Cramér}{Cramer}--von Mises and Anderson--Darling
19   goodness-of-fit tests. By default, it is assumed that the
20   diversification rate is constant, and an exponential distribution is
21   assumed for the branching times. In this case, the expected
22   distribution under this model is computed with a rate estimated from
23   the data. Alternatively, the user may specify an expected cumulative
24   density function (\code{z}): in this case, \code{x} and \code{z} must
25   be of the same length. See the examples for how to compute the latter
26   from a sample of expected branching times.
27 }
28 \details{
29   The \enc{Cramér}{Cramer}--von Mises and Anderson--Darling tests
30   compare the empirical density function (EDF) of the observations to an
31   expected cumulative density function. By contrast to the
32   Kolmogorov--Smirnov test where the greatest difference between these
33   two functions is used, in both tests all differences are taken into
34   account.
35
36   The distributions of both test statistics depend on the null
37   hypothesis, and on whether or not some parameters were estimated from
38   the data. However, these distributions are not known precisely and
39   critical values were determined by Stephens (1974) using
40   simulations. These critical values were used for the present function.
41 }
42 \value{
43   A NULL value is returned, the results are simply printed.
44 }
45 \references{
46   Paradis, E. (1998) Testing for constant diversification rates using
47   molecular phylogenies: a general approach based on statistical tests
48   for goodness of fit. \emph{Molecular Biology and Evolution},
49   \bold{15}, 476--479.
50
51   Stephens, M. A. (1974) EDF statistics for goodness of fit and some
52   comparisons. \emph{Journal of the American Statistical Association},
53   \bold{69}, 730--737.
54 }
55 \author{Emmanuel Paradis}
56 \seealso{
57   \code{\link{branching.times}}, \code{\link{diversi.time}}
58   \code{\link{ltt.plot}}, \code{\link{birthdeath}}, \code{\link{yule}},
59   \code{\link{yule.cov}}
60 }
61 \examples{
62 data(bird.families)
63 x <- branching.times(bird.families)
64 ### suppose we have a sample of expected branching times `y';
65 ### for simplicity, take them from a uniform distribution:
66 y <- runif(500, 0, max(x) + 1) # + 1 to avoid A2 = Inf
67 ### now compute the expected cumulative distribution:
68 x <- sort(x)
69 N <- length(x)
70 ecdf <- numeric(N)
71 for (i in 1:N) ecdf[i] <- sum(y <= x[i])/500
72 ### finally do the test:
73 diversi.gof(x, "user", z = ecdf)
74 }
75 \keyword{univar}