Last chance! 50% off unlimited learning
Sale ends in
Performs Anderson-Darling k-sample test.
adKSampleTest(x, ...)# S3 method for default
adKSampleTest(x, g, ...)
# S3 method for formula
adKSampleTest(formula, data, subset, na.action, ...)
a numeric vector of data values, or a list of numeric data vectors.
further arguments to be passed to or from methods.
a vector or factor object giving the group for the
corresponding elements of "x"
.
Ignored with a warning if "x"
is a list.
a formula of the form response ~ group
where
response
gives the data values and group
a vector or
factor of the corresponding groups.
an optional matrix or data frame (or similar: see
model.frame
) containing the variables in the
formula formula
. By default the variables are taken from
environment(formula)
.
an optional vector specifying a subset of observations to be used.
a function which indicates what should happen when
the data contain NA
s. Defaults to getOption("na.action")
.
A list with class "htest"
containing the following components:
a character string indicating what type of test was performed.
a character string giving the name(s) of the data.
the estimated quantile of the test statistic.
the p-value for the test.
the parameters of the test statistic, if any.
a character string describing the alternative hypothesis.
the estimates, if any.
the estimate under the null hypothesis, if any.
The null hypothesis, H
This function only evaluates version 1 of the k-sample Anderson-Darling
test (i.e. Eq. 6) of Scholz and Stephens (1987).
The p-values are estimated with the extended empirical function
as implemented in ad.pval
of
the package kSamples.
Scholz, F.W., Stephens, M.A. (1987) K-Sample Anderson-Darling Tests. Journal of the American Statistical Association 82, 918--924.
# NOT RUN {
## Hollander & Wolfe (1973), 116.
## Mucociliary efficiency from the rate of removal of dust in normal
## subjects, subjects with obstructive airway disease, and subjects
## with asbestosis.
x <- c(2.9, 3.0, 2.5, 2.6, 3.2) # normal subjects
y <- c(3.8, 2.7, 4.0, 2.4) # with obstructive airway disease
z <- c(2.8, 3.4, 3.7, 2.2, 2.0) # with asbestosis
g <- factor(x = c(rep(1, length(x)),
rep(2, length(y)),
rep(3, length(z))),
labels = c("ns", "oad", "a"))
dat <- data.frame(
g = g,
x = c(x, y, z))
## AD-Test
adKSampleTest(x ~ g, data = dat)
## BWS-Test
bwsKSampleTest(x ~ g, data = dat)
## Kruskal-Test
## Using incomplete beta approximation
kruskalTest(x ~ g, dat, dist="KruskalWallis")
## Using chisquare distribution
kruskalTest(x ~ g, dat, dist="Chisquare")
# }
# NOT RUN {
## Check with kruskal.test from R stats
kruskal.test(x ~ g, dat)
# }
# NOT RUN {
## Using Conover's F
kruskalTest(x ~ g, dat, dist="FDist")
# }
# NOT RUN {
## Check with aov on ranks
anova(aov(rank(x) ~ g, dat))
## Check with oneway.test
oneway.test(rank(x) ~ g, dat, var.equal = TRUE)
# }
Run the code above in your browser using DataLab