| 1 |
head 1.5; |
| 2 |
access; |
| 3 |
symbols; |
| 4 |
locks |
| 5 |
adrian:1.5; strict; |
| 6 |
comment @# @; |
| 7 |
|
| 8 |
|
| 9 |
1.5 |
| 10 |
date 2018.06.06.08.15.34; author adrian; state Exp; |
| 11 |
branches; |
| 12 |
next 1.4; |
| 13 |
|
| 14 |
1.4 |
| 15 |
date 2018.06.06.08.05.03; author adrian; state Exp; |
| 16 |
branches; |
| 17 |
next 1.3; |
| 18 |
|
| 19 |
1.3 |
| 20 |
date 2018.03.29.13.57.43; author adrian; state Exp; |
| 21 |
branches; |
| 22 |
next 1.2; |
| 23 |
|
| 24 |
1.2 |
| 25 |
date 2014.06.09.08.37.42; author adrian; state Exp; |
| 26 |
branches; |
| 27 |
next 1.1; |
| 28 |
|
| 29 |
1.1 |
| 30 |
date 2014.06.09.04.48.21; author adrian; state Exp; |
| 31 |
branches; |
| 32 |
next ; |
| 33 |
|
| 34 |
|
| 35 |
desc |
| 36 |
@@ |
| 37 |
|
| 38 |
|
| 39 |
1.5 |
| 40 |
log |
| 41 |
@Summary: minor |
| 42 |
@ |
| 43 |
text |
| 44 |
@\name{ad.test} |
| 45 |
\alias{ad.test} |
| 46 |
\title{ |
| 47 |
Anderson-Darling Test of Goodness-of-Fit |
| 48 |
} |
| 49 |
\description{ |
| 50 |
Performs the Anderson-Darling test |
| 51 |
of goodness-of-fit to a specified continuous univariate |
| 52 |
probability distribution. |
| 53 |
} |
| 54 |
\usage{ |
| 55 |
ad.test(x, null = "punif", ..., estimated=FALSE, nullname) |
| 56 |
} |
| 57 |
\arguments{ |
| 58 |
\item{x}{ |
| 59 |
Numeric vector of data values. |
| 60 |
} |
| 61 |
\item{null}{ |
| 62 |
A function, or a character string giving the name of a function, |
| 63 |
to compute the cumulative distribution function for the |
| 64 |
null distribution. |
| 65 |
} |
| 66 |
\item{\dots}{ |
| 67 |
Additional arguments for the cumulative distribution function. |
| 68 |
} |
| 69 |
\item{estimated}{ |
| 70 |
Logical value indicating whether the parameters of the distribution |
| 71 |
were estimated using the data \code{x} (composite null hypothesis), |
| 72 |
or were fixed in advance (simple null hypothesis, the default). |
| 73 |
} |
| 74 |
\item{nullname}{ |
| 75 |
Optional character string describing the null distribution. |
| 76 |
The default is \code{"uniform distribution"}. |
| 77 |
} |
| 78 |
} |
| 79 |
\details{ |
| 80 |
This command performs the Anderson-Darling test |
| 81 |
of goodness-of-fit to the distribution specified by the argument |
| 82 |
\code{null}. It is assumed that the values in \code{x} are |
| 83 |
independent and identically distributed random values, with some |
| 84 |
cumulative distribution function \eqn{F}. |
| 85 |
The null hypothesis is that \eqn{F} is the function |
| 86 |
specified by the argument \code{null}, while the alternative |
| 87 |
hypothesis is that \eqn{F} is some other function. |
| 88 |
|
| 89 |
By default, the test assumes that all the parameters of the null |
| 90 |
distribution are known in advance (a \emph{simple} null hypothesis). |
| 91 |
This test does not account for the effect of estimating the parameters. |
| 92 |
|
| 93 |
If the parameters of the distribution were estimated (that is, |
| 94 |
if they were calculated from the same data \code{x}), |
| 95 |
then this should be indicated by setting the argument \code{estimated=TRUE}. |
| 96 |
The test will then use the adjustment method of Braun (1980) |
| 97 |
to allow for parameter estimation. Braun's method involves randomly |
| 98 |
dividing the data into two equally-sized subsets, so the \eqn{p}-value |
| 99 |
is not the same if the test is repeated. |
| 100 |
} |
| 101 |
\value{ |
| 102 |
An object of class \code{"htest"} representing the result of |
| 103 |
the hypothesis test. |
| 104 |
} |
| 105 |
\references{ |
| 106 |
Anderson, T.W. and Darling, D.A. (1952) |
| 107 |
Asymptotic theory of certain 'goodness-of-fit' criteria based |
| 108 |
on stochastic processes. |
| 109 |
\emph{Annals of Mathematical Statistics} \bold{23}, 193--212. |
| 110 |
|
| 111 |
Anderson, T.W. and Darling, D.A. (1954) |
| 112 |
A test of goodness of fit. |
| 113 |
\emph{Journal of the American Statistical Association} \bold{49}, 765--769. |
| 114 |
|
| 115 |
Braun, H. (1980) |
| 116 |
A simple method for testing goodness-of-fit in the presence of |
| 117 |
nuisance parameters. |
| 118 |
\emph{Journal of the Royal Statistical Society} \bold{42}, 53--63. |
| 119 |
|
| 120 |
Marsaglia, G. and Marsaglia, J. (2004) |
| 121 |
Evaluating the Anderson-Darling Distribution. |
| 122 |
\emph{Journal of Statistical Software} \bold{9} (2), 1--5. |
| 123 |
February 2004. |
| 124 |
\url{http://www.jstatsoft.org/v09/i02} |
| 125 |
} |
| 126 |
\author{ |
| 127 |
Original C code by George Marsaglia and John Marsaglia. |
| 128 |
\R interface by Adrian Baddeley. |
| 129 |
} |
| 130 |
\seealso{ |
| 131 |
\code{\link{pAD}} for the null distribution of the test statistic. |
| 132 |
} |
| 133 |
\examples{ |
| 134 |
x <- rnorm(10, mean=2, sd=1) |
| 135 |
ad.test(x, "pnorm", mean=2, sd=1) |
| 136 |
ad.test(x, "pnorm", mean=mean(x), sd=sd(x), estimated=TRUE) |
| 137 |
} |
| 138 |
\keyword{htest} |
| 139 |
@ |
| 140 |
|
| 141 |
|
| 142 |
1.4 |
| 143 |
log |
| 144 |
@Summary: new argument |
| 145 |
@ |
| 146 |
text |
| 147 |
@d54 3 |
| 148 |
a56 1 |
| 149 |
to allow for parameter estimation. |
| 150 |
@ |
| 151 |
|
| 152 |
|
| 153 |
1.3 |
| 154 |
log |
| 155 |
@Summary: added message about simple null |
| 156 |
@ |
| 157 |
text |
| 158 |
@d12 1 |
| 159 |
a12 1 |
| 160 |
ad.test(x, null = "punif", ..., nullname) |
| 161 |
d26 5 |
| 162 |
d46 9 |
| 163 |
a54 3 |
| 164 |
This version of the test assumes that all the parameters of the null |
| 165 |
distribution are known (a \emph{simple} null hypothesis). It does not |
| 166 |
account for the effect of estimating the parameters. |
| 167 |
d70 5 |
| 168 |
d91 1 |
| 169 |
@ |
| 170 |
|
| 171 |
|
| 172 |
1.2 |
| 173 |
log |
| 174 |
@minor |
| 175 |
@ |
| 176 |
text |
| 177 |
@d40 4 |
| 178 |
@ |
| 179 |
|
| 180 |
|
| 181 |
1.1 |
| 182 |
log |
| 183 |
@Initial revision |
| 184 |
@ |
| 185 |
text |
| 186 |
@d47 1 |
| 187 |
a47 1 |
| 188 |
Asymptotic theory of certain `goodness-of-fit’ criteria based |
| 189 |
d53 1 |
| 190 |
a53 1 |
| 191 |
\emph{Journal of the American Statistical Association} \bold{49}, 765-–769. |
| 192 |
d62 1 |
| 193 |
a62 1 |
| 194 |
C code by G. and J. Marsaglia. |
| 195 |
d69 2 |
| 196 |
a70 2 |
| 197 |
x <- runif(10) |
| 198 |
ad.test(x) |
| 199 |
a72 1 |
| 200 |
|
| 201 |
@ |