4 \title{Tests of Constant Diversification Rates}
6 diversi.gof(x, null = "exponential", z = NULL)
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
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.
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
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.
43 A NULL value is returned, the results are simply printed.
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},
51 Stephens, M. A. (1974) EDF statistics for goodness of fit and some
52 comparisons. \emph{Journal of the American Statistical Association},
55 \author{Emmanuel Paradis \email{Emmanuel.Paradis@mpl.ird.fr}}
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}}
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:
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)