| 1 |
head 1.3; |
| 2 |
access; |
| 3 |
symbols; |
| 4 |
locks |
| 5 |
adrian:1.3; strict; |
| 6 |
comment @# @; |
| 7 |
|
| 8 |
|
| 9 |
1.3 |
| 10 |
date 2014.06.09.08.37.37; author adrian; state Exp; |
| 11 |
branches; |
| 12 |
next 1.2; |
| 13 |
|
| 14 |
1.2 |
| 15 |
date 2014.06.09.05.02.24; author adrian; state Exp; |
| 16 |
branches; |
| 17 |
next 1.1; |
| 18 |
|
| 19 |
1.1 |
| 20 |
date 2014.06.09.04.40.36; author adrian; state Exp; |
| 21 |
branches; |
| 22 |
next ; |
| 23 |
|
| 24 |
|
| 25 |
desc |
| 26 |
@@ |
| 27 |
|
| 28 |
|
| 29 |
1.3 |
| 30 |
log |
| 31 |
@minor |
| 32 |
@ |
| 33 |
text |
| 34 |
@\name{pAD} |
| 35 |
\alias{pAD} |
| 36 |
\alias{qAD} |
| 37 |
\title{ |
| 38 |
Null Distribution of Anderson-Darling Test Statistic |
| 39 |
} |
| 40 |
\description{ |
| 41 |
\code{pAD} computes the cumulative distribution function, |
| 42 |
and \code{qAD} computes the quantile function, |
| 43 |
of the null distribution of the Anderson-Darling test |
| 44 |
statistic. |
| 45 |
} |
| 46 |
\usage{ |
| 47 |
pAD(q, n = Inf, lower.tail = TRUE, fast=TRUE) |
| 48 |
qAD(p, n = Inf, lower.tail = TRUE, fast=TRUE) |
| 49 |
} |
| 50 |
\arguments{ |
| 51 |
\item{q}{ |
| 52 |
Numeric vector of quantiles (values for which the |
| 53 |
cumulative probability is required). |
| 54 |
} |
| 55 |
\item{p}{ |
| 56 |
Numeric vector of probabilities. |
| 57 |
} |
| 58 |
\item{n}{ |
| 59 |
Integer. Sample size for the Anderson-Darling test. |
| 60 |
} |
| 61 |
\item{lower.tail}{ |
| 62 |
Logical. If \code{TRUE} (the default), |
| 63 |
probabilities are \eqn{P(X \le q)}{P(X <= q)}, |
| 64 |
and otherwise they are \eqn{P(X > q)}. |
| 65 |
} |
| 66 |
\item{fast}{ |
| 67 |
Logical value indicating whether to use a fast algorithm |
| 68 |
or a slower, more accurate algorithm, in the case \code{n=Inf}. |
| 69 |
} |
| 70 |
} |
| 71 |
\details{ |
| 72 |
\code{pAD} uses the algorithms and C code described |
| 73 |
in Marsaglia and Marsaglia (2004). |
| 74 |
|
| 75 |
\code{qAD} uses \code{\link[stats]{uniroot}} to find the |
| 76 |
quantiles. |
| 77 |
|
| 78 |
The argument \code{fast} applies only when \code{n=Inf} |
| 79 |
and determines whether the asymptotic distribution is approximated |
| 80 |
using the faster algorithm \code{adinf} (accurate to 4-5 places) |
| 81 |
or the slower algorithm \code{ADinf} (accurate to 11 places) |
| 82 |
described in Marsaglia and Marsaglia (2004). |
| 83 |
} |
| 84 |
\value{ |
| 85 |
A numeric vector of the same length as \code{p} or \code{q}. |
| 86 |
} |
| 87 |
\references{ |
| 88 |
Anderson, T.W. and Darling, D.A. (1952) |
| 89 |
Asymptotic theory of certain 'goodness-of-fit' criteria based |
| 90 |
on stochastic processes. |
| 91 |
\emph{Annals of Mathematical Statistics} \bold{23}, 193--212. |
| 92 |
|
| 93 |
Anderson, T.W. and Darling, D.A. (1954) |
| 94 |
A test of goodness of fit. |
| 95 |
\emph{Journal of the American Statistical Association} \bold{49}, 765--769. |
| 96 |
|
| 97 |
Marsaglia, G. and Marsaglia, J. (2004) |
| 98 |
Evaluating the Anderson-Darling Distribution. |
| 99 |
\emph{Journal of Statistical Software} \bold{9} (2), 1--5. |
| 100 |
February 2004. |
| 101 |
\url{http://www.jstatsoft.org/v09/i02} |
| 102 |
} |
| 103 |
\author{ |
| 104 |
Original C code by G. and J. Marsaglia. |
| 105 |
\R interface by Adrian Baddeley. |
| 106 |
} |
| 107 |
\seealso{ |
| 108 |
\code{\link{ad.test}} |
| 109 |
} |
| 110 |
\examples{ |
| 111 |
pAD(1.1, n=5) |
| 112 |
pAD(1.1) |
| 113 |
pAD(1.1, fast=FALSE) |
| 114 |
|
| 115 |
qAD(0.5, n=5) |
| 116 |
qAD(0.5) |
| 117 |
} |
| 118 |
\keyword{distribution} |
| 119 |
\keyword{htest} |
| 120 |
@ |
| 121 |
|
| 122 |
|
| 123 |
1.2 |
| 124 |
log |
| 125 |
@minor |
| 126 |
@ |
| 127 |
text |
| 128 |
@d14 2 |
| 129 |
a15 2 |
| 130 |
pAD(q, n = Inf, lower.tail = TRUE) |
| 131 |
qAD(p, n = Inf, lower.tail = TRUE) |
| 132 |
d33 4 |
| 133 |
d44 6 |
| 134 |
d78 1 |
| 135 |
d80 3 |
| 136 |
a82 1 |
| 137 |
pAD(1.1, n=5) |
| 138 |
a83 1 |
| 139 |
qAD(0.5, n=5) |
| 140 |
@ |
| 141 |
|
| 142 |
|
| 143 |
1.1 |
| 144 |
log |
| 145 |
@Initial revision |
| 146 |
@ |
| 147 |
text |
| 148 |
@d45 9 |
| 149 |
@ |