Title: | Calculate Pairwise Multiple Comparisons of Mean Rank Sums Extended |
---|---|
Description: | For one-way layout experiments the one-way ANOVA can be performed as an omnibus test. All-pairs multiple comparisons tests (Tukey-Kramer test, Scheffe test, LSD-test) and many-to-one tests (Dunnett test) for normally distributed residuals and equal within variance are available. Furthermore, all-pairs tests (Games-Howell test, Tamhane's T2 test, Dunnett T3 test, Ury-Wiggins-Hochberg test) and many-to-one (Tamhane-Dunnett Test) for normally distributed residuals and heterogeneous variances are provided. Van der Waerden's normal scores test for omnibus, all-pairs and many-to-one tests is provided for non-normally distributed residuals and homogeneous variances. The Kruskal-Wallis, BWS and Anderson-Darling omnibus test and all-pairs tests (Nemenyi test, Dunn test, Conover test, Dwass-Steele-Critchlow- Fligner test) as well as many-to-one (Nemenyi test, Dunn test, U-test) are given for the analysis of variance by ranks. Non-parametric trend tests (Jonckheere test, Cuzick test, Johnson-Mehrotra test, Spearman test) are included. In addition, a Friedman-test for one-way ANOVA with repeated measures on ranks (CRBD) and Skillings-Mack test for unbalanced CRBD is provided with consequent all-pairs tests (Nemenyi test, Siegel test, Miller test, Conover test, Exact test) and many-to-one tests (Nemenyi test, Demsar test, Exact test). A trend can be tested with Pages's test. Durbin's test for a two-way balanced incomplete block design (BIBD) is given in this package as well as Gore's test for CRBD with multiple observations per cell is given. Outlier tests, Mandel's k- and h statistic as well as functions for Type I error and Power analysis as well as generic summary, print and plot methods are provided. |
Authors: | Thorsten Pohlert [aut, cre] |
Maintainer: | Thorsten Pohlert <[email protected]> |
License: | GPL (>= 3) |
Version: | 1.9.12 |
Built: | 2024-12-08 07:18:52 UTC |
Source: | CRAN |
Performs Anderson-Darling all-pairs comparison test.
adAllPairsTest(x, ...) ## Default S3 method: adAllPairsTest(x, g, p.adjust.method = p.adjust.methods, ...) ## S3 method for class 'formula' adAllPairsTest( formula, data, subset, na.action, p.adjust.method = p.adjust.methods, ... )
adAllPairsTest(x, ...) ## Default S3 method: adAllPairsTest(x, g, p.adjust.method = p.adjust.methods, ...) ## S3 method for class 'formula' adAllPairsTest( formula, data, subset, na.action, p.adjust.method = p.adjust.methods, ... )
x |
a numeric vector of data values, or a list of numeric data vectors. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
p.adjust.method |
method for adjusting p values (see |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
For all-pairs comparisons in an one-factorial layout
with non-normally distributed residuals Anderson-Darling's
all-pairs comparison test can be used. A total of
hypotheses can be tested. The null hypothesis
H
is tested in the two-tailed test
against the alternative
A
.
This function is a wrapper function that sequentially
calls adKSampleTest
for each pair.
The calculated p-values for Pr(>|T2N|)
can be adjusted to account for Type I error multiplicity
using any method as implemented in p.adjust
.
A list with class "PMCMR"
containing the following components:
a character string indicating what type of test was performed.
a character string giving the name(s) of the data.
lower-triangle matrix of the estimated quantiles of the pairwise test statistics.
lower-triangle matrix of the p-values for the pairwise tests.
a character string describing the alternative hypothesis.
a character string describing the method for p-value adjustment.
a data frame of the input data.
a string that denotes the test distribution.
Scholz, F.W., Stephens, M.A. (1987) K-Sample Anderson-Darling Tests. Journal of the American Statistical Association 82, 918–924.
adKSampleTest
, adManyOneTest
,
ad.pval
.
adKSampleTest(count ~ spray, InsectSprays) out <- adAllPairsTest(count ~ spray, InsectSprays, p.adjust="holm") summary(out) summaryGroup(out)
adKSampleTest(count ~ spray, InsectSprays) out <- adAllPairsTest(count ~ spray, InsectSprays, p.adjust="holm") summary(out) summaryGroup(out)
Performs Anderson-Darling k-sample test.
adKSampleTest(x, ...) ## Default S3 method: adKSampleTest(x, g, ...) ## S3 method for class 'formula' adKSampleTest(formula, data, subset, na.action, ...)
adKSampleTest(x, ...) ## Default S3 method: adKSampleTest(x, g, ...) ## S3 method for class 'formula' adKSampleTest(formula, data, subset, na.action, ...)
x |
a numeric vector of data values, or a list of numeric data vectors. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
The null hypothesis, H
is tested against the alternative,
H
, with at least
one unequality beeing strict.
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.
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.
Scholz, F.W., Stephens, M.A. (1987) K-Sample Anderson-Darling Tests. Journal of the American Statistical Association 82, 918–924.
adAllPairsTest
, adManyOneTest
,
ad.pval
.
## 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) ## End(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) ## End(Not run) ## Median Test asymptotic medianTest(x ~ g, dat) ## Median Test with simulated p-values set.seed(112) medianTest(x ~ g, dat, simulate.p.value = TRUE)
## 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) ## End(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) ## End(Not run) ## Median Test asymptotic medianTest(x ~ g, dat) ## Median Test with simulated p-values set.seed(112) medianTest(x ~ g, dat, simulate.p.value = TRUE)
Performs Anderson-Darling many-to-one comparison test.
adManyOneTest(x, ...) ## Default S3 method: adManyOneTest(x, g, p.adjust.method = p.adjust.methods, ...) ## S3 method for class 'formula' adManyOneTest( formula, data, subset, na.action, p.adjust.method = p.adjust.methods, ... )
adManyOneTest(x, ...) ## Default S3 method: adManyOneTest(x, g, p.adjust.method = p.adjust.methods, ...) ## S3 method for class 'formula' adManyOneTest( formula, data, subset, na.action, p.adjust.method = p.adjust.methods, ... )
x |
a numeric vector of data values, or a list of numeric data vectors. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
p.adjust.method |
method for adjusting
p values (see |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
For many-to-one comparisons (pairwise comparisons with one control)
in an one-factorial layout with non-normally distributed
residuals Anderson-Darling's non-parametric test can be performed.
Let there be groups including the control,
then the number of treatment levels is
.
Then
pairwise comparisons can be performed between
the
-th treatment level and the control.
H
is tested in the two-tailed case against
A
.
This function is a wrapper function that sequentially
calls adKSampleTest
for each pair.
The calculated p-values for Pr(>|T2N|)
can be adjusted to account for Type I error inflation
using any method as implemented in p.adjust
.
A list with class "PMCMR"
containing the following components:
a character string indicating what type of test was performed.
a character string giving the name(s) of the data.
lower-triangle matrix of the estimated quantiles of the pairwise test statistics.
lower-triangle matrix of the p-values for the pairwise tests.
a character string describing the alternative hypothesis.
a character string describing the method for p-value adjustment.
a data frame of the input data.
a string that denotes the test distribution.
Factor labels for g
must be assigned in such a way,
that they can be increasingly ordered from zero-dose
control to the highest dose level, e.g. integers
{0, 1, 2, ..., k} or letters {a, b, c, ...}.
Otherwise the function may not select the correct values
for intended zero-dose control.
It is safer, to i) label the factor levels as given above,
and to ii) sort the data according to increasing dose-levels
prior to call the function (see order
, factor
).
Scholz, F.W., Stephens, M.A. (1987) K-Sample Anderson-Darling Tests. Journal of the American Statistical Association 82, 918–924.
adKSampleTest
, adAllPairsTest
,
ad.pval
.
## Data set PlantGrowth ## Global test adKSampleTest(weight ~ group, data = PlantGrowth) ## ans <- adManyOneTest(weight ~ group, data = PlantGrowth, p.adjust.method = "holm") summary(ans)
## Data set PlantGrowth ## Global test adKSampleTest(weight ~ group, data = PlantGrowth) ## ans <- adManyOneTest(weight ~ group, data = PlantGrowth, p.adjust.method = "holm") summary(ans)
A dose-response experiment was conducted using Atrazine at 9 different dose-levels including the zero-dose control and the biomass of algae (Selenastrum capricornutum) as the response variable. Three replicates were measured at day 0, 1 and 2. The fluorescence method (Mayer et al. 1997) was applied to measure biomass.
A data frame with 22 observations on the following 10 variables.
a numeric vector of dose value in mg / L
a numeric vector, total biomass
a numeric vector, total biomass
a numeric vector, total biomass
a numeric vector, total biomass
a numeric vector, total biomass
a numeric vector, total biomass
a numeric vector, total biomass
a numeric vector, total biomass
a numeric vector, total biomass
ENV/JM/MONO(2006)18/ANN, page 24.
OECD (ed. 2006) Current approaches in the statistical analysis of ecotoxicity data: A guidance to application - Annexes, OECD Series on testing and assessment, No. 54, (ENV/JM/MONO(2006)18/ANN).
demo(algae)
Plots a bar-plot for objects of class "PMCMR"
.
barPlot(x, alpha = 0.05, ...)
barPlot(x, alpha = 0.05, ...)
x |
an object of class |
alpha |
the selected alpha-level. Defaults to 0.05. |
... |
further arguments for method |
A barplot where the height of the bars corresponds to the arithmetic
mean. The extend of the whiskers are , where the latter denotes the standard error
of the
th group. Symbolic letters are depicted on top of the bars,
whereas different letters indicate significant differences between
groups for the selected level of alpha.
The barplot is strictly spoken only valid for normal data, as the depicted significance intervall implies symetry.
## data set chickwts ans <- tukeyTest(weight ~ feed, data = chickwts) barPlot(ans)
## data set chickwts ans <- tukeyTest(weight ~ feed, data = chickwts) barPlot(ans)
Performs Baumgartner-Weiß-Schindler all-pairs comparison test.
bwsAllPairsTest(x, ...) ## Default S3 method: bwsAllPairsTest( x, g, method = c("BWS", "Murakami"), p.adjust.method = p.adjust.methods, ... ) ## S3 method for class 'formula' bwsAllPairsTest( formula, data, subset, na.action, method = c("BWS", "Murakami"), p.adjust.method = p.adjust.methods, ... )
bwsAllPairsTest(x, ...) ## Default S3 method: bwsAllPairsTest( x, g, method = c("BWS", "Murakami"), p.adjust.method = p.adjust.methods, ... ) ## S3 method for class 'formula' bwsAllPairsTest( formula, data, subset, na.action, method = c("BWS", "Murakami"), p.adjust.method = p.adjust.methods, ... )
x |
a numeric vector of data values, or a list of numeric data vectors. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
method |
a character string specifying the test statistic to use. Defaults to |
p.adjust.method |
method for adjusting p values (see |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
For all-pairs comparisons in an one-factorial layout
with non-normally distributed residuals Baumgartner-Weiß-Schindler
all-pairs comparison test can be used. A total of
hypotheses can be tested. The null hypothesis
H
is tested in the two-tailed test
against the alternative
A
.
This function is a wrapper function that sequentially
calls bws_test
for each pair.
The default test method ("BWS"
) is the original
Baumgartner-Weiß-Schindler test statistic B. For
method == "Murakami"
it is the modified BWS statistic
denoted B*. The calculated p-values for Pr(>|B|)
or Pr(>|B*|)
can be adjusted to account for Type I error
inflation using any method as implemented in p.adjust
.
A list with class "PMCMR"
containing the following components:
a character string indicating what type of test was performed.
a character string giving the name(s) of the data.
lower-triangle matrix of the estimated quantiles of the pairwise test statistics.
lower-triangle matrix of the p-values for the pairwise tests.
a character string describing the alternative hypothesis.
a character string describing the method for p-value adjustment.
a data frame of the input data.
a string that denotes the test distribution.
Baumgartner, W., Weiss, P., Schindler, H. (1998) A nonparametric test for the general two-sample problem, Biometrics 54, 1129–1135.
Murakami, H. (2006) K-sample rank test based on modified Baumgartner statistic and its power comparison, J. Jpn. Comp. Statist. 19, 1–13.
out <- bwsAllPairsTest(count ~ spray, InsectSprays, p.adjust="holm") summary(out) summaryGroup(out)
out <- bwsAllPairsTest(count ~ spray, InsectSprays, p.adjust="holm") summary(out) summaryGroup(out)
Performs Murakami's k-Sample BWS Test.
bwsKSampleTest(x, ...) ## Default S3 method: bwsKSampleTest(x, g, nperm = 1000, ...) ## S3 method for class 'formula' bwsKSampleTest(formula, data, subset, na.action, nperm = 1000, ...)
bwsKSampleTest(x, ...) ## Default S3 method: bwsKSampleTest(x, g, nperm = 1000, ...) ## S3 method for class 'formula' bwsKSampleTest(formula, data, subset, na.action, nperm = 1000, ...)
x |
a numeric vector of data values, or a list of numeric data vectors. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
nperm |
number of permutations for the assymptotic permutation test.
Defaults to |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
Let denote an
identically and independently distributed variable that is obtained
from an unknown continuous distribution
. Let
be the rank of
, where
is jointly ranked
from
to
.
In the
-sample test the null hypothesis, H:
is tested against the alternative,
A:
with at least one inequality
beeing strict. Murakami (2006) has generalized
the two-sample Baumgartner-Weiß-Schindler test
(Baumgartner et al. 1998) and proposed a
modified statistic
defined by
where
and
The -values are estimated via an assymptotic boot-strap method.
It should be noted that the
detects both differences in the
unknown location parameters and / or differences
in the unknown scale parameters of the
-samples.
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.
One may increase the number of permutations to e.g. nperm = 10000
in order to get more precise p-values. However, this will be on
the expense of computational time.
Baumgartner, W., Weiss, P., Schindler, H. (1998) A nonparametric test for the general two-sample problem, Biometrics 54, 1129–1135.
Murakami, H. (2006) K-sample rank test based on modified Baumgartner statistic and its power comparison, J. Jpn. Comp. Statist. 19, 1–13.
sample
, bwsAllPairsTest
,
bwsManyOneTest
.
## 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) ## End(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) ## End(Not run) ## Median Test asymptotic medianTest(x ~ g, dat) ## Median Test with simulated p-values set.seed(112) medianTest(x ~ g, dat, simulate.p.value = TRUE)
## 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) ## End(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) ## End(Not run) ## Median Test asymptotic medianTest(x ~ g, dat) ## Median Test with simulated p-values set.seed(112) medianTest(x ~ g, dat, simulate.p.value = TRUE)
Performs Baumgartner-Weiß-Schindler many-to-one comparison test.
bwsManyOneTest(x, ...) ## Default S3 method: bwsManyOneTest( x, g, alternative = c("two.sided", "greater", "less"), method = c("BWS", "Murakami", "Neuhauser"), p.adjust.method = p.adjust.methods, ... ) ## S3 method for class 'formula' bwsManyOneTest( formula, data, subset, na.action, alternative = c("two.sided", "greater", "less"), method = c("BWS", "Murakami", "Neuhauser"), p.adjust.method = p.adjust.methods, ... )
bwsManyOneTest(x, ...) ## Default S3 method: bwsManyOneTest( x, g, alternative = c("two.sided", "greater", "less"), method = c("BWS", "Murakami", "Neuhauser"), p.adjust.method = p.adjust.methods, ... ) ## S3 method for class 'formula' bwsManyOneTest( formula, data, subset, na.action, alternative = c("two.sided", "greater", "less"), method = c("BWS", "Murakami", "Neuhauser"), p.adjust.method = p.adjust.methods, ... )
x |
a numeric vector of data values, or a list of numeric data vectors. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
alternative |
the alternative hypothesis. Defaults to |
method |
a character string specifying the test statistic to use. Defaults to |
p.adjust.method |
method for adjusting p values (see |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
For many-to-one comparisons (pairwise comparisons with one control)
in an one-factorial layout with non-normally distributed
residuals Baumgartner-Weiß-Schindler's non-parametric test can be performed.
Let there be groups including the control,
then the number of treatment levels is
.
Then
pairwise comparisons can be performed between
the
-th treatment level and the control.
H
is tested in the two-tailed case against
A
.
This function is a wrapper function that sequentially
calls bws_stat
and bws_cdf
for each pair. For the default test method ("BWS"
) the original
Baumgartner-Weiß-Schindler test statistic B and its corresponding Pr(>|B|)
is calculated. For method == "BWS"
only a two-sided test is possible.
For method == "Murakami"
the modified BWS statistic
denoted B* and its corresponding Pr(>|B*|) is computed by sequentially calling
murakami_stat
and murakami_cdf
.
For method == "Murakami"
only a two-sided test is possible.
If alternative == "greater"
then the alternative, if one
population is stochastically larger than the other is tested:
H against A
.
The modified test-statistic B* according to Neuhäuser (2001) and its
corresponding Pr(>B*) or Pr(<B*) is computed by sequentally calling
murakami_stat
and murakami_cdf
with flavor = 2
.
The p-values can be adjusted to account for Type I error
inflation using any method as implemented in p.adjust
.
A list with class "PMCMR"
containing the following components:
a character string indicating what type of test was performed.
a character string giving the name(s) of the data.
lower-triangle matrix of the estimated quantiles of the pairwise test statistics.
lower-triangle matrix of the p-values for the pairwise tests.
a character string describing the alternative hypothesis.
a character string describing the method for p-value adjustment.
a data frame of the input data.
a string that denotes the test distribution.
Factor labels for g
must be assigned in such a way,
that they can be increasingly ordered from zero-dose
control to the highest dose level, e.g. integers
{0, 1, 2, ..., k} or letters {a, b, c, ...}.
Otherwise the function may not select the correct values
for intended zero-dose control.
It is safer, to i) label the factor levels as given above,
and to ii) sort the data according to increasing dose-levels
prior to call the function (see order
, factor
).
Baumgartner, W., Weiss, P., Schindler, H. (1998) A nonparametric test for the general two-sample problem, Biometrics 54, 1129–1135.
Murakami, H. (2006) K-sample rank test based on modified Baumgartner statistic and its power comparison, J Jpn Comp Statist 19, 1–13.
Neuhäuser, M. (2001) One-Side Two-Sample and Trend Tests Based on a Modified Baumgartner-Weiss-Schindler Statistic. J Nonparametric Stat 13, 729–739.
murakami_stat
, murakami_cdf
,
bws_stat
, bws_cdf
.
out <- bwsManyOneTest(weight ~ group, PlantGrowth, p.adjust="holm") summary(out) ## A two-sample test set.seed(1245) x <- c(rnorm(20), rnorm(20,0.3)) g <- gl(2, 20) summary(bwsManyOneTest(x ~ g, alternative = "less", p.adjust="none")) summary(bwsManyOneTest(x ~ g, alternative = "greater", p.adjust="none")) ## Not run: ## Check with the implementation in package BWStest BWStest::bws_test(x=x[g==1], y=x[g==2], alternative = "less") BWStest::bws_test(x=x[g==1], y=x[g==2], alternative = "greater") ## End(Not run)
out <- bwsManyOneTest(weight ~ group, PlantGrowth, p.adjust="holm") summary(out) ## A two-sample test set.seed(1245) x <- c(rnorm(20), rnorm(20,0.3)) g <- gl(2, 20) summary(bwsManyOneTest(x ~ g, alternative = "less", p.adjust="none")) summary(bwsManyOneTest(x ~ g, alternative = "greater", p.adjust="none")) ## Not run: ## Check with the implementation in package BWStest BWStest::bws_test(x=x[g==1], y=x[g==2], alternative = "less") BWStest::bws_test(x=x[g==1], y=x[g==2], alternative = "greater") ## End(Not run)
Performs Murakami's modified Baumgartner-Weiß-Schindler test for testing against ordered alternatives.
bwsTrendTest(x, ...) ## Default S3 method: bwsTrendTest(x, g, nperm = 1000, ...) ## S3 method for class 'formula' bwsTrendTest(formula, data, subset, na.action, nperm = 1000, ...)
bwsTrendTest(x, ...) ## Default S3 method: bwsTrendTest(x, g, nperm = 1000, ...) ## S3 method for class 'formula' bwsTrendTest(formula, data, subset, na.action, nperm = 1000, ...)
x |
a numeric vector of data values, or a list of numeric data vectors. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
nperm |
number of permutations for the assymptotic permutation test.
Defaults to |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
The null hypothesis, H
is tested against a simple order hypothesis,
H
.
The p-values are estimated through an assymptotic boot-strap method
using the function sample
.
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.
One may increase the number of permutations to e.g. nperm = 10000
in order to get more precise p-values. However, this will be on
the expense of computational time.
Factor labels for g
must be assigned in such a way,
that they can be increasingly ordered from zero-dose
control to the highest dose level, e.g. integers
{0, 1, 2, ..., k} or letters {a, b, c, ...}.
Otherwise the function may not select the correct values
for intended zero-dose control.
It is safer, to i) label the factor levels as given above,
and to ii) sort the data according to increasing dose-levels
prior to call the function (see order
, factor
).
Baumgartner, W., Weiss, P., Schindler, H. (1998) A nonparametric test for the general two-sample problem, Biometrics 54, 1129–1135.
Murakami, H. (2006) K-sample rank test based on modified Baumgartner statistic and its power comparison, J Jpn Comp Statist 19, 1–13.
Neuhäuser, M. (2001) One-Side Two-Sample and Trend Tests Based on a Modified Baumgartner-Weiss-Schindler Statistic. J Nonparametric Stat 13, 729–739.
sample
, bwsAllPairsTest
,
bwsManyOneTest
.
kruskalTest
and shirleyWilliamsTest
of the package PMCMRplus,
kruskal.test
of the library stats.
## Example from Sachs (1997, p. 402) x <- c(106, 114, 116, 127, 145, 110, 125, 143, 148, 151, 136, 139, 149, 160, 174) g <- gl(3,5) levels(g) <- c("A", "B", "C") ## Chacko's test chackoTest(x, g) ## Cuzick's test cuzickTest(x, g) ## Johnson-Mehrotra test johnsonTest(x, g) ## Jonckheere-Terpstra test jonckheereTest(x, g) ## Le's test leTest(x, g) ## Spearman type test spearmanTest(x, g) ## Murakami's BWS trend test bwsTrendTest(x, g) ## Fligner-Wolfe test flignerWolfeTest(x, g) ## Shan-Young-Kang test shanTest(x, g)
## Example from Sachs (1997, p. 402) x <- c(106, 114, 116, 127, 145, 110, 125, 143, 148, 151, 136, 139, 149, 160, 174) g <- gl(3,5) levels(g) <- c("A", "B", "C") ## Chacko's test chackoTest(x, g) ## Cuzick's test cuzickTest(x, g) ## Johnson-Mehrotra test johnsonTest(x, g) ## Jonckheere-Terpstra test jonckheereTest(x, g) ## Le's test leTest(x, g) ## Spearman type test spearmanTest(x, g) ## Murakami's BWS trend test bwsTrendTest(x, g) ## Fligner-Wolfe test flignerWolfeTest(x, g) ## Shan-Young-Kang test shanTest(x, g)
Performs Nashimoto and Wright's all-pairs comparison procedure for simply ordered mean ranksums (NPT'-test and NPY'-test).
According to the authors, the procedure shall only be
applied after Chacko's test (see chackoTest
) indicates
global significance.
chaAllPairsNashimotoTest(x, ...) ## Default S3 method: chaAllPairsNashimotoTest( x, g, p.adjust.method = c(p.adjust.methods), alternative = c("greater", "less"), dist = c("Normal", "h"), ... ) ## S3 method for class 'formula' chaAllPairsNashimotoTest( formula, data, subset, na.action, p.adjust.method = c(p.adjust.methods), alternative = c("greater", "less"), dist = c("Normal", "h"), ... )
chaAllPairsNashimotoTest(x, ...) ## Default S3 method: chaAllPairsNashimotoTest( x, g, p.adjust.method = c(p.adjust.methods), alternative = c("greater", "less"), dist = c("Normal", "h"), ... ) ## S3 method for class 'formula' chaAllPairsNashimotoTest( formula, data, subset, na.action, p.adjust.method = c(p.adjust.methods), alternative = c("greater", "less"), dist = c("Normal", "h"), ... )
x |
a numeric vector of data values, or a list of numeric data vectors. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
p.adjust.method |
method for adjusting p values. Ignored if |
alternative |
the alternative hypothesis. Defaults to |
dist |
the test distribution. Defaults to |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
The modified procedure uses the property of a simple order,
.
The null hypothesis H
is tested against
the alternative A
for any
.
Let be the rank of
,
where
is jointly ranked
from
,
then the test statistics for all-pairs comparisons
and a balanced design is calculated as
with ,
the mean rank for the
th group,
and the expected variance (without ties)
.
For the NPY'-test (dist = "h"
), if .
For the unbalanced case with moderate imbalance the test statistic is
For the NPY'-test (dist="h"
) the null hypothesis is rejected in an unbalanced design,
if .
In case of a NPY'-test, the function does not return p-values. Instead the critical h-values
as given in the tables of Hayter (1990) for
(one-sided)
are looked up according to the number of groups (
) and
the degree of freedoms (
).
For the NPT'-test (dist = "Normal"
), the null hypothesis is rejected, if
. Although Nashimoto and Wright (2005) originally did not use any p-adjustment,
any method as available by
p.adjust.methods
can
be selected for the adjustment of p-values estimated from
the standard normal distribution.
Either a list of class "osrt"
if dist = "h"
or a list
of class "PMCMR"
if dist = "Normal"
.
a character string indicating what type of test was performed.
a character string giving the name(s) of the data.
the estimated statistic(s)
critical values for .
a character string describing the alternative hypothesis.
the parameter(s) of the test distribution.
a string that denotes the test distribution.
There are print and summary methods available.
A list with class "PMCMR"
containing the following components:
a character string indicating what type of test was performed.
a character string giving the name(s) of the data.
lower-triangle matrix of the estimated quantiles of the pairwise test statistics.
lower-triangle matrix of the p-values for the pairwise tests.
a character string describing the alternative hypothesis.
a character string describing the method for p-value adjustment.
a data frame of the input data.
a string that denotes the test distribution.
The function will give a warning for the unbalanced case and returns the
critical value if applicable.
Hayter, A. J.(1990) A One-Sided Studentised Range Test for Testing Against a Simple Ordered Alternative, J Amer Stat Assoc 85, 778–785.
Nashimoto, K., Wright, F.T. (2007) Nonparametric Multiple-Comparison Methods for Simply Ordered Medians. Comput Stat Data Anal 51, 5068–5076.
## Example from Shirley (1977) ## Reaction times of mice to stimuli to their tails. x <- c(2.4, 3, 3, 2.2, 2.2, 2.2, 2.2, 2.8, 2, 3, 2.8, 2.2, 3.8, 9.4, 8.4, 3, 3.2, 4.4, 3.2, 7.4, 9.8, 3.2, 5.8, 7.8, 2.6, 2.2, 6.2, 9.4, 7.8, 3.4, 7, 9.8, 9.4, 8.8, 8.8, 3.4, 9, 8.4, 2.4, 7.8) g <- gl(4, 10) ## Shirley's test ## one-sided test using look-up table shirleyWilliamsTest(x ~ g, alternative = "greater") ## Chacko's global hypothesis test for 'greater' chackoTest(x , g) ## post-hoc test, default is standard normal distribution (NPT'-test) summary(chaAllPairsNashimotoTest(x, g, p.adjust.method = "none")) ## same but h-distribution (NPY'-test) chaAllPairsNashimotoTest(x, g, dist = "h") ## NPM-test NPMTest(x, g) ## Hayter-Stone test hayterStoneTest(x, g) ## all-pairs comparisons hsAllPairsTest(x, g)
## Example from Shirley (1977) ## Reaction times of mice to stimuli to their tails. x <- c(2.4, 3, 3, 2.2, 2.2, 2.2, 2.2, 2.8, 2, 3, 2.8, 2.2, 3.8, 9.4, 8.4, 3, 3.2, 4.4, 3.2, 7.4, 9.8, 3.2, 5.8, 7.8, 2.6, 2.2, 6.2, 9.4, 7.8, 3.4, 7, 9.8, 9.4, 8.8, 8.8, 3.4, 9, 8.4, 2.4, 7.8) g <- gl(4, 10) ## Shirley's test ## one-sided test using look-up table shirleyWilliamsTest(x ~ g, alternative = "greater") ## Chacko's global hypothesis test for 'greater' chackoTest(x , g) ## post-hoc test, default is standard normal distribution (NPT'-test) summary(chaAllPairsNashimotoTest(x, g, p.adjust.method = "none")) ## same but h-distribution (NPY'-test) chaAllPairsNashimotoTest(x, g, dist = "h") ## NPM-test NPMTest(x, g) ## Hayter-Stone test hayterStoneTest(x, g) ## all-pairs comparisons hsAllPairsTest(x, g)
Performs Chacko's test for testing against ordered alternatives.
chackoTest(x, ...) ## Default S3 method: chackoTest(x, g, alternative = c("greater", "less"), ...) ## S3 method for class 'formula' chackoTest(formula, data, subset, na.action, alternative = alternative, ...)
chackoTest(x, ...) ## Default S3 method: chackoTest(x, g, alternative = c("greater", "less"), ...) ## S3 method for class 'formula' chackoTest(formula, data, subset, na.action, alternative = alternative, ...)
x |
a numeric vector of data values, or a list of numeric data vectors. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
alternative |
the alternative hypothesis. Defaults to |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
The null hypothesis, H
is tested against a simple order hypothesis,
H
.
Let be the rank of
,
where
is jointly ranked
from
,
then the test statistic is calculated as
where is the isotonic mean of the
-th group
and
the expected variance (without ties).
H
is rejected, if
with
degree of freedom. The p-values are estimated
from the chi-square distribution.
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 source code for the application of the pool adjacent violators
theorem to calculate the isotonic means
was taken from the file "pava.f"
, which is included in the
package Iso:
Rolf Turner (2015). Iso: Functions to Perform Isotonic Regression. R package version 0.0-17. https://CRAN.R-project.org/package=Iso.
The file "pava.f"
is a Ratfor modification of Algorithm AS 206.1:
Bril, G., Dykstra, R., Pillers, C., Robertson, T. (1984) Statistical Algorithms: Algorithm AS 206: Isotonic Regression in Two Independent Variables, Appl Statist 34, 352–357.
The Algorith AS 206 is available from StatLib https://lib.stat.cmu.edu/apstat/. The Royal Statistical Society holds the copyright to these routines, but has given its permission for their distribution provided that no fee is charged.
Factor labels for g
must be assigned in such a way,
that they can be increasingly ordered from zero-dose
control to the highest dose level, e.g. integers
{0, 1, 2, ..., k} or letters {a, b, c, ...}.
Otherwise the function may not select the correct values
for intended zero-dose control.
It is safer, to i) label the factor levels as given above,
and to ii) sort the data according to increasing dose-levels
prior to call the function (see order
, factor
).
The function does neither check nor correct for ties.
Chacko, V. J. (1963) Testing homogeneity against ordered alternatives, Ann Math Statist 34, 945–956.
kruskalTest
and shirleyWilliamsTest
of the package PMCMRplus,
kruskal.test
of the library stats.
## Example from Sachs (1997, p. 402) x <- c(106, 114, 116, 127, 145, 110, 125, 143, 148, 151, 136, 139, 149, 160, 174) g <- gl(3,5) levels(g) <- c("A", "B", "C") ## Chacko's test chackoTest(x, g) ## Cuzick's test cuzickTest(x, g) ## Johnson-Mehrotra test johnsonTest(x, g) ## Jonckheere-Terpstra test jonckheereTest(x, g) ## Le's test leTest(x, g) ## Spearman type test spearmanTest(x, g) ## Murakami's BWS trend test bwsTrendTest(x, g) ## Fligner-Wolfe test flignerWolfeTest(x, g) ## Shan-Young-Kang test shanTest(x, g)
## Example from Sachs (1997, p. 402) x <- c(106, 114, 116, 127, 145, 110, 125, 143, 148, 151, 136, 139, 149, 160, 174) g <- gl(3,5) levels(g) <- c("A", "B", "C") ## Chacko's test chackoTest(x, g) ## Cuzick's test cuzickTest(x, g) ## Johnson-Mehrotra test johnsonTest(x, g) ## Jonckheere-Terpstra test jonckheereTest(x, g) ## Le's test leTest(x, g) ## Spearman type test spearmanTest(x, g) ## Murakami's BWS trend test bwsTrendTest(x, g) ## Fligner-Wolfe test flignerWolfeTest(x, g) ## Shan-Young-Kang test shanTest(x, g)
Performs Chen and Jan nonparametric test for contrasting increasing (decreasing) dose levels of a treatment in a randomized block design.
chenJanTest(y, ...) ## Default S3 method: chenJanTest( y, groups, blocks, alternative = c("greater", "less"), p.adjust.method = c("single-step", "SD1", p.adjust.methods), ... )
chenJanTest(y, ...) ## Default S3 method: chenJanTest( y, groups, blocks, alternative = c("greater", "less"), p.adjust.method = c("single-step", "SD1", p.adjust.methods), ... )
y |
a numeric vector of data values, or a list of numeric data vectors. |
groups |
a vector or factor object giving the group for the
corresponding elements of |
blocks |
a vector or factor object giving the block for the
corresponding elements of |
alternative |
the alternative hypothesis. Defaults to |
p.adjust.method |
method for adjusting p values
(see |
... |
further arguments to be passed to or from methods. |
Chen's test is a non-parametric step-down trend test for
testing several treatment levels with a zero control. Let
there be groups including the control and let
the zero dose level be indicated with
and the highest
dose level with
, then the following
m = k - 1
hypotheses are tested:
Let
be
a i.i.d. random variable of at least ordinal scale. Further,the zero dose
control is indicated with
.
The Mann-Whittney statistic is
where where the indicator function returns
otherwise
.
Let
and
The mean and variance of are
with the number of ties in the
th block and
the size of the tied group
.
The test statistic is asymptotically multivariate normal
distributed.
If p.adjust.method = "single-step"
than the p-values
are calculated with the probability function of the multivariate
normal distribution with . Otherwise
the standard normal distribution is used to calculate
p-values and any method as available
by
p.adjust
or by the step-down procedure as proposed
by Chen (1999), if p.adjust.method = "SD1"
can be used
to account for -error inflation.
A list with class "PMCMR"
containing the following components:
a character string indicating what type of test was performed.
a character string giving the name(s) of the data.
lower-triangle matrix of the estimated quantiles of the pairwise test statistics.
lower-triangle matrix of the p-values for the pairwise tests.
a character string describing the alternative hypothesis.
a character string describing the method for p-value adjustment.
a data frame of the input data.
a string that denotes the test distribution.
Chen, Y.I., Jan, S.L., 2002. Nonparametric Identification of the Minimum Effective Dose for Randomized Block Designs. Commun Stat-Simul Comput 31, 301–312.
## Example from Chen and Jan (2002, p. 306) ## MED is at dose level 2 (0.5 ppm SO2) y <- c(0.2, 6.2, 0.3, 0.3, 4.9, 1.8, 3.9, 2, 0.3, 2.5, 5.4, 2.3, 12.7, -0.2, 2.1, 6, 1.8, 3.9, 1.1, 3.8, 2.5, 1.3, -0.8, 13.1, 1.1, 12.8, 18.2, 3.4, 13.5, 4.4, 6.1, 2.8, 4, 10.6, 9, 4.2, 6.7, 35, 9, 12.9, 2, 7.1, 1.5, 10.6) groups <- gl(4,11, labels = c("0", "0.25", "0.5", "1.0")) blocks <- structure(rep(1:11, 4), class = "factor", levels = c("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11")) summary(chenJanTest(y, groups, blocks, alternative = "greater")) summary(chenJanTest(y, groups, blocks, alternative = "greater", p.adjust = "SD1"))
## Example from Chen and Jan (2002, p. 306) ## MED is at dose level 2 (0.5 ppm SO2) y <- c(0.2, 6.2, 0.3, 0.3, 4.9, 1.8, 3.9, 2, 0.3, 2.5, 5.4, 2.3, 12.7, -0.2, 2.1, 6, 1.8, 3.9, 1.1, 3.8, 2.5, 1.3, -0.8, 13.1, 1.1, 12.8, 18.2, 3.4, 13.5, 4.4, 6.1, 2.8, 4, 10.6, 9, 4.2, 6.7, 35, 9, 12.9, 2, 7.1, 1.5, 10.6) groups <- gl(4,11, labels = c("0", "0.25", "0.5", "1.0")) blocks <- structure(rep(1:11, 4), class = "factor", levels = c("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11")) summary(chenJanTest(y, groups, blocks, alternative = "greater")) summary(chenJanTest(y, groups, blocks, alternative = "greater", p.adjust = "SD1"))
Performs Chen's nonparametric test for contrasting increasing (decreasing) dose levels of a treatment.
chenTest(x, ...) ## Default S3 method: chenTest( x, g, alternative = c("greater", "less"), p.adjust.method = c("SD1", p.adjust.methods), ... ) ## S3 method for class 'formula' chenTest( formula, data, subset, na.action, alternative = c("greater", "less"), p.adjust.method = c("SD1", p.adjust.methods), ... )
chenTest(x, ...) ## Default S3 method: chenTest( x, g, alternative = c("greater", "less"), p.adjust.method = c("SD1", p.adjust.methods), ... ) ## S3 method for class 'formula' chenTest( formula, data, subset, na.action, alternative = c("greater", "less"), p.adjust.method = c("SD1", p.adjust.methods), ... )
x |
a numeric vector of data values, or a list of numeric data vectors. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
alternative |
the alternative hypothesis. Defaults to |
p.adjust.method |
method for adjusting p values
(see |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
Chen's test is a non-parametric step-down trend test for
testing several treatment levels with a zero control.
Let denote a variable with the
-th
realization of the control group (
)
and
the
-the realization
in the
-th treatment group (
).
The variables are i.i.d. of a least ordinal scale with
.
A total of
hypotheses can be tested:
The statistics are based on a Wilcoxon-type ranking:
where the indicator function returns
otherwise
.
The expected th mean is
with and the
th variance:
The test statistic is asymptotically standard normal
The p-values are calculated from the standard normal distribution.
The p-values can be adjusted with any method as available
by p.adjust
or by the step-down procedure as proposed
by Chen (1999), if p.adjust.method = "SD1"
.
A list with class "PMCMR"
containing the following components:
a character string indicating what type of test was performed.
a character string giving the name(s) of the data.
lower-triangle matrix of the estimated quantiles of the pairwise test statistics.
lower-triangle matrix of the p-values for the pairwise tests.
a character string describing the alternative hypothesis.
a character string describing the method for p-value adjustment.
a data frame of the input data.
a string that denotes the test distribution.
Factor labels for g
must be assigned in such a way,
that they can be increasingly ordered from zero-dose
control to the highest dose level, e.g. integers
{0, 1, 2, ..., k} or letters {a, b, c, ...}.
Otherwise the function may not select the correct values
for intended zero-dose control.
It is safer, to i) label the factor levels as given above,
and to ii) sort the data according to increasing dose-levels
prior to call the function (see order
, factor
).
Chen, Y.-I., 1999, Nonparametric Identification of the Minimum Effective Dose. Biometrics 55, 1236–1240. doi:10.1111/j.0006-341X.1999.01236.x
## Chen, 1999, p. 1237, ## Minimum effective dose (MED) ## is at 2nd dose level df <- data.frame(x = c(23, 22, 14, 27, 23, 21, 28, 37, 35, 41, 37, 43, 28, 21, 30, 16, 19, 13), g = gl(6, 3)) levels(df$g) <- 0:5 ans <- chenTest(x ~ g, data = df, alternative = "greater", p.adjust.method = "SD1") summary(ans)
## Chen, 1999, p. 1237, ## Minimum effective dose (MED) ## is at 2nd dose level df <- data.frame(x = c(23, 22, 14, 27, 23, 21, 28, 37, 35, 41, 37, 43, 28, 21, 30, 16, 19, 13), g = gl(6, 3)) levels(df$g) <- 0:5 ans <- chenTest(x ~ g, data = df, alternative = "greater", p.adjust.method = "SD1") summary(ans)
Distribution function and quantile function for Cochran's distribution.
qcochran(p, k, n, lower.tail = TRUE, log.p = FALSE) pcochran(q, k, n, lower.tail = TRUE, log.p = FALSE)
qcochran(p, k, n, lower.tail = TRUE, log.p = FALSE) pcochran(q, k, n, lower.tail = TRUE, log.p = FALSE)
p |
vector of probabilities. |
k |
number of groups. |
n |
(average) sample size of the k groups. |
lower.tail |
logical; if TRUE (default),
probabilities are |
log.p |
logical; if TRUE, probabilities p are given as log(p). |
q |
vector of quantiles. |
pcochran
gives the distribution function and
qcochran
gives the quantile function.
Cochran, W.G. (1941) The distribution of the largest of a set of estimated variances as a fraction of their total. Ann. Eugen. 11, 47–52.
Wilrich, P.-T. (2011) Critical values of Mandel's h and k, Grubbs and the Cochran test statistic. Adv. Stat. Anal.. doi:10.1007/s10182-011-0185-y.
qcochran(0.05, 7, 3)
qcochran(0.05, 7, 3)
Performs Cochran's test for testing an outlying (or inlying) variance.
cochranTest(x, ...) ## Default S3 method: cochranTest(x, g, alternative = c("greater", "less"), ...) ## S3 method for class 'formula' cochranTest( formula, data, subset, na.action, alternative = c("greater", "less"), ... )
cochranTest(x, ...) ## Default S3 method: cochranTest(x, g, alternative = c("greater", "less"), ...) ## S3 method for class 'formula' cochranTest( formula, data, subset, na.action, alternative = c("greater", "less"), ... )
x |
a numeric vector of data values, or a list of numeric data vectors. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
alternative |
the alternative hypothesis. Defaults to |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
For normally distributed data the null hypothesis,
H
is tested against the alternative (greater)
H
with
at least one inequality being strict.
The p-value is computed with the function pcochran
.
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.
Cochran, W.G. (1941) The distribution of the largest of a set of estimated variances as a fraction of their total. Ann. Eugen. 11, 47–52.
Wilrich, P.-T. (2011) Critical values of Mandel's h and k, Grubbs and the Cochran test statistic. Adv. Stat. Anal.. doi:10.1007/s10182-011-0185-y.
data(Pentosan) cochranTest(value ~ lab, data = Pentosan, subset = (material == "A"))
data(Pentosan) cochranTest(value ~ lab, data = Pentosan, subset = (material == "A"))
Performs Cuzick's test for testing against ordered alternatives.
cuzickTest(x, ...) ## Default S3 method: cuzickTest( x, g, alternative = c("two.sided", "greater", "less"), scores = NULL, continuity = FALSE, ... ) ## S3 method for class 'formula' cuzickTest( formula, data, subset, na.action, alternative = c("two.sided", "greater", "less"), scores = NULL, continuity = FALSE, ... )
cuzickTest(x, ...) ## Default S3 method: cuzickTest( x, g, alternative = c("two.sided", "greater", "less"), scores = NULL, continuity = FALSE, ... ) ## S3 method for class 'formula' cuzickTest( formula, data, subset, na.action, alternative = c("two.sided", "greater", "less"), scores = NULL, continuity = FALSE, ... )
x |
a numeric vector of data values, or a list of numeric data vectors. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
alternative |
the alternative hypothesis. Defaults to |
scores |
numeric vector of scores. Defaults to |
continuity |
logical indicator whether a continuity correction
shall be performed. Defaults to |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
The null hypothesis, H
is tested against a simple order hypothesis,
H
.
The p-values are estimated from the standard normal distribution.
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.
Factor labels for g
must be assigned in such a way,
that they can be increasingly ordered from zero-dose
control to the highest dose level, e.g. integers
{0, 1, 2, ..., k} or letters {a, b, c, ...}.
Otherwise the function may not select the correct values
for intended zero-dose control.
It is safer, to i) label the factor levels as given above,
and to ii) sort the data according to increasing dose-levels
prior to call the function (see order
, factor
).
Cuzick, J. (1995) A Wilcoxon-type test for trend, Statistics in Medicine 4, 87–90.
kruskalTest
and shirleyWilliamsTest
of the package PMCMRplus,
kruskal.test
of the library stats.
## Example from Sachs (1997, p. 402) x <- c(106, 114, 116, 127, 145, 110, 125, 143, 148, 151, 136, 139, 149, 160, 174) g <- gl(3,5) levels(g) <- c("A", "B", "C") ## Chacko's test chackoTest(x, g) ## Cuzick's test cuzickTest(x, g) ## Johnson-Mehrotra test johnsonTest(x, g) ## Jonckheere-Terpstra test jonckheereTest(x, g) ## Le's test leTest(x, g) ## Spearman type test spearmanTest(x, g) ## Murakami's BWS trend test bwsTrendTest(x, g) ## Fligner-Wolfe test flignerWolfeTest(x, g) ## Shan-Young-Kang test shanTest(x, g)
## Example from Sachs (1997, p. 402) x <- c(106, 114, 116, 127, 145, 110, 125, 143, 148, 151, 136, 139, 149, 160, 174) g <- gl(3,5) levels(g) <- c("A", "B", "C") ## Chacko's test chackoTest(x, g) ## Cuzick's test cuzickTest(x, g) ## Johnson-Mehrotra test johnsonTest(x, g) ## Jonckheere-Terpstra test jonckheereTest(x, g) ## Le's test leTest(x, g) ## Spearman type test spearmanTest(x, g) ## Murakami's BWS trend test bwsTrendTest(x, g) ## Fligner-Wolfe test flignerWolfeTest(x, g) ## Shan-Young-Kang test shanTest(x, g)
Distribution function for Grubbs D* distribution.
pdgrubbs(q, n, m = 10000, lower.tail = TRUE, log.p = FALSE)
pdgrubbs(q, n, m = 10000, lower.tail = TRUE, log.p = FALSE)
q |
vector of quantiles. |
n |
total sample size. |
m |
number of Monte-Carlo replicates. Defaults to |
lower.tail |
logical; if TRUE (default),
probabilities are |
log.p |
logical; if TRUE, probabilities p are given as log(p). |
pgrubbs
gives the distribution function
Grubbs, F.E. (1950) Sample criteria for testing outlying observations, Ann. Math. Stat. 21, 27–58.
Wilrich, P.-T. (2011) Critical values of Mandel's h and k, Grubbs and the Cochran test statistic, Adv. Stat. Anal.. doi:10.1007/s10182-011-0185-y.
pdgrubbs(0.62, 7, 1E4)
pdgrubbs(0.62, 7, 1E4)
Performs Grubbs double outlier test.
doubleGrubbsTest(x, alternative = c("two.sided", "greater", "less"), m = 10000)
doubleGrubbsTest(x, alternative = c("two.sided", "greater", "less"), m = 10000)
x |
a numeric vector of data. |
alternative |
the alternative hypothesis.
Defaults to |
m |
number of Monte-Carlo replicates. |
Let denote an identically and independently distributed continuous
variate with realizations
.
Further, let the increasingly ordered realizations
denote
. Then
the following model for testing two maximum outliers can be proposed:
with . The null hypothesis,
H
is tested against the alternative,
H
.
For testing two minimum outliers, the model can be proposed as
The null hypothesis is tested against the alternative,
H.
The p-value is computed with the function pdgrubbs
.
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.
Grubbs, F. E. (1950) Sample criteria for testing outlying observations. Ann. Math. Stat. 21, 27–58.
Wilrich, P.-T. (2011) Critical values of Mandel's h and k, Grubbs and the Cochran test statistic. Adv. Stat. Anal.. doi:10.1007/s10182-011-0185-y.
data(Pentosan) dat <- subset(Pentosan, subset = (material == "A")) labMeans <- tapply(dat$value, dat$lab, mean) doubleGrubbsTest(x = labMeans, alternative = "less")
data(Pentosan) dat <- subset(Pentosan, subset = (material == "A")) labMeans <- tapply(dat$value, dat$lab, mean) doubleGrubbsTest(x = labMeans, alternative = "less")
Performs the all-pairs comparison test for different factor levels according to Dwass, Steel, Critchlow and Fligner.
dscfAllPairsTest(x, ...) ## Default S3 method: dscfAllPairsTest(x, g, ...) ## S3 method for class 'formula' dscfAllPairsTest(formula, data, subset, na.action, ...)
dscfAllPairsTest(x, ...) ## Default S3 method: dscfAllPairsTest(x, g, ...) ## S3 method for class 'formula' dscfAllPairsTest(formula, data, subset, na.action, ...)
x |
a numeric vector of data values, or a list of numeric data vectors. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
For all-pairs comparisons in an one-factorial layout
with non-normally distributed residuals the DSCF
all-pairs comparison test can be used. A total of
hypotheses can be tested. The null hypothesis
H
is tested in the two-tailed test
against the alternative
A
.
As opposed to the all-pairs comparison procedures that depend
on Kruskal ranks, the DSCF test is basically an extension of
the U-test as re-ranking is conducted for each pairwise test.
The p-values are estimated from the studentized range distriburtion.
A list with class "PMCMR"
containing the following components:
a character string indicating what type of test was performed.
a character string giving the name(s) of the data.
lower-triangle matrix of the estimated quantiles of the pairwise test statistics.
lower-triangle matrix of the p-values for the pairwise tests.
a character string describing the alternative hypothesis.
a character string describing the method for p-value adjustment.
a data frame of the input data.
a string that denotes the test distribution.
Douglas, C. E., Fligner, A. M. (1991) On distribution-free multiple comparisons in the one-way analysis of variance, Communications in Statistics - Theory and Methods 20, 127–139.
Dwass, M. (1960) Some k-sample rank-order tests. In Contributions to Probability and Statistics, Edited by: I. Olkin, Stanford: Stanford University Press.
Steel, R. G. D. (1960) A rank sum test for comparing all pairs of treatments, Technometrics 2, 197–207
Performs Duncan's all-pairs comparisons test for normally distributed data with equal group variances.
duncanTest(x, ...) ## Default S3 method: duncanTest(x, g, ...) ## S3 method for class 'formula' duncanTest(formula, data, subset, na.action, ...) ## S3 method for class 'aov' duncanTest(x, ...)
duncanTest(x, ...) ## Default S3 method: duncanTest(x, g, ...) ## S3 method for class 'formula' duncanTest(formula, data, subset, na.action, ...) ## S3 method for class 'aov' duncanTest(x, ...)
x |
a numeric vector of data values, a list of numeric data vectors or a fitted model object, usually an aov fit. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
For all-pairs comparisons in an one-factorial layout
with normally distributed residuals and equal variances
Duncan's multiple range test can be performed.
Let denote a continuous random variable
with the
-the realization (
)
in the
-th group (
). Furthermore, the total
sample size is
. A total of
hypotheses can be tested: The null hypothesis is
H
is tested against the alternative
A
(two-tailed). Duncan's all-pairs test
statistics are given by
with the within-group ANOVA variance,
and
the increasingly
ordered means
.
The null hypothesis is rejected if
with degree of freedom, the range
and
the Bonferroni adjusted
alpha-error. The p-values are computed
from the
Tukey
distribution.
A list with class "PMCMR"
containing the following components:
a character string indicating what type of test was performed.
a character string giving the name(s) of the data.
lower-triangle matrix of the estimated quantiles of the pairwise test statistics.
lower-triangle matrix of the p-values for the pairwise tests.
a character string describing the alternative hypothesis.
a character string describing the method for p-value adjustment.
a data frame of the input data.
a string that denotes the test distribution.
Duncan, D. B. (1955) Multiple range and multiple F tests, Biometrics 11, 1–42.
fit <- aov(weight ~ feed, chickwts) shapiro.test(residuals(fit)) bartlett.test(weight ~ feed, chickwts) anova(fit) ## also works with fitted objects of class aov res <- duncanTest(fit) summary(res) summaryGroup(res)
fit <- aov(weight ~ feed, chickwts) shapiro.test(residuals(fit)) bartlett.test(weight ~ feed, chickwts) anova(fit) ## also works with fitted objects of class aov res <- duncanTest(fit) summary(res) summaryGroup(res)
Performs Dunnett's all-pairs comparison test for normally distributed data with unequal variances.
dunnettT3Test(x, ...) ## Default S3 method: dunnettT3Test(x, g, ...) ## S3 method for class 'formula' dunnettT3Test(formula, data, subset, na.action, ...) ## S3 method for class 'aov' dunnettT3Test(x, ...)
dunnettT3Test(x, ...) ## Default S3 method: dunnettT3Test(x, g, ...) ## S3 method for class 'formula' dunnettT3Test(formula, data, subset, na.action, ...) ## S3 method for class 'aov' dunnettT3Test(x, ...)
x |
a numeric vector of data values, a list of numeric data vectors or a fitted model object, usually an aov fit. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
For all-pairs comparisons in an one-factorial layout
with normally distributed residuals but unequal groups variances
the T3 test of Dunnett can be performed.
Let denote a continuous random variable
with the
-the realization (
)
in the
-th group (
). Furthermore, the total
sample size is
. A total of
hypotheses can be tested: The null hypothesis is
H
is tested against the alternative
A
(two-tailed). Dunnett T3 all-pairs
test statistics are given by
with the variance of the
-th group.
The null hypothesis is rejected (two-tailed) if
with Welch's approximate solution for calculating the degree of freedom.
The -values are computed from the
studentized maximum modulus distribution
that is the equivalent of the multivariate t distribution
with
.
The function
pmvt
is used to
calculate the -values.
A list with class "PMCMR"
containing the following components:
a character string indicating what type of test was performed.
a character string giving the name(s) of the data.
lower-triangle matrix of the estimated quantiles of the pairwise test statistics.
lower-triangle matrix of the p-values for the pairwise tests.
a character string describing the alternative hypothesis.
a character string describing the method for p-value adjustment.
a data frame of the input data.
a string that denotes the test distribution.
C. W. Dunnett (1980) Pair wise multiple comparisons in the unequal variance case, Journal of the American Statistical Association 75, 796–800.
fit <- aov(weight ~ feed, chickwts) shapiro.test(residuals(fit)) bartlett.test(weight ~ feed, chickwts) anova(fit) ## also works with fitted objects of class aov res <- dunnettT3Test(fit) summary(res) summaryGroup(res)
fit <- aov(weight ~ feed, chickwts) shapiro.test(residuals(fit)) bartlett.test(weight ~ feed, chickwts) anova(fit) ## also works with fitted objects of class aov res <- dunnettT3Test(fit) summary(res) summaryGroup(res)
Performs Dunnett's multiple comparisons test with one control.
dunnettTest(x, ...) ## Default S3 method: dunnettTest(x, g, alternative = c("two.sided", "greater", "less"), ...) ## S3 method for class 'formula' dunnettTest( formula, data, subset, na.action, alternative = c("two.sided", "greater", "less"), ... ) ## S3 method for class 'aov' dunnettTest(x, alternative = c("two.sided", "greater", "less"), ...)
dunnettTest(x, ...) ## Default S3 method: dunnettTest(x, g, alternative = c("two.sided", "greater", "less"), ...) ## S3 method for class 'formula' dunnettTest( formula, data, subset, na.action, alternative = c("two.sided", "greater", "less"), ... ) ## S3 method for class 'aov' dunnettTest(x, alternative = c("two.sided", "greater", "less"), ...)
x |
a numeric vector of data values, a list of numeric data vectors or a fitted model object, usually an aov fit. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
alternative |
the alternative hypothesis. Defaults to |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
For many-to-one comparisons in an one-factorial layout
with normally distributed residuals Dunnett's test
can be used.
Let denote a continuous random variable
with the
-the realization of the control group
(
) and
the
-the realization
in the
-th treatment group (
).
Furthermore, the total sample size is
.
A total of
hypotheses can be tested: The null hypothesis is
H
is tested against the alternative
A
(two-tailed). Dunnett's test
statistics are given by
with the within-group ANOVA variance.
The null hypothesis is rejected if
(two-tailed),
with
degree of freedom and
the correlation:
The p-values are computed with the function pDunnett
that is a wrapper to the the multivariate-t distribution as implemented in the function
pmvt
.
A list with class "PMCMR"
containing the following components:
a character string indicating what type of test was performed.
a character string giving the name(s) of the data.
lower-triangle matrix of the estimated quantiles of the pairwise test statistics.
lower-triangle matrix of the p-values for the pairwise tests.
a character string describing the alternative hypothesis.
a character string describing the method for p-value adjustment.
a data frame of the input data.
a string that denotes the test distribution.
Dunnett, C. W. (1955) A multiple comparison procedure for comparing several treatments with a control. Journal of the American Statistical Association 50, 1096–1121.
OECD (ed. 2006) Current approaches in the statistical analysis of ecotoxicity data: A guidance to application - Annexes. OECD Series on testing and assessment, No. 54.
fit <- aov(Y ~ DOSE, data = trout) shapiro.test(residuals(fit)) bartlett.test(Y ~ DOSE, data = trout) ## works with fitted object of class aov summary(dunnettTest(fit, alternative = "less"))
fit <- aov(Y ~ DOSE, data = trout) shapiro.test(residuals(fit)) bartlett.test(Y ~ DOSE, data = trout) ## works with fitted object of class aov summary(dunnettTest(fit, alternative = "less"))
Performs Conover-Iman all-pairs comparison test for a balanced incomplete block design (BIBD).
durbinAllPairsTest(y, ...) ## Default S3 method: durbinAllPairsTest(y, groups, blocks, p.adjust.method = p.adjust.methods, ...)
durbinAllPairsTest(y, ...) ## Default S3 method: durbinAllPairsTest(y, groups, blocks, p.adjust.method = p.adjust.methods, ...)
y |
a numeric vector of data values, or a list of numeric data vectors. |
groups |
a vector or factor object giving the group for the
corresponding elements of |
blocks |
a vector or factor object giving the block for the
corresponding elements of |
p.adjust.method |
method for adjusting p values
(see |
... |
further arguments to be passed to or from methods. |
For all-pairs comparisons in a balanced incomplete block design
the proposed test of Conover and Imam can be applied.
A total of
hypotheses can be tested. The null hypothesis
H
is tested in the two-tailed test
against the alternative
A
.
The p-values are computed from the t distribution. If no p-value adjustment
is performed (p.adjust.method = "none"
),
than a simple protected test is recommended, i.e.
the all-pairs comparisons should only be applied after a significant
durbinTest
. However, any method as implemented in
p.adjust.methods
can be selected by the user.
A list with class "PMCMR"
containing the following components:
a character string indicating what type of test was performed.
a character string giving the name(s) of the data.
lower-triangle matrix of the estimated quantiles of the pairwise test statistics.
lower-triangle matrix of the p-values for the pairwise tests.
a character string describing the alternative hypothesis.
a character string describing the method for p-value adjustment.
a data frame of the input data.
a string that denotes the test distribution.
Conover, W. J., Iman, R. L. (1979) On multiple-comparisons procedures, Tech. Rep. LA-7677-MS, Los Alamos Scientific Laboratory.
Conover, W. J. (1999) Practical nonparametric Statistics, 3rd. Edition, Wiley.
## Example for an incomplete block design: ## Data from Conover (1999, p. 391). y <- matrix(c(2,NA,NA,NA,3, NA, 3, 3, 3, NA, NA, NA, 3, NA, NA, 1, 2, NA, NA, NA, 1, 1, NA, 1, 1, NA, NA, NA, NA, 2, NA, 2, 1, NA, NA, NA, NA, 3, NA, 2, 1, NA, NA, NA, NA, 3, NA, 2, 2), ncol=7, nrow=7, byrow=FALSE, dimnames=list(1:7, LETTERS[1:7])) durbinAllPairsTest(y)
## Example for an incomplete block design: ## Data from Conover (1999, p. 391). y <- matrix(c(2,NA,NA,NA,3, NA, 3, 3, 3, NA, NA, NA, 3, NA, NA, 1, 2, NA, NA, NA, 1, 1, NA, 1, 1, NA, NA, NA, NA, 2, NA, 2, 1, NA, NA, NA, NA, 3, NA, 2, 1, NA, NA, NA, NA, 3, NA, 2, 2), ncol=7, nrow=7, byrow=FALSE, dimnames=list(1:7, LETTERS[1:7])) durbinAllPairsTest(y)
Performs Durbin's tests whether k groups (or treatments) in a two-way balanced incomplete block design (BIBD) have identical effects.
durbinTest(y, ...) ## Default S3 method: durbinTest(y, groups, blocks, ...)
durbinTest(y, ...) ## Default S3 method: durbinTest(y, groups, blocks, ...)
y |
a numeric vector of data values, or a list of numeric data vectors. |
groups |
a vector or factor object giving the group for the
corresponding elements of |
blocks |
a vector or factor object giving the block for the
corresponding elements of |
... |
further arguments to be passed to or from methods. |
For testing a two factorial layout of a balanced incomplete
block design whether the groups have identical effects,
the Durbin test can be performed. The null hypothesis,
H
,
is tested against the alternative that at least
one
.
The p-values are computed from the chi-square distribution.
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 function does not test, whether it is a true BIBD. This function does not test for ties.
Conover,W. J. (1999) Practical nonparametric Statistics, 3rd. Edition, Wiley.
Heckert, N. A., Filliben, J. J. (2003) NIST Handbook 148: Dataplot Reference Manual, Volume 2: Let Subcommands and Library Functions. National Institute of Standards and Technology Handbook Series, June 2003.
## Example for an incomplete block design: ## Data from Conover (1999, p. 391). y <- matrix(c( 2,NA,NA,NA,3, NA, 3, 3, 3, NA, NA, NA, 3, NA, NA, 1, 2, NA, NA, NA, 1, 1, NA, 1, 1, NA, NA, NA, NA, 2, NA, 2, 1, NA, NA, NA, NA, 3, NA, 2, 1, NA, NA, NA, NA, 3, NA, 2, 2 ), ncol=7, nrow=7, byrow=FALSE, dimnames=list(1:7, LETTERS[1:7])) durbinTest(y)
## Example for an incomplete block design: ## Data from Conover (1999, p. 391). y <- matrix(c( 2,NA,NA,NA,3, NA, 3, 3, 3, NA, NA, NA, 3, NA, NA, 1, 2, NA, NA, NA, 1, 1, NA, 1, 1, NA, NA, NA, NA, 2, NA, 2, 1, NA, NA, NA, NA, 3, NA, 2, 1, NA, NA, NA, NA, 3, NA, 2, 2 ), ncol=7, nrow=7, byrow=FALSE, dimnames=list(1:7, LETTERS[1:7])) durbinTest(y)
Performs Fligner-Wolfe non-parametric test for simultaneous testing of several locations of treatment groups against the location of the control group.
flignerWolfeTest(x, ...) ## Default S3 method: flignerWolfeTest( x, g, alternative = c("greater", "less"), dist = c("Wilcoxon", "Normal"), ... ) ## S3 method for class 'formula' flignerWolfeTest( formula, data, subset, na.action, alternative = c("greater", "less"), dist = c("Wilcoxon", "Normal"), ... )
flignerWolfeTest(x, ...) ## Default S3 method: flignerWolfeTest( x, g, alternative = c("greater", "less"), dist = c("Wilcoxon", "Normal"), ... ) ## S3 method for class 'formula' flignerWolfeTest( formula, data, subset, na.action, alternative = c("greater", "less"), dist = c("Wilcoxon", "Normal"), ... )
x |
a numeric vector of data values, or a list of numeric data vectors. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
alternative |
the alternative hypothesis. Defaults to |
dist |
the test distribution. Defaults to |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
For a one-factorial layout with non-normally distributed residuals the Fligner-Wolfe test can be used.
Let there be -treatment groups and one control group, then
the null hypothesis, H
is tested against the alternative (greater),
A
,
with at least one inequality being strict.
Let denote the sample size of the control group,
the sum of all treatment
sample sizes and
. The test statistic without taken
ties into account is
with the rank of variable
.
The null hypothesis is rejected,
if
with
and
.
In the presence of ties, the statistic is
where
with the number of tied groups and
the number of tied values in the
th group. The null hypothesis
is rejected, if
(as cited in EPA 2006).
If dist = Wilcoxon
, then the -values are estimated from the
Wilcoxon
distribution, else the Normal
distribution is used. The latter can be used,
if ties are present.
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.
Factor labels for g
must be assigned in such a way,
that they can be increasingly ordered from zero-dose
control to the highest dose level, e.g. integers
{0, 1, 2, ..., k} or letters {a, b, c, ...}.
Otherwise the function may not select the correct values
for intended zero-dose control.
It is safer, to i) label the factor levels as given above,
and to ii) sort the data according to increasing dose-levels
prior to call the function (see order
, factor
).
EPA (2006) Data Quality Assessment: Statistical Methods for Practitioners (Guideline No. EPA QA/G-9S), US-EPA.
Fligner, M.A., Wolfe, D.A. (1982) Distribution-free tests for comparing several treatments with a control. Stat Neerl 36, 119–127.
kruskalTest
and shirleyWilliamsTest
of the package PMCMRplus,
kruskal.test
of the library stats.
## Example from Sachs (1997, p. 402) x <- c(106, 114, 116, 127, 145, 110, 125, 143, 148, 151, 136, 139, 149, 160, 174) g <- gl(3,5) levels(g) <- c("A", "B", "C") ## Chacko's test chackoTest(x, g) ## Cuzick's test cuzickTest(x, g) ## Johnson-Mehrotra test johnsonTest(x, g) ## Jonckheere-Terpstra test jonckheereTest(x, g) ## Le's test leTest(x, g) ## Spearman type test spearmanTest(x, g) ## Murakami's BWS trend test bwsTrendTest(x, g) ## Fligner-Wolfe test flignerWolfeTest(x, g) ## Shan-Young-Kang test shanTest(x, g)
## Example from Sachs (1997, p. 402) x <- c(106, 114, 116, 127, 145, 110, 125, 143, 148, 151, 136, 139, 149, 160, 174) g <- gl(3,5) levels(g) <- c("A", "B", "C") ## Chacko's test chackoTest(x, g) ## Cuzick's test cuzickTest(x, g) ## Johnson-Mehrotra test johnsonTest(x, g) ## Jonckheere-Terpstra test jonckheereTest(x, g) ## Le's test leTest(x, g) ## Spearman type test spearmanTest(x, g) ## Murakami's BWS trend test bwsTrendTest(x, g) ## Fligner-Wolfe test flignerWolfeTest(x, g) ## Shan-Young-Kang test shanTest(x, g)
Performs Conover's all-pairs comparisons tests of Friedman-type ranked data.
frdAllPairsConoverTest(y, ...) ## Default S3 method: frdAllPairsConoverTest( y, groups, blocks, p.adjust.method = c("single-step", p.adjust.methods), ... )
frdAllPairsConoverTest(y, ...) ## Default S3 method: frdAllPairsConoverTest( y, groups, blocks, p.adjust.method = c("single-step", p.adjust.methods), ... )
y |
a numeric vector of data values, or a list of numeric data vectors. |
groups |
a vector or factor object giving the group for the
corresponding elements of |
blocks |
a vector or factor object giving the block for the
corresponding elements of |
p.adjust.method |
method for adjusting p values
(see |
... |
further arguments to be passed to or from methods. |
For all-pairs comparisons in a two factorial unreplicated complete block design with non-normally distributed residuals, Conover's test can be performed on Friedman-type ranked data.
A total of hypotheses can be tested.
The null hypothesis, H
, is tested
in the two-tailed case against the alternative,
A
.
If p.adjust.method == "single-step"
the p-values are computed
from the studentized range distribution. Otherwise,
the p-values are computed from the t-distribution using
any of the p-adjustment methods as included in p.adjust
.
A list with class "PMCMR"
containing the following components:
a character string indicating what type of test was performed.
a character string giving the name(s) of the data.
lower-triangle matrix of the estimated quantiles of the pairwise test statistics.
lower-triangle matrix of the p-values for the pairwise tests.
a character string describing the alternative hypothesis.
a character string describing the method for p-value adjustment.
a data frame of the input data.
a string that denotes the test distribution.
Conover, W. J., Iman, R. L. (1979) On multiple-comparisons procedures, Tech. Rep. LA-7677-MS, Los Alamos Scientific Laboratory.
Conover, W. J. (1999) Practical nonparametric Statistics, 3rd. Edition, Wiley.
friedmanTest
, friedman.test
,
frdAllPairsExactTest
, frdAllPairsMillerTest
,
frdAllPairsNemenyiTest
, frdAllPairsSiegelTest
## Sachs, 1997, p. 675 ## Six persons (block) received six different diuretics ## (A to F, treatment). ## The responses are the Na-concentration (mval) ## in the urine measured 2 hours after each treatment. ## y <- matrix(c( 3.88, 5.64, 5.76, 4.25, 5.91, 4.33, 30.58, 30.14, 16.92, 23.19, 26.74, 10.91, 25.24, 33.52, 25.45, 18.85, 20.45, 26.67, 4.44, 7.94, 4.04, 4.4, 4.23, 4.36, 29.41, 30.72, 32.92, 28.23, 23.35, 12, 38.87, 33.12, 39.15, 28.06, 38.23, 26.65),nrow=6, ncol=6, dimnames=list(1:6, LETTERS[1:6])) print(y) friedmanTest(y) ## Eisinga et al. 2017 frdAllPairsExactTest(y=y, p.adjust = "bonferroni") ## Conover's test frdAllPairsConoverTest(y=y, p.adjust = "bonferroni") ## Nemenyi's test frdAllPairsNemenyiTest(y=y) ## Miller et al. frdAllPairsMillerTest(y=y) ## Siegel-Castellan frdAllPairsSiegelTest(y=y, p.adjust = "bonferroni") ## Irrelevant of group order? x <- as.vector(y) g <- rep(colnames(y), each = length(x)/length(colnames(y))) b <- rep(rownames(y), times = length(x)/length(rownames(y))) xDF <- data.frame(x, g, b) # grouped by colnames frdAllPairsNemenyiTest(xDF$x, groups = xDF$g, blocks = xDF$b) o <- order(xDF$b) # order per block increasingly frdAllPairsNemenyiTest(xDF$x[o], groups = xDF$g[o], blocks = xDF$b[o]) o <- order(xDF$x) # order per value increasingly frdAllPairsNemenyiTest(xDF$x[o], groups = xDF$g[o], blocks = xDF$b[o]) ## formula method (only works for Nemenyi) frdAllPairsNemenyiTest(x ~ g | b, data = xDF)
## Sachs, 1997, p. 675 ## Six persons (block) received six different diuretics ## (A to F, treatment). ## The responses are the Na-concentration (mval) ## in the urine measured 2 hours after each treatment. ## y <- matrix(c( 3.88, 5.64, 5.76, 4.25, 5.91, 4.33, 30.58, 30.14, 16.92, 23.19, 26.74, 10.91, 25.24, 33.52, 25.45, 18.85, 20.45, 26.67, 4.44, 7.94, 4.04, 4.4, 4.23, 4.36, 29.41, 30.72, 32.92, 28.23, 23.35, 12, 38.87, 33.12, 39.15, 28.06, 38.23, 26.65),nrow=6, ncol=6, dimnames=list(1:6, LETTERS[1:6])) print(y) friedmanTest(y) ## Eisinga et al. 2017 frdAllPairsExactTest(y=y, p.adjust = "bonferroni") ## Conover's test frdAllPairsConoverTest(y=y, p.adjust = "bonferroni") ## Nemenyi's test frdAllPairsNemenyiTest(y=y) ## Miller et al. frdAllPairsMillerTest(y=y) ## Siegel-Castellan frdAllPairsSiegelTest(y=y, p.adjust = "bonferroni") ## Irrelevant of group order? x <- as.vector(y) g <- rep(colnames(y), each = length(x)/length(colnames(y))) b <- rep(rownames(y), times = length(x)/length(rownames(y))) xDF <- data.frame(x, g, b) # grouped by colnames frdAllPairsNemenyiTest(xDF$x, groups = xDF$g, blocks = xDF$b) o <- order(xDF$b) # order per block increasingly frdAllPairsNemenyiTest(xDF$x[o], groups = xDF$g[o], blocks = xDF$b[o]) o <- order(xDF$x) # order per value increasingly frdAllPairsNemenyiTest(xDF$x[o], groups = xDF$g[o], blocks = xDF$b[o]) ## formula method (only works for Nemenyi) frdAllPairsNemenyiTest(x ~ g | b, data = xDF)
Performs exact all-pairs comparisons tests of Friedman-type ranked data according to Eisinga et al. (2017).
frdAllPairsExactTest(y, ...) ## Default S3 method: frdAllPairsExactTest( y, groups, blocks, p.adjust.method = p.adjust.methods, ... )
frdAllPairsExactTest(y, ...) ## Default S3 method: frdAllPairsExactTest( y, groups, blocks, p.adjust.method = p.adjust.methods, ... )
y |
a numeric vector of data values, or a list of numeric data vectors. |
groups |
a vector or factor object giving the group for the
corresponding elements of |
blocks |
a vector or factor object giving the block for the
corresponding elements of |
p.adjust.method |
method for adjusting p values
(see |
... |
further arguments to be passed to or from methods. |
For all-pairs comparisons in a two factorial unreplicated complete block design with non-normally distributed residuals, an exact test can be performed on Friedman-type ranked data.
A total of hypotheses can be tested.
The null hypothesis, H
, is tested
in the two-tailed case against the alternative,
A
.
The exact -values
are computed using the code of
"pexactfrsd.R"
that was a supplement to the publication of Eisinga et al. (2017).
Additionally, any of the -adjustment methods
as included in
p.adjust
can be selected, for -value
adjustment.
A list with class "PMCMR"
containing the following components:
a character string indicating what type of test was performed.
a character string giving the name(s) of the data.
lower-triangle matrix of the estimated quantiles of the pairwise test statistics.
lower-triangle matrix of the p-values for the pairwise tests.
a character string describing the alternative hypothesis.
a character string describing the method for p-value adjustment.
a data frame of the input data.
a string that denotes the test distribution.
The function frdAllPairsExactTest
uses the code
of the file pexactfrsd.R
that was a supplement to:
R. Eisinga, T. Heskes, B. Pelzer, M. Te Grotenhuis (2017), Exact p-values for Pairwise Comparison of Friedman Rank Sums, with Application to Comparing Classifiers, BMC Bioinformatics, 18:68.
Eisinga, R., Heskes, T., Pelzer, B., Te Grotenhuis, M. (2017) Exact p-values for Pairwise Comparison of Friedman Rank Sums, with Application to Comparing Classifiers, BMC Bioinformatics, 18:68.
friedmanTest
, friedman.test
,
frdAllPairsConoverTest
, frdAllPairsMillerTest
,
frdAllPairsNemenyiTest
, frdAllPairsSiegelTest
## Sachs, 1997, p. 675 ## Six persons (block) received six different diuretics ## (A to F, treatment). ## The responses are the Na-concentration (mval) ## in the urine measured 2 hours after each treatment. ## y <- matrix(c( 3.88, 5.64, 5.76, 4.25, 5.91, 4.33, 30.58, 30.14, 16.92, 23.19, 26.74, 10.91, 25.24, 33.52, 25.45, 18.85, 20.45, 26.67, 4.44, 7.94, 4.04, 4.4, 4.23, 4.36, 29.41, 30.72, 32.92, 28.23, 23.35, 12, 38.87, 33.12, 39.15, 28.06, 38.23, 26.65),nrow=6, ncol=6, dimnames=list(1:6, LETTERS[1:6])) print(y) friedmanTest(y) ## Eisinga et al. 2017 frdAllPairsExactTest(y=y, p.adjust = "bonferroni") ## Conover's test frdAllPairsConoverTest(y=y, p.adjust = "bonferroni") ## Nemenyi's test frdAllPairsNemenyiTest(y=y) ## Miller et al. frdAllPairsMillerTest(y=y) ## Siegel-Castellan frdAllPairsSiegelTest(y=y, p.adjust = "bonferroni") ## Irrelevant of group order? x <- as.vector(y) g <- rep(colnames(y), each = length(x)/length(colnames(y))) b <- rep(rownames(y), times = length(x)/length(rownames(y))) xDF <- data.frame(x, g, b) # grouped by colnames frdAllPairsNemenyiTest(xDF$x, groups = xDF$g, blocks = xDF$b) o <- order(xDF$b) # order per block increasingly frdAllPairsNemenyiTest(xDF$x[o], groups = xDF$g[o], blocks = xDF$b[o]) o <- order(xDF$x) # order per value increasingly frdAllPairsNemenyiTest(xDF$x[o], groups = xDF$g[o], blocks = xDF$b[o]) ## formula method (only works for Nemenyi) frdAllPairsNemenyiTest(x ~ g | b, data = xDF)
## Sachs, 1997, p. 675 ## Six persons (block) received six different diuretics ## (A to F, treatment). ## The responses are the Na-concentration (mval) ## in the urine measured 2 hours after each treatment. ## y <- matrix(c( 3.88, 5.64, 5.76, 4.25, 5.91, 4.33, 30.58, 30.14, 16.92, 23.19, 26.74, 10.91, 25.24, 33.52, 25.45, 18.85, 20.45, 26.67, 4.44, 7.94, 4.04, 4.4, 4.23, 4.36, 29.41, 30.72, 32.92, 28.23, 23.35, 12, 38.87, 33.12, 39.15, 28.06, 38.23, 26.65),nrow=6, ncol=6, dimnames=list(1:6, LETTERS[1:6])) print(y) friedmanTest(y) ## Eisinga et al. 2017 frdAllPairsExactTest(y=y, p.adjust = "bonferroni") ## Conover's test frdAllPairsConoverTest(y=y, p.adjust = "bonferroni") ## Nemenyi's test frdAllPairsNemenyiTest(y=y) ## Miller et al. frdAllPairsMillerTest(y=y) ## Siegel-Castellan frdAllPairsSiegelTest(y=y, p.adjust = "bonferroni") ## Irrelevant of group order? x <- as.vector(y) g <- rep(colnames(y), each = length(x)/length(colnames(y))) b <- rep(rownames(y), times = length(x)/length(rownames(y))) xDF <- data.frame(x, g, b) # grouped by colnames frdAllPairsNemenyiTest(xDF$x, groups = xDF$g, blocks = xDF$b) o <- order(xDF$b) # order per block increasingly frdAllPairsNemenyiTest(xDF$x[o], groups = xDF$g[o], blocks = xDF$b[o]) o <- order(xDF$x) # order per value increasingly frdAllPairsNemenyiTest(xDF$x[o], groups = xDF$g[o], blocks = xDF$b[o]) ## formula method (only works for Nemenyi) frdAllPairsNemenyiTest(x ~ g | b, data = xDF)
Performs Miller's all-pairs comparisons tests of Friedman-type ranked data.
frdAllPairsMillerTest(y, ...) ## Default S3 method: frdAllPairsMillerTest(y, groups, blocks, ...)
frdAllPairsMillerTest(y, ...) ## Default S3 method: frdAllPairsMillerTest(y, groups, blocks, ...)
y |
a numeric vector of data values, or a list of numeric data vectors. |
groups |
a vector or factor object giving the group for the
corresponding elements of |
blocks |
a vector or factor object giving the block for the
corresponding elements of |
... |
further arguments to be passed to or from methods. |
For all-pairs comparisons in a two factorial unreplicated complete block design with non-normally distributed residuals, Miller's test can be performed on Friedman-type ranked data.
A total of hypotheses can be tested.
The null hypothesis, H
, is tested
in the two-tailed case against the alternative,
A
.
The -values are computed from the chi-square distribution.
A list with class "PMCMR"
containing the following components:
a character string indicating what type of test was performed.
a character string giving the name(s) of the data.
lower-triangle matrix of the estimated quantiles of the pairwise test statistics.
lower-triangle matrix of the p-values for the pairwise tests.
a character string describing the alternative hypothesis.
a character string describing the method for p-value adjustment.
a data frame of the input data.
a string that denotes the test distribution.
Bortz J., Lienert, G. A., Boehnke, K. (1990) Verteilungsfreie Methoden in der Biostatistik. Berlin: Springer.
Miller Jr., R. G. (1996) Simultaneous statistical inference. New York: McGraw-Hill.
Wike, E. L. (2006), Data Analysis. A Statistical Primer for Psychology Students. New Brunswick: Aldine Transaction.
friedmanTest
, friedman.test
,
frdAllPairsExactTest
, frdAllPairsConoverTest
,
frdAllPairsNemenyiTest
, frdAllPairsSiegelTest
## Sachs, 1997, p. 675 ## Six persons (block) received six different diuretics ## (A to F, treatment). ## The responses are the Na-concentration (mval) ## in the urine measured 2 hours after each treatment. ## y <- matrix(c( 3.88, 5.64, 5.76, 4.25, 5.91, 4.33, 30.58, 30.14, 16.92, 23.19, 26.74, 10.91, 25.24, 33.52, 25.45, 18.85, 20.45, 26.67, 4.44, 7.94, 4.04, 4.4, 4.23, 4.36, 29.41, 30.72, 32.92, 28.23, 23.35, 12, 38.87, 33.12, 39.15, 28.06, 38.23, 26.65),nrow=6, ncol=6, dimnames=list(1:6, LETTERS[1:6])) print(y) friedmanTest(y) ## Eisinga et al. 2017 frdAllPairsExactTest(y=y, p.adjust = "bonferroni") ## Conover's test frdAllPairsConoverTest(y=y, p.adjust = "bonferroni") ## Nemenyi's test frdAllPairsNemenyiTest(y=y) ## Miller et al. frdAllPairsMillerTest(y=y) ## Siegel-Castellan frdAllPairsSiegelTest(y=y, p.adjust = "bonferroni") ## Irrelevant of group order? x <- as.vector(y) g <- rep(colnames(y), each = length(x)/length(colnames(y))) b <- rep(rownames(y), times = length(x)/length(rownames(y))) xDF <- data.frame(x, g, b) # grouped by colnames frdAllPairsNemenyiTest(xDF$x, groups = xDF$g, blocks = xDF$b) o <- order(xDF$b) # order per block increasingly frdAllPairsNemenyiTest(xDF$x[o], groups = xDF$g[o], blocks = xDF$b[o]) o <- order(xDF$x) # order per value increasingly frdAllPairsNemenyiTest(xDF$x[o], groups = xDF$g[o], blocks = xDF$b[o]) ## formula method (only works for Nemenyi) frdAllPairsNemenyiTest(x ~ g | b, data = xDF)
## Sachs, 1997, p. 675 ## Six persons (block) received six different diuretics ## (A to F, treatment). ## The responses are the Na-concentration (mval) ## in the urine measured 2 hours after each treatment. ## y <- matrix(c( 3.88, 5.64, 5.76, 4.25, 5.91, 4.33, 30.58, 30.14, 16.92, 23.19, 26.74, 10.91, 25.24, 33.52, 25.45, 18.85, 20.45, 26.67, 4.44, 7.94, 4.04, 4.4, 4.23, 4.36, 29.41, 30.72, 32.92, 28.23, 23.35, 12, 38.87, 33.12, 39.15, 28.06, 38.23, 26.65),nrow=6, ncol=6, dimnames=list(1:6, LETTERS[1:6])) print(y) friedmanTest(y) ## Eisinga et al. 2017 frdAllPairsExactTest(y=y, p.adjust = "bonferroni") ## Conover's test frdAllPairsConoverTest(y=y, p.adjust = "bonferroni") ## Nemenyi's test frdAllPairsNemenyiTest(y=y) ## Miller et al. frdAllPairsMillerTest(y=y) ## Siegel-Castellan frdAllPairsSiegelTest(y=y, p.adjust = "bonferroni") ## Irrelevant of group order? x <- as.vector(y) g <- rep(colnames(y), each = length(x)/length(colnames(y))) b <- rep(rownames(y), times = length(x)/length(rownames(y))) xDF <- data.frame(x, g, b) # grouped by colnames frdAllPairsNemenyiTest(xDF$x, groups = xDF$g, blocks = xDF$b) o <- order(xDF$b) # order per block increasingly frdAllPairsNemenyiTest(xDF$x[o], groups = xDF$g[o], blocks = xDF$b[o]) o <- order(xDF$x) # order per value increasingly frdAllPairsNemenyiTest(xDF$x[o], groups = xDF$g[o], blocks = xDF$b[o]) ## formula method (only works for Nemenyi) frdAllPairsNemenyiTest(x ~ g | b, data = xDF)
Performs Nemenyi's all-pairs comparisons tests of Friedman-type ranked data.
frdAllPairsNemenyiTest(y, ...) ## Default S3 method: frdAllPairsNemenyiTest(y, groups, blocks, ...) ## S3 method for class 'formula' frdAllPairsNemenyiTest(formula, data, subset, na.action, ...)
frdAllPairsNemenyiTest(y, ...) ## Default S3 method: frdAllPairsNemenyiTest(y, groups, blocks, ...) ## S3 method for class 'formula' frdAllPairsNemenyiTest(formula, data, subset, na.action, ...)
y |
a numeric vector of data values, or a list of numeric data vectors. |
groups |
a vector or factor object giving the group for the
corresponding elements of |
blocks |
a vector or factor object giving the block for the
corresponding elements of |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
... |
further arguments to be passed to or from methods. |
For all-pairs comparisons in a two factorial unreplicated complete block design with non-normally distributed residuals, Nemenyi's test can be performed on Friedman-type ranked data.
A total of hypotheses can be tested.
The null hypothesis, H
, is tested
in the two-tailed case against the alternative,
A
.
The -values are computed from the studentized range distribution.
A list with class "PMCMR"
containing the following components:
a character string indicating what type of test was performed.
a character string giving the name(s) of the data.
lower-triangle matrix of the estimated quantiles of the pairwise test statistics.
lower-triangle matrix of the p-values for the pairwise tests.
a character string describing the alternative hypothesis.
a character string describing the method for p-value adjustment.
a data frame of the input data.
a string that denotes the test distribution.
Demsar, J. (2006) Statistical comparisons of classifiers over multiple data sets, Journal of Machine Learning Research 7, 1–30.
Miller Jr., R. G. (1996) Simultaneous statistical inference. New York: McGraw-Hill.
Nemenyi, P. (1963), Distribution-free Multiple Comparisons. Ph.D. thesis, Princeton University.
Sachs, L. (1997) Angewandte Statistik. Berlin: Springer.
friedmanTest
, friedman.test
,
frdAllPairsExactTest
, frdAllPairsConoverTest
,
frdAllPairsMillerTest
, frdAllPairsSiegelTest
## Sachs, 1997, p. 675 ## Six persons (block) received six different diuretics ## (A to F, treatment). ## The responses are the Na-concentration (mval) ## in the urine measured 2 hours after each treatment. ## y <- matrix(c( 3.88, 5.64, 5.76, 4.25, 5.91, 4.33, 30.58, 30.14, 16.92, 23.19, 26.74, 10.91, 25.24, 33.52, 25.45, 18.85, 20.45, 26.67, 4.44, 7.94, 4.04, 4.4, 4.23, 4.36, 29.41, 30.72, 32.92, 28.23, 23.35, 12, 38.87, 33.12, 39.15, 28.06, 38.23, 26.65),nrow=6, ncol=6, dimnames=list(1:6, LETTERS[1:6])) print(y) friedmanTest(y) ## Eisinga et al. 2017 frdAllPairsExactTest(y=y, p.adjust = "bonferroni") ## Conover's test frdAllPairsConoverTest(y=y, p.adjust = "bonferroni") ## Nemenyi's test frdAllPairsNemenyiTest(y=y) ## Miller et al. frdAllPairsMillerTest(y=y) ## Siegel-Castellan frdAllPairsSiegelTest(y=y, p.adjust = "bonferroni") ## Irrelevant of group order? x <- as.vector(y) g <- rep(colnames(y), each = length(x)/length(colnames(y))) b <- rep(rownames(y), times = length(x)/length(rownames(y))) xDF <- data.frame(x, g, b) # grouped by colnames frdAllPairsNemenyiTest(xDF$x, groups = xDF$g, blocks = xDF$b) o <- order(xDF$b) # order per block increasingly frdAllPairsNemenyiTest(xDF$x[o], groups = xDF$g[o], blocks = xDF$b[o]) o <- order(xDF$x) # order per value increasingly frdAllPairsNemenyiTest(xDF$x[o], groups = xDF$g[o], blocks = xDF$b[o]) ## formula method (only works for Nemenyi) frdAllPairsNemenyiTest(x ~ g | b, data = xDF)
## Sachs, 1997, p. 675 ## Six persons (block) received six different diuretics ## (A to F, treatment). ## The responses are the Na-concentration (mval) ## in the urine measured 2 hours after each treatment. ## y <- matrix(c( 3.88, 5.64, 5.76, 4.25, 5.91, 4.33, 30.58, 30.14, 16.92, 23.19, 26.74, 10.91, 25.24, 33.52, 25.45, 18.85, 20.45, 26.67, 4.44, 7.94, 4.04, 4.4, 4.23, 4.36, 29.41, 30.72, 32.92, 28.23, 23.35, 12, 38.87, 33.12, 39.15, 28.06, 38.23, 26.65),nrow=6, ncol=6, dimnames=list(1:6, LETTERS[1:6])) print(y) friedmanTest(y) ## Eisinga et al. 2017 frdAllPairsExactTest(y=y, p.adjust = "bonferroni") ## Conover's test frdAllPairsConoverTest(y=y, p.adjust = "bonferroni") ## Nemenyi's test frdAllPairsNemenyiTest(y=y) ## Miller et al. frdAllPairsMillerTest(y=y) ## Siegel-Castellan frdAllPairsSiegelTest(y=y, p.adjust = "bonferroni") ## Irrelevant of group order? x <- as.vector(y) g <- rep(colnames(y), each = length(x)/length(colnames(y))) b <- rep(rownames(y), times = length(x)/length(rownames(y))) xDF <- data.frame(x, g, b) # grouped by colnames frdAllPairsNemenyiTest(xDF$x, groups = xDF$g, blocks = xDF$b) o <- order(xDF$b) # order per block increasingly frdAllPairsNemenyiTest(xDF$x[o], groups = xDF$g[o], blocks = xDF$b[o]) o <- order(xDF$x) # order per value increasingly frdAllPairsNemenyiTest(xDF$x[o], groups = xDF$g[o], blocks = xDF$b[o]) ## formula method (only works for Nemenyi) frdAllPairsNemenyiTest(x ~ g | b, data = xDF)
Performs Siegel and Castellan's all-pairs comparisons tests of Friedman-type ranked data.
frdAllPairsSiegelTest(y, ...) ## Default S3 method: frdAllPairsSiegelTest( y, groups, blocks, p.adjust.method = p.adjust.methods, ... )
frdAllPairsSiegelTest(y, ...) ## Default S3 method: frdAllPairsSiegelTest( y, groups, blocks, p.adjust.method = p.adjust.methods, ... )
y |
a numeric vector of data values, or a list of numeric data vectors. |
groups |
a vector or factor object giving the group for the
corresponding elements of |
blocks |
a vector or factor object giving the block for the
corresponding elements of |
p.adjust.method |
method for adjusting p values
(see |
... |
further arguments to be passed to or from methods. |
For all-pairs comparisons in a two factorial unreplicated complete block design with non-normally distributed residuals, Siegel and Castellan's test can be performed on Friedman-type ranked data.
A total of hypotheses can be tested.
The null hypothesis, H
, is tested
in the two-tailed case against the alternative,
A
.
The -values are computed from the standard normal distribution.
Any method as implemented in
p.adjust
can be used for
p
-value adjustment.
A list with class "PMCMR"
containing the following components:
a character string indicating what type of test was performed.
a character string giving the name(s) of the data.
lower-triangle matrix of the estimated quantiles of the pairwise test statistics.
lower-triangle matrix of the p-values for the pairwise tests.
a character string describing the alternative hypothesis.
a character string describing the method for p-value adjustment.
a data frame of the input data.
a string that denotes the test distribution.
Siegel, S., Castellan Jr., N. J. (1988) Nonparametric Statistics for the Behavioral Sciences. 2nd ed. New York: McGraw-Hill.
friedmanTest
, friedman.test
,
frdAllPairsExactTest
, frdAllPairsConoverTest
,
frdAllPairsNemenyiTest
, frdAllPairsMillerTest
## Sachs, 1997, p. 675 ## Six persons (block) received six different diuretics ## (A to F, treatment). ## The responses are the Na-concentration (mval) ## in the urine measured 2 hours after each treatment. ## y <- matrix(c( 3.88, 5.64, 5.76, 4.25, 5.91, 4.33, 30.58, 30.14, 16.92, 23.19, 26.74, 10.91, 25.24, 33.52, 25.45, 18.85, 20.45, 26.67, 4.44, 7.94, 4.04, 4.4, 4.23, 4.36, 29.41, 30.72, 32.92, 28.23, 23.35, 12, 38.87, 33.12, 39.15, 28.06, 38.23, 26.65),nrow=6, ncol=6, dimnames=list(1:6, LETTERS[1:6])) print(y) friedmanTest(y) ## Eisinga et al. 2017 frdAllPairsExactTest(y=y, p.adjust = "bonferroni") ## Conover's test frdAllPairsConoverTest(y=y, p.adjust = "bonferroni") ## Nemenyi's test frdAllPairsNemenyiTest(y=y) ## Miller et al. frdAllPairsMillerTest(y=y) ## Siegel-Castellan frdAllPairsSiegelTest(y=y, p.adjust = "bonferroni") ## Irrelevant of group order? x <- as.vector(y) g <- rep(colnames(y), each = length(x)/length(colnames(y))) b <- rep(rownames(y), times = length(x)/length(rownames(y))) xDF <- data.frame(x, g, b) # grouped by colnames frdAllPairsNemenyiTest(xDF$x, groups = xDF$g, blocks = xDF$b) o <- order(xDF$b) # order per block increasingly frdAllPairsNemenyiTest(xDF$x[o], groups = xDF$g[o], blocks = xDF$b[o]) o <- order(xDF$x) # order per value increasingly frdAllPairsNemenyiTest(xDF$x[o], groups = xDF$g[o], blocks = xDF$b[o]) ## formula method (only works for Nemenyi) frdAllPairsNemenyiTest(x ~ g | b, data = xDF)
## Sachs, 1997, p. 675 ## Six persons (block) received six different diuretics ## (A to F, treatment). ## The responses are the Na-concentration (mval) ## in the urine measured 2 hours after each treatment. ## y <- matrix(c( 3.88, 5.64, 5.76, 4.25, 5.91, 4.33, 30.58, 30.14, 16.92, 23.19, 26.74, 10.91, 25.24, 33.52, 25.45, 18.85, 20.45, 26.67, 4.44, 7.94, 4.04, 4.4, 4.23, 4.36, 29.41, 30.72, 32.92, 28.23, 23.35, 12, 38.87, 33.12, 39.15, 28.06, 38.23, 26.65),nrow=6, ncol=6, dimnames=list(1:6, LETTERS[1:6])) print(y) friedmanTest(y) ## Eisinga et al. 2017 frdAllPairsExactTest(y=y, p.adjust = "bonferroni") ## Conover's test frdAllPairsConoverTest(y=y, p.adjust = "bonferroni") ## Nemenyi's test frdAllPairsNemenyiTest(y=y) ## Miller et al. frdAllPairsMillerTest(y=y) ## Siegel-Castellan frdAllPairsSiegelTest(y=y, p.adjust = "bonferroni") ## Irrelevant of group order? x <- as.vector(y) g <- rep(colnames(y), each = length(x)/length(colnames(y))) b <- rep(rownames(y), times = length(x)/length(rownames(y))) xDF <- data.frame(x, g, b) # grouped by colnames frdAllPairsNemenyiTest(xDF$x, groups = xDF$g, blocks = xDF$b) o <- order(xDF$b) # order per block increasingly frdAllPairsNemenyiTest(xDF$x[o], groups = xDF$g[o], blocks = xDF$b[o]) o <- order(xDF$x) # order per value increasingly frdAllPairsNemenyiTest(xDF$x[o], groups = xDF$g[o], blocks = xDF$b[o]) ## formula method (only works for Nemenyi) frdAllPairsNemenyiTest(x ~ g | b, data = xDF)
Performs House nonparametric equivalent of William's test for contrasting increasing dose levels of a treatment in a complete randomized block design.
frdHouseTest(y, ...) ## Default S3 method: frdHouseTest(y, groups, blocks, alternative = c("greater", "less"), ...)
frdHouseTest(y, ...) ## Default S3 method: frdHouseTest(y, groups, blocks, alternative = c("greater", "less"), ...)
y |
a numeric vector of data values, or a list of numeric data vectors. |
groups |
a vector or factor object giving the group for the
corresponding elements of |
blocks |
a vector or factor object giving the block for the
corresponding elements of |
alternative |
the alternative hypothesis. Defaults to |
... |
further arguments to be passed to or from methods. |
House test is a non-parametric step-down trend test for testing several treatment levels
with a zero control. Let there be groups including the control and let
the zero dose level be indicated with
and the highest
dose level with
, then the following
m = k - 1
hypotheses are tested:
Let be a i.i.d. random variable
of at least ordinal scale. Further, let
be Friedman's average ranks and set
to be its isotonic regression estimators under the order restriction
.
The statistics is
with
and
where is the number of tied ranks.
The critical -values
as given in the tables of Williams (1972) for
(one-sided)
are looked up according to the degree of freedoms (
) and the order number of the
dose level (
).
For the comparison of the first dose level with the control, the critical
z-value from the standard normal distribution is used (
Normal
).
A list with class "PMCMR"
containing the following components:
a character string indicating what type of test was performed.
a character string giving the name(s) of the data.
lower-triangle matrix of the estimated quantiles of the pairwise test statistics.
lower-triangle matrix of the p-values for the pairwise tests.
a character string describing the alternative hypothesis.
a character string describing the method for p-value adjustment.
a data frame of the input data.
a string that denotes the test distribution.
Chen, Y.-I., 1999. Rank-Based Tests for Dose Finding in Nonmonotonic Dose–Response Settings. Biometrics 55, 1258–1262. doi:10.1111/j.0006-341X.1999.01258.x
House, D.E., 1986. A Nonparametric Version of Williams’ Test for Randomized Block Design. Biometrics 42, 187–190.
friedmanTest
, friedman.test
,
frdManyOneExactTest
, frdManyOneDemsarTest
## Sachs, 1997, p. 675 ## Six persons (block) received six different diuretics ## (A to F, treatment). ## The responses are the Na-concentration (mval) ## in the urine measured 2 hours after each treatment. ## Assume A is the control. y <- matrix(c( 3.88, 5.64, 5.76, 4.25, 5.91, 4.33, 30.58, 30.14, 16.92, 23.19, 26.74, 10.91, 25.24, 33.52, 25.45, 18.85, 20.45, 26.67, 4.44, 7.94, 4.04, 4.4, 4.23, 4.36, 29.41, 30.72, 32.92, 28.23, 23.35, 12, 38.87, 33.12, 39.15, 28.06, 38.23, 26.65),nrow=6, ncol=6, dimnames=list(1:6, LETTERS[1:6])) ## Global Friedman test friedmanTest(y) ## Demsar's many-one test summary(frdManyOneDemsarTest(y=y, p.adjust = "bonferroni", alternative = "greater")) ## Exact many-one test summary(frdManyOneExactTest(y=y, p.adjust = "bonferroni", alternative = "greater")) ## Nemenyi's many-one test summary(frdManyOneNemenyiTest(y=y, alternative = "greater")) ## House test frdHouseTest(y, alternative = "greater")
## Sachs, 1997, p. 675 ## Six persons (block) received six different diuretics ## (A to F, treatment). ## The responses are the Na-concentration (mval) ## in the urine measured 2 hours after each treatment. ## Assume A is the control. y <- matrix(c( 3.88, 5.64, 5.76, 4.25, 5.91, 4.33, 30.58, 30.14, 16.92, 23.19, 26.74, 10.91, 25.24, 33.52, 25.45, 18.85, 20.45, 26.67, 4.44, 7.94, 4.04, 4.4, 4.23, 4.36, 29.41, 30.72, 32.92, 28.23, 23.35, 12, 38.87, 33.12, 39.15, 28.06, 38.23, 26.65),nrow=6, ncol=6, dimnames=list(1:6, LETTERS[1:6])) ## Global Friedman test friedmanTest(y) ## Demsar's many-one test summary(frdManyOneDemsarTest(y=y, p.adjust = "bonferroni", alternative = "greater")) ## Exact many-one test summary(frdManyOneExactTest(y=y, p.adjust = "bonferroni", alternative = "greater")) ## Nemenyi's many-one test summary(frdManyOneNemenyiTest(y=y, alternative = "greater")) ## House test frdHouseTest(y, alternative = "greater")
Performs Demsar's non-parametric many-to-one comparison test for Friedman-type ranked data.
frdManyOneDemsarTest(y, ...) ## Default S3 method: frdManyOneDemsarTest( y, groups, blocks, alternative = c("two.sided", "greater", "less"), p.adjust.method = p.adjust.methods, ... )
frdManyOneDemsarTest(y, ...) ## Default S3 method: frdManyOneDemsarTest( y, groups, blocks, alternative = c("two.sided", "greater", "less"), p.adjust.method = p.adjust.methods, ... )
y |
a numeric vector of data values, or a list of numeric data vectors. |
groups |
a vector or factor object giving the group for the
corresponding elements of |
blocks |
a vector or factor object giving the block for the
corresponding elements of |
alternative |
the alternative hypothesis. Defaults to |
p.adjust.method |
method for adjusting p values
(see |
... |
further arguments to be passed to or from methods. |
For many-to-one comparisons (pairwise comparisons with one control) in a two factorial unreplicated complete block design with non-normally distributed residuals, Demsar's test can be performed on Friedman-type ranked data.
Let there be groups including the control,
then the number of treatment levels is
.
A total of
pairwise comparisons can be performed between
the
-th treatment level and the control.
H
is tested in the two-tailed case against
A
.
The -values are computed from the standard normal distribution.
Any of the
-adjustment methods as included in
p.adjust
can be used for the adjustment of -values.
A list with class "PMCMR"
containing the following components:
a character string indicating what type of test was performed.
a character string giving the name(s) of the data.
lower-triangle matrix of the estimated quantiles of the pairwise test statistics.
lower-triangle matrix of the p-values for the pairwise tests.
a character string describing the alternative hypothesis.
a character string describing the method for p-value adjustment.
a data frame of the input data.
a string that denotes the test distribution.
Demsar, J. (2006) Statistical comparisons of classifiers over multiple data sets, Journal of Machine Learning Research 7, 1–30.
friedmanTest
, friedman.test
,
frdManyOneExactTest
, frdManyOneNemenyiTest
.
## Sachs, 1997, p. 675 ## Six persons (block) received six different diuretics ## (A to F, treatment). ## The responses are the Na-concentration (mval) ## in the urine measured 2 hours after each treatment. ## Assume A is the control. y <- matrix(c( 3.88, 5.64, 5.76, 4.25, 5.91, 4.33, 30.58, 30.14, 16.92, 23.19, 26.74, 10.91, 25.24, 33.52, 25.45, 18.85, 20.45, 26.67, 4.44, 7.94, 4.04, 4.4, 4.23, 4.36, 29.41, 30.72, 32.92, 28.23, 23.35, 12, 38.87, 33.12, 39.15, 28.06, 38.23, 26.65),nrow=6, ncol=6, dimnames=list(1:6, LETTERS[1:6])) ## Global Friedman test friedmanTest(y) ## Demsar's many-one test summary(frdManyOneDemsarTest(y=y, p.adjust = "bonferroni", alternative = "greater")) ## Exact many-one test summary(frdManyOneExactTest(y=y, p.adjust = "bonferroni", alternative = "greater")) ## Nemenyi's many-one test summary(frdManyOneNemenyiTest(y=y, alternative = "greater")) ## House test frdHouseTest(y, alternative = "greater")
## Sachs, 1997, p. 675 ## Six persons (block) received six different diuretics ## (A to F, treatment). ## The responses are the Na-concentration (mval) ## in the urine measured 2 hours after each treatment. ## Assume A is the control. y <- matrix(c( 3.88, 5.64, 5.76, 4.25, 5.91, 4.33, 30.58, 30.14, 16.92, 23.19, 26.74, 10.91, 25.24, 33.52, 25.45, 18.85, 20.45, 26.67, 4.44, 7.94, 4.04, 4.4, 4.23, 4.36, 29.41, 30.72, 32.92, 28.23, 23.35, 12, 38.87, 33.12, 39.15, 28.06, 38.23, 26.65),nrow=6, ncol=6, dimnames=list(1:6, LETTERS[1:6])) ## Global Friedman test friedmanTest(y) ## Demsar's many-one test summary(frdManyOneDemsarTest(y=y, p.adjust = "bonferroni", alternative = "greater")) ## Exact many-one test summary(frdManyOneExactTest(y=y, p.adjust = "bonferroni", alternative = "greater")) ## Nemenyi's many-one test summary(frdManyOneNemenyiTest(y=y, alternative = "greater")) ## House test frdHouseTest(y, alternative = "greater")
Performs an exact non-parametric many-to-one comparison test for Friedman-type ranked data according to Eisinga et al. (2017).
frdManyOneExactTest(y, ...) ## Default S3 method: frdManyOneExactTest(y, groups, blocks, p.adjust.method = p.adjust.methods, ...)
frdManyOneExactTest(y, ...) ## Default S3 method: frdManyOneExactTest(y, groups, blocks, p.adjust.method = p.adjust.methods, ...)
y |
a numeric vector of data values, or a list of numeric data vectors. |
groups |
a vector or factor object giving the group for the
corresponding elements of |
blocks |
a vector or factor object giving the block for the
corresponding elements of |
p.adjust.method |
method for adjusting p values
(see |
... |
further arguments to be passed to or from methods. |
For many-to-one comparisons (pairwise comparisons with one control) in a two factorial unreplicated complete block design with non-normally distributed residuals, an exact test can be performed on Friedman-type ranked data.
Let there be groups including the control,
then the number of treatment levels is
.
A total of
pairwise comparisons can be performed between
the
-th treatment level and the control.
H
is tested in the two-tailed case against
A
.
The exact -values
are computed using the code of
"pexactfrsd.R"
that was a supplement to the publication of Eisinga et al. (2017).
Additionally, any of the -adjustment methods
as included in
p.adjust
can be selected, for -value
adjustment.
A list with class "PMCMR"
containing the following components:
a character string indicating what type of test was performed.
a character string giving the name(s) of the data.
lower-triangle matrix of the estimated quantiles of the pairwise test statistics.
lower-triangle matrix of the p-values for the pairwise tests.
a character string describing the alternative hypothesis.
a character string describing the method for p-value adjustment.
a data frame of the input data.
a string that denotes the test distribution.
Eisinga, R., Heskes, T., Pelzer, B., Te Grotenhuis, M. (2017) Exact p-values for Pairwise Comparison of Friedman Rank Sums, with Application to Comparing Classifiers, BMC Bioinformatics, 18:68.
friedmanTest
, friedman.test
,
frdManyOneDemsarTest
, frdManyOneNemenyiTest
.
## Sachs, 1997, p. 675 ## Six persons (block) received six different diuretics ## (A to F, treatment). ## The responses are the Na-concentration (mval) ## in the urine measured 2 hours after each treatment. ## Assume A is the control. y <- matrix(c( 3.88, 5.64, 5.76, 4.25, 5.91, 4.33, 30.58, 30.14, 16.92, 23.19, 26.74, 10.91, 25.24, 33.52, 25.45, 18.85, 20.45, 26.67, 4.44, 7.94, 4.04, 4.4, 4.23, 4.36, 29.41, 30.72, 32.92, 28.23, 23.35, 12, 38.87, 33.12, 39.15, 28.06, 38.23, 26.65),nrow=6, ncol=6, dimnames=list(1:6, LETTERS[1:6])) ## Global Friedman test friedmanTest(y) ## Demsar's many-one test summary(frdManyOneDemsarTest(y=y, p.adjust = "bonferroni", alternative = "greater")) ## Exact many-one test summary(frdManyOneExactTest(y=y, p.adjust = "bonferroni", alternative = "greater")) ## Nemenyi's many-one test summary(frdManyOneNemenyiTest(y=y, alternative = "greater")) ## House test frdHouseTest(y, alternative = "greater")
## Sachs, 1997, p. 675 ## Six persons (block) received six different diuretics ## (A to F, treatment). ## The responses are the Na-concentration (mval) ## in the urine measured 2 hours after each treatment. ## Assume A is the control. y <- matrix(c( 3.88, 5.64, 5.76, 4.25, 5.91, 4.33, 30.58, 30.14, 16.92, 23.19, 26.74, 10.91, 25.24, 33.52, 25.45, 18.85, 20.45, 26.67, 4.44, 7.94, 4.04, 4.4, 4.23, 4.36, 29.41, 30.72, 32.92, 28.23, 23.35, 12, 38.87, 33.12, 39.15, 28.06, 38.23, 26.65),nrow=6, ncol=6, dimnames=list(1:6, LETTERS[1:6])) ## Global Friedman test friedmanTest(y) ## Demsar's many-one test summary(frdManyOneDemsarTest(y=y, p.adjust = "bonferroni", alternative = "greater")) ## Exact many-one test summary(frdManyOneExactTest(y=y, p.adjust = "bonferroni", alternative = "greater")) ## Nemenyi's many-one test summary(frdManyOneNemenyiTest(y=y, alternative = "greater")) ## House test frdHouseTest(y, alternative = "greater")
Performs Nemenyi's non-parametric many-to-one comparison test for Friedman-type ranked data.
frdManyOneNemenyiTest(y, ...) ## Default S3 method: frdManyOneNemenyiTest( y, groups, blocks, alternative = c("two.sided", "greater", "less"), ... )
frdManyOneNemenyiTest(y, ...) ## Default S3 method: frdManyOneNemenyiTest( y, groups, blocks, alternative = c("two.sided", "greater", "less"), ... )
y |
a numeric vector of data values, or a list of numeric data vectors. |
groups |
a vector or factor object giving the group for the
corresponding elements of |
blocks |
a vector or factor object giving the block for the
corresponding elements of |
alternative |
the alternative hypothesis. Defaults to |
... |
further arguments to be passed to or from methods. |
For many-to-one comparisons (pairwise comparisons with one control) in a two factorial unreplicated complete block design with non-normally distributed residuals, Nemenyi's test can be performed on Friedman-type ranked data.
Let there be groups including the control,
then the number of treatment levels is
.
A total of
pairwise comparisons can be performed between
the
-th treatment level and the control.
H
is tested in the two-tailed case against
A
.
The -values are computed from the multivariate normal distribution.
As
pmvnorm
applies a numerical method, the estimated
-values are seet depended.
A list with class "PMCMR"
containing the following components:
a character string indicating what type of test was performed.
a character string giving the name(s) of the data.
lower-triangle matrix of the estimated quantiles of the pairwise test statistics.
lower-triangle matrix of the p-values for the pairwise tests.
a character string describing the alternative hypothesis.
a character string describing the method for p-value adjustment.
a data frame of the input data.
a string that denotes the test distribution.
Hollander, M., Wolfe, D. A., Chicken, E. (2014), Nonparametric Statistical Methods. 3rd ed. New York: Wiley. 2014.
Miller Jr., R. G. (1996), Simultaneous Statistical Inference. New York: McGraw-Hill.
Nemenyi, P. (1963), Distribution-free Multiple Comparisons. Ph.D. thesis, Princeton University.
Siegel, S., Castellan Jr., N. J. (1988), Nonparametric Statistics for the Behavioral Sciences. 2nd ed. New York: McGraw-Hill.
Zarr, J. H. (1999), Biostatistical Analysis. 4th ed. Upper Saddle River: Prentice-Hall.
friedmanTest
, friedman.test
,
frdManyOneExactTest
, frdManyOneDemsarTest
pmvnorm
, set.seed
## Sachs, 1997, p. 675 ## Six persons (block) received six different diuretics ## (A to F, treatment). ## The responses are the Na-concentration (mval) ## in the urine measured 2 hours after each treatment. ## Assume A is the control. y <- matrix(c( 3.88, 5.64, 5.76, 4.25, 5.91, 4.33, 30.58, 30.14, 16.92, 23.19, 26.74, 10.91, 25.24, 33.52, 25.45, 18.85, 20.45, 26.67, 4.44, 7.94, 4.04, 4.4, 4.23, 4.36, 29.41, 30.72, 32.92, 28.23, 23.35, 12, 38.87, 33.12, 39.15, 28.06, 38.23, 26.65),nrow=6, ncol=6, dimnames=list(1:6, LETTERS[1:6])) ## Global Friedman test friedmanTest(y) ## Demsar's many-one test summary(frdManyOneDemsarTest(y=y, p.adjust = "bonferroni", alternative = "greater")) ## Exact many-one test summary(frdManyOneExactTest(y=y, p.adjust = "bonferroni", alternative = "greater")) ## Nemenyi's many-one test summary(frdManyOneNemenyiTest(y=y, alternative = "greater")) ## House test frdHouseTest(y, alternative = "greater")
## Sachs, 1997, p. 675 ## Six persons (block) received six different diuretics ## (A to F, treatment). ## The responses are the Na-concentration (mval) ## in the urine measured 2 hours after each treatment. ## Assume A is the control. y <- matrix(c( 3.88, 5.64, 5.76, 4.25, 5.91, 4.33, 30.58, 30.14, 16.92, 23.19, 26.74, 10.91, 25.24, 33.52, 25.45, 18.85, 20.45, 26.67, 4.44, 7.94, 4.04, 4.4, 4.23, 4.36, 29.41, 30.72, 32.92, 28.23, 23.35, 12, 38.87, 33.12, 39.15, 28.06, 38.23, 26.65),nrow=6, ncol=6, dimnames=list(1:6, LETTERS[1:6])) ## Global Friedman test friedmanTest(y) ## Demsar's many-one test summary(frdManyOneDemsarTest(y=y, p.adjust = "bonferroni", alternative = "greater")) ## Exact many-one test summary(frdManyOneExactTest(y=y, p.adjust = "bonferroni", alternative = "greater")) ## Nemenyi's many-one test summary(frdManyOneNemenyiTest(y=y, alternative = "greater")) ## House test frdHouseTest(y, alternative = "greater")
Performs a Friedman rank sum test. The null hypothesis
H is tested against the
alternative H
, with at least
one inequality beeing strict.
friedmanTest(y, ...) ## Default S3 method: friedmanTest(y, groups, blocks, dist = c("Chisquare", "FDist"), ...)
friedmanTest(y, ...) ## Default S3 method: friedmanTest(y, groups, blocks, dist = c("Chisquare", "FDist"), ...)
y |
a numeric vector of data values, or a list of numeric data vectors. |
groups |
a vector or factor object giving the group for the
corresponding elements of |
blocks |
a vector or factor object giving the block for the
corresponding elements of |
dist |
the test distribution. Defaults to |
... |
further arguments to be passed to or from methods. |
The function has implemented Friedman's test as well as
the extension of Conover anf Iman (1981). Friedman's
test statistic is assymptotically chi-squared distributed.
Consequently, the default test distribution is dist = "Chisquare"
.
If dist = "FDist"
is selected, than the approach of
Conover and Imam (1981) is performed.
The Friedman Test using the -distribution leads to
the same results as doing an two-way Analysis of Variance without
interaction on rank transformed data.
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.
Conover, W.J., Iman, R.L. (1981) Rank Transformations as a Bridge Between Parametric and Nonparametric Statistics. Am Stat 35, 124–129.
Sachs, L. (1997) Angewandte Statistik. Berlin: Springer.
## Hollander & Wolfe (1973), p. 140ff. ## Comparison of three methods ("round out", "narrow angle", and ## "wide angle") for rounding first base. For each of 18 players ## and the three method, the average time of two runs from a point on ## the first base line 35ft from home plate to a point 15ft short of ## second base is recorded. RoundingTimes <- matrix(c(5.40, 5.50, 5.55, 5.85, 5.70, 5.75, 5.20, 5.60, 5.50, 5.55, 5.50, 5.40, 5.90, 5.85, 5.70, 5.45, 5.55, 5.60, 5.40, 5.40, 5.35, 5.45, 5.50, 5.35, 5.25, 5.15, 5.00, 5.85, 5.80, 5.70, 5.25, 5.20, 5.10, 5.65, 5.55, 5.45, 5.60, 5.35, 5.45, 5.05, 5.00, 4.95, 5.50, 5.50, 5.40, 5.45, 5.55, 5.50, 5.55, 5.55, 5.35, 5.45, 5.50, 5.55, 5.50, 5.45, 5.25, 5.65, 5.60, 5.40, 5.70, 5.65, 5.55, 6.30, 6.30, 6.25), nrow = 22, byrow = TRUE, dimnames = list(1 : 22, c("Round Out", "Narrow Angle", "Wide Angle"))) ## Chisquare distribution friedmanTest(RoundingTimes) ## check with friedman.test from R stats friedman.test(RoundingTimes) ## F-distribution friedmanTest(RoundingTimes, dist = "FDist") ## Check with One-way repeated measure ANOVA rmat <- RoundingTimes for (i in 1:length(RoundingTimes[,1])) rmat[i,] <- rank(rmat[i,]) dataf <- data.frame( y = y <- as.vector(rmat), g = g <- factor(c(col(RoundingTimes))), b = b <- factor(c(row(RoundingTimes)))) summary(aov(y ~ g + Error(b), data = dataf))
## Hollander & Wolfe (1973), p. 140ff. ## Comparison of three methods ("round out", "narrow angle", and ## "wide angle") for rounding first base. For each of 18 players ## and the three method, the average time of two runs from a point on ## the first base line 35ft from home plate to a point 15ft short of ## second base is recorded. RoundingTimes <- matrix(c(5.40, 5.50, 5.55, 5.85, 5.70, 5.75, 5.20, 5.60, 5.50, 5.55, 5.50, 5.40, 5.90, 5.85, 5.70, 5.45, 5.55, 5.60, 5.40, 5.40, 5.35, 5.45, 5.50, 5.35, 5.25, 5.15, 5.00, 5.85, 5.80, 5.70, 5.25, 5.20, 5.10, 5.65, 5.55, 5.45, 5.60, 5.35, 5.45, 5.05, 5.00, 4.95, 5.50, 5.50, 5.40, 5.45, 5.55, 5.50, 5.55, 5.55, 5.35, 5.45, 5.50, 5.55, 5.50, 5.45, 5.25, 5.65, 5.60, 5.40, 5.70, 5.65, 5.55, 6.30, 6.30, 6.25), nrow = 22, byrow = TRUE, dimnames = list(1 : 22, c("Round Out", "Narrow Angle", "Wide Angle"))) ## Chisquare distribution friedmanTest(RoundingTimes) ## check with friedman.test from R stats friedman.test(RoundingTimes) ## F-distribution friedmanTest(RoundingTimes, dist = "FDist") ## Check with One-way repeated measure ANOVA rmat <- RoundingTimes for (i in 1:length(RoundingTimes[,1])) rmat[i,] <- rank(rmat[i,]) dataf <- data.frame( y = y <- as.vector(rmat), g = g <- factor(c(col(RoundingTimes))), b = b <- factor(c(row(RoundingTimes)))) summary(aov(y ~ g + Error(b), data = dataf))
Performs Games-Howell all-pairs comparison test for normally distributed data with unequal group variances.
gamesHowellTest(x, ...) ## Default S3 method: gamesHowellTest(x, g, ...) ## S3 method for class 'formula' gamesHowellTest(formula, data, subset, na.action, ...) ## S3 method for class 'aov' gamesHowellTest(x, ...)
gamesHowellTest(x, ...) ## Default S3 method: gamesHowellTest(x, g, ...) ## S3 method for class 'formula' gamesHowellTest(formula, data, subset, na.action, ...) ## S3 method for class 'aov' gamesHowellTest(x, ...)
x |
a numeric vector of data values, a list of numeric data vectors or a fitted model object, usually an aov fit. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
For all-pairs comparisons in an one-factorial layout
with normally distributed residuals but unequal between-groups variances
the Games-Howell Test can be performed. Let denote a continuous random variable
with the
-the realization (
)
in the
-th group (
). Furthermore, the total
sample size is
. A total of
hypotheses can be tested: The null hypothesis is
H
is tested against the alternative
A
(two-tailed). Games-Howell Test all-pairs
test statistics are given by
with the variance of the
-th group.
The null hypothesis is rejected (two-tailed) if
with Welch's approximate solution for calculating the degree of freedom.
The -values are computed from the
Tukey
distribution.
A list with class "PMCMR"
containing the following components:
a character string indicating what type of test was performed.
a character string giving the name(s) of the data.
lower-triangle matrix of the estimated quantiles of the pairwise test statistics.
lower-triangle matrix of the p-values for the pairwise tests.
a character string describing the alternative hypothesis.
a character string describing the method for p-value adjustment.
a data frame of the input data.
a string that denotes the test distribution.
fit <- aov(weight ~ feed, chickwts) shapiro.test(residuals(fit)) bartlett.test(weight ~ feed, chickwts) # var1 = varN anova(fit) ## also works with fitted objects of class aov res <- gamesHowellTest(fit) summary(res) summaryGroup(res)
fit <- aov(weight ~ feed, chickwts) shapiro.test(residuals(fit)) bartlett.test(weight ~ feed, chickwts) # var1 = varN anova(fit) ## also works with fitted objects of class aov res <- gamesHowellTest(fit) summary(res) summaryGroup(res)
Performs Rosner's generalized extreme studentized deviate
procedure to detect up-to maxr
outliers in a
univariate sample that follows an approximately normal distribution.
gesdTest(x, maxr)
gesdTest(x, maxr)
x |
a numeric vector of data. |
maxr |
the maximum number of outliers to be tested. |
Rosner, B. (1983) Percentage Points for a Generalized ESD Many-Outlier Procedure, Technometrics 25, 165–172.
## Taken from Rosner (1983): x <- c(-0.25,0.68,0.94,1.15,1.20,1.26,1.26, 1.34,1.38,1.43,1.49,1.49,1.55,1.56, 1.58,1.65,1.69,1.70,1.76,1.77,1.81, 1.91,1.94,1.96,1.99,2.06,2.09,2.10, 2.14,2.15,2.23,2.24,2.26,2.35,2.37, 2.40,2.47,2.54,2.62,2.64,2.90,2.92, 2.92,2.93,3.21,3.26,3.30,3.59,3.68, 4.30,4.64,5.34,5.42,6.01) out <- gesdTest(x, 10) ## print method out ## summary method summary(out)
## Taken from Rosner (1983): x <- c(-0.25,0.68,0.94,1.15,1.20,1.26,1.26, 1.34,1.38,1.43,1.49,1.49,1.55,1.56, 1.58,1.65,1.69,1.70,1.76,1.77,1.81, 1.91,1.94,1.96,1.99,2.06,2.09,2.10, 2.14,2.15,2.23,2.24,2.26,2.35,2.37, 2.40,2.47,2.54,2.62,2.64,2.90,2.92, 2.92,2.93,3.21,3.26,3.30,3.59,3.68, 4.30,4.64,5.34,5.42,6.01) out <- gesdTest(x, 10) ## print method out ## summary method summary(out)
Performs Gore's test. The null hypothesis
H is tested against the
alternative H
, with at least
one inequality beeing strict.
goreTest(y, groups, blocks)
goreTest(y, groups, blocks)
y |
a numeric vector of data values. |
groups |
a vector or factor object giving the group for the
corresponding elements of |
blocks |
a vector or factor object giving the group for the
corresponding elements of |
The function has implemented Gore's test for testing main effects in unbalanced CRB designs, i.e. there are one ore more observations per cell. The statistic is assymptotically chi-squared distributed.
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.
Gore, A. P. (1975) Some nonparametric tests and selection procedures for main effects in two-way layouts. Ann. Inst. Stat. Math. 27, 487–500.
friedmanTest
, skillingsMackTest
,
durbinTest
## Crop Yield of 3 varieties on two ## soil classes X <-c("130,A,Light 115,A,Light 123,A,Light 142,A,Light 117,A,Heavy 125,A,Heavy 139,A,Heavy 108,B,Light 114,B,Light 124,B,Light 106,B,Light 91,B,Heavy 111,B,Heavy 110,B,Heavy 155,C,Light 146,C,Light 151,C,Light 165,C,Light 97,C,Heavy 108,C,Heavy") con <- textConnection(X) x <- read.table(con, header=FALSE, sep=",") close(con) colnames(x) <- c("Yield", "Variety", "SoilType") goreTest(y = x$Yield, groups = x$Variety, blocks = x$SoilType)
## Crop Yield of 3 varieties on two ## soil classes X <-c("130,A,Light 115,A,Light 123,A,Light 142,A,Light 117,A,Heavy 125,A,Heavy 139,A,Heavy 108,B,Light 114,B,Light 124,B,Light 106,B,Light 91,B,Heavy 111,B,Heavy 110,B,Heavy 155,C,Light 146,C,Light 151,C,Light 165,C,Light 97,C,Heavy 108,C,Heavy") con <- textConnection(X) x <- read.table(con, header=FALSE, sep=",") close(con) colnames(x) <- c("Yield", "Variety", "SoilType") goreTest(y = x$Yield, groups = x$Variety, blocks = x$SoilType)
Distribution function and quantile function for Grubbs distribution.
qgrubbs(p, n) pgrubbs(q, n, lower.tail = TRUE)
qgrubbs(p, n) pgrubbs(q, n, lower.tail = TRUE)
p |
vector of probabilities. |
n |
total sample size. |
q |
vector of quantiles. |
lower.tail |
logical; if TRUE (default),
probabilities are |
pgrubbs
gives the distribution function and
qgrubbs
gives the quantile function.
Grubbs, F. E. (1950) Sample criteria for testing outlying observations. Ann. Math. Stat. 21, 27–58.
Wilrich, P.-T. (2011) Critical values of Mandel's h and k, Grubbs and the Cochran test statistic. Adv. Stat. Anal.. doi:10.1007/s10182-011-0185-y.
qgrubbs(0.05, 7)
qgrubbs(0.05, 7)
Performs Grubbs single outlier test.
grubbsTest(x, alternative = c("two.sided", "greater", "less"))
grubbsTest(x, alternative = c("two.sided", "greater", "less"))
x |
a numeric vector of data. |
alternative |
the alternative hypothesis.
Defaults to |
Let denote an identically and independently distributed continuous
variate with realizations
.
Further, let the increasingly ordered realizations
denote
. Then
the following model for a single maximum outlier can be proposed:
with . The null hypothesis,
H
is tested against the alternative,
H
.
For testing a single minimum outlier, the model can be proposed as
The null hypothesis is tested against the alternative,
H.
The p-value is computed with the function pgrubbs
.
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.
Grubbs, F. E. (1950) Sample criteria for testing outlying observations. Ann. Math. Stat. 21, 27–58.
Wilrich, P.-T. (2011) Critical values of Mandel's h and k, Grubbs and the Cochran test statistic. Adv. Stat. Anal.. doi:10.1007/s10182-011-0185-y.
data(Pentosan) dat <- subset(Pentosan, subset = (material == "A")) labMeans <- tapply(dat$value, dat$lab, mean) grubbsTest(x = labMeans, alternative = "two.sided")
data(Pentosan) dat <- subset(Pentosan, subset = (material == "A")) labMeans <- tapply(dat$value, dat$lab, mean) grubbsTest(x = labMeans, alternative = "two.sided")
Performs a Siegel-Tukey k-sample rank dispersion test.
GSTTest(x, ...) ## Default S3 method: GSTTest(x, g, dist = c("Chisquare", "KruskalWallis"), ...) ## S3 method for class 'formula' GSTTest( formula, data, subset, na.action, dist = c("Chisquare", "KruskalWallis"), ... )
GSTTest(x, ...) ## Default S3 method: GSTTest(x, g, dist = c("Chisquare", "KruskalWallis"), ...) ## S3 method for class 'formula' GSTTest( formula, data, subset, na.action, dist = c("Chisquare", "KruskalWallis"), ... )
x |
a numeric vector of data values, or a list of numeric data vectors. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
dist |
the test distribution. Defaults's to |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
Meyer-Bahlburg (1970) has proposed a generalized Siegel-Tukey
rank dispersion test for the -sample case.
Likewise to the
fligner.test
, this test
is a nonparametric test for testing the homogegeneity of
scales in several groups.
Let , and
denote
location and scale parameter of the
th group,
then for the two-tailed case, the null hypothesis
H:
is
tested against the alternative,
A:
with at least one inequality beeing strict.
The data are combinedly ranked according to Siegel-Tukey. The ranking is done by alternate extremes (rank 1 is lowest, 2 and 3 are the two highest, 4 and 5 are the two next lowest, etc.).
Meyer-Bahlburg (1970) showed, that the Kruskal-Wallis H-test
can be employed on the Siegel-Tukey ranks.
The H-statistic is assymptotically
chi-squared distributed with degree
of freedom, the default test distribution is consequently
dist = "Chisquare"
. If dist = "KruskalWallis"
is selected,
an incomplete beta approximation is used for the calculation
of p-values as implemented in the function
pKruskalWallis
of the package
SuppDists.
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.
If ties are present, a tie correction is performed and a warning message is given. The GSTTest is sensitive to median differences, likewise to the Siegel-Tukey test. It is thus appropriate to apply this test on the residuals of a one-way ANOVA, rather than on the original data (see example).
H.F.L. Meyer-Bahlburg (1970), A nonparametric test for relative spread in k unpaired samples, Metrika 15, 23–29.
fligner.test
, pKruskalWallis
,
Chisquare
, fligner.test
GSTTest(count ~ spray, data = InsectSprays) ## as means/medians differ, apply the test to residuals ## of one-way ANOVA ans <- aov(count ~ spray, data = InsectSprays) GSTTest( residuals( ans) ~ spray, data =InsectSprays)
GSTTest(count ~ spray, data = InsectSprays) ## as means/medians differ, apply the test to residuals ## of one-way ANOVA ans <- aov(count ~ spray, data = InsectSprays) GSTTest( residuals( ans) ~ spray, data =InsectSprays)
Performs Hartley's maximum F-ratio test of the null that variances in each of the groups (samples) are the same.
hartleyTest(x, ...) ## Default S3 method: hartleyTest(x, g, ...) ## S3 method for class 'formula' hartleyTest(formula, data, subset, na.action, ...)
hartleyTest(x, ...) ## Default S3 method: hartleyTest(x, g, ...) ## S3 method for class 'formula' hartleyTest(formula, data, subset, na.action, ...)
x |
a numeric vector of data values, or a list of numeric data vectors. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
If x
is a list, its elements are taken as the samples
to be compared for homogeneity of variances. In this
case, the elements must all be numeric data vectors,
g
is ignored, and one can simply use
hartleyTest(x)
to perform the test. If the samples are not
yet contained in a list, use hartleyTest(list(x, ...))
.
Otherwise, x
must be a numeric data vector, and g
must
be a vector or factor object of the same length as x
giving the
group for the corresponding elements of x
.
Hartley's parametric test requires normality and
a nearly balanced design. The p-value of the test
is calculated with the function pmaxFratio
of the package SuppDists.
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.
Hartley, H.O. (1950) The maximum F-ratio as a short cut test for heterogeneity of variance, Biometrika 37, 308–312.
hartleyTest(count ~ spray, data = InsectSprays)
hartleyTest(count ~ spray, data = InsectSprays)
Performs the non-parametric Hayter-Stone procedure to test against an monotonically increasing alternative.
hayterStoneTest(x, ...) ## Default S3 method: hayterStoneTest( x, g, alternative = c("greater", "less"), method = c("look-up", "boot", "asympt"), nperm = 10000, ... ) ## S3 method for class 'formula' hayterStoneTest( formula, data, subset, na.action, alternative = c("greater", "less"), method = c("look-up", "boot", "asympt"), nperm = 10000, ... )
hayterStoneTest(x, ...) ## Default S3 method: hayterStoneTest( x, g, alternative = c("greater", "less"), method = c("look-up", "boot", "asympt"), nperm = 10000, ... ) ## S3 method for class 'formula' hayterStoneTest( formula, data, subset, na.action, alternative = c("greater", "less"), method = c("look-up", "boot", "asympt"), nperm = 10000, ... )
x |
a numeric vector of data values, or a list of numeric data vectors. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
alternative |
the alternative hypothesis. Defaults to |
method |
a character string specifying the test statistic to use.
Defaults to |
nperm |
number of permutations for the asymptotic permutation test.
Defaults to |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
Let be an identically and idepentendly distributed variable
that was
times observed at
increasing treatment levels.
Hayter and Stone (1991) proposed a non-parametric procedure
to test the null hypothesis, H:
against a simple order alternative, A:
, with at least
one inequality being strict.
The statistic for a global test is calculated as,
with the Mann-Whittney counts:
Under the large sample approximation, the test statistic is distributed
as
. Thus, the null hypothesis is rejected, if
, with
degree of freedom.
If method = "look-up"
the function will not return
p-values. Instead the critical h-values
as given in the tables of Hayter (1990) for
(one-sided)
are looked up according to the number of groups (
) and
the degree of freedoms (
).
If method = "boot"
an asymptotic permutation test
is conducted and a -value is returned.
If method = "asympt"
is selected the asymptotic
-value is estimated as implemented in the
function
pHayStonLSA
of the package NSM3.
Either a list of class htest
or a
list with class "osrt"
that contains 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 statistic(s)
critical values for .
a character string describing the alternative hypothesis.
the parameter(s) of the test distribution.
a string that denotes the test distribution.
There are print and summary methods available.
If method = "asympt"
is selected, this function calls
an internal probability function pHS
. The GPL-2 code for
this function was taken from pHayStonLSA
of the
the package NSM3:
Grant Schneider, Eric Chicken and Rachel Becvarik (2020) NSM3: Functions and Datasets to Accompany Hollander, Wolfe, and Chicken - Nonparametric Statistical Methods, Third Edition. R package version 1.15. https://CRAN.R-project.org/package=NSM3
Hayter, A. J.(1990) A One-Sided Studentised Range Test for Testing Against a Simple Ordered Alternative, J Amer Stat Assoc 85, 778–785.
Hayter, A.J., Stone, G. (1991) Distribution free multiple comparisons for monotonically ordered treatment effects. Austral J Statist 33, 335–346.
osrtTest
, hsAllPairsTest
,
sample
, pHayStonLSA
## Example from Shirley (1977) ## Reaction times of mice to stimuli to their tails. x <- c(2.4, 3, 3, 2.2, 2.2, 2.2, 2.2, 2.8, 2, 3, 2.8, 2.2, 3.8, 9.4, 8.4, 3, 3.2, 4.4, 3.2, 7.4, 9.8, 3.2, 5.8, 7.8, 2.6, 2.2, 6.2, 9.4, 7.8, 3.4, 7, 9.8, 9.4, 8.8, 8.8, 3.4, 9, 8.4, 2.4, 7.8) g <- gl(4, 10) ## Shirley's test ## one-sided test using look-up table shirleyWilliamsTest(x ~ g, alternative = "greater") ## Chacko's global hypothesis test for 'greater' chackoTest(x , g) ## post-hoc test, default is standard normal distribution (NPT'-test) summary(chaAllPairsNashimotoTest(x, g, p.adjust.method = "none")) ## same but h-distribution (NPY'-test) chaAllPairsNashimotoTest(x, g, dist = "h") ## NPM-test NPMTest(x, g) ## Hayter-Stone test hayterStoneTest(x, g) ## all-pairs comparisons hsAllPairsTest(x, g)
## Example from Shirley (1977) ## Reaction times of mice to stimuli to their tails. x <- c(2.4, 3, 3, 2.2, 2.2, 2.2, 2.2, 2.8, 2, 3, 2.8, 2.2, 3.8, 9.4, 8.4, 3, 3.2, 4.4, 3.2, 7.4, 9.8, 3.2, 5.8, 7.8, 2.6, 2.2, 6.2, 9.4, 7.8, 3.4, 7, 9.8, 9.4, 8.8, 8.8, 3.4, 9, 8.4, 2.4, 7.8) g <- gl(4, 10) ## Shirley's test ## one-sided test using look-up table shirleyWilliamsTest(x ~ g, alternative = "greater") ## Chacko's global hypothesis test for 'greater' chackoTest(x , g) ## post-hoc test, default is standard normal distribution (NPT'-test) summary(chaAllPairsNashimotoTest(x, g, p.adjust.method = "none")) ## same but h-distribution (NPY'-test) chaAllPairsNashimotoTest(x, g, dist = "h") ## NPM-test NPMTest(x, g) ## Hayter-Stone test hayterStoneTest(x, g) ## all-pairs comparisons hsAllPairsTest(x, g)
Performs the non-parametric Hayter-Stone all-pairs procedure to test against monotonically increasing alternatives.
hsAllPairsTest(x, ...) ## Default S3 method: hsAllPairsTest( x, g, alternative = c("greater", "less"), method = c("look-up", "boot", "asympt"), nperm = 10000, ... ) ## S3 method for class 'formula' hsAllPairsTest( formula, data, subset, na.action, alternative = c("greater", "less"), method = c("look-up", "boot", "asympt"), nperm = 10000, ... )
hsAllPairsTest(x, ...) ## Default S3 method: hsAllPairsTest( x, g, alternative = c("greater", "less"), method = c("look-up", "boot", "asympt"), nperm = 10000, ... ) ## S3 method for class 'formula' hsAllPairsTest( formula, data, subset, na.action, alternative = c("greater", "less"), method = c("look-up", "boot", "asympt"), nperm = 10000, ... )
x |
a numeric vector of data values, or a list of numeric data vectors. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
alternative |
the alternative hypothesis. Defaults to |
method |
a character string specifying the test statistic to use.
Defaults to |
nperm |
number of permutations for the asymptotic permutation test.
Defaults to |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
Let be an identically and idepentendly distributed variable
that was
times observed at
increasing treatment levels.
Hayter and Stone (1991) proposed a non-parametric procedure
to test the null hypothesis, H:
against a simple order alternative, A:
.
The statistic for all-pairs comparisons is calculated as,
with the Mann-Whittney counts:
Under the large sample approximation, the test statistic is distributed
as
. Thus, the null hypothesis is rejected,
if
, with
degree of freedom.
If method = "look-up"
the function will not return
p-values. Instead the critical h-values
as given in the tables of Hayter (1990) for
(one-sided)
are looked up according to the number of groups (
) and
the degree of freedoms (
).
If method = "boot"
an asymetric permutation test
is conducted and -values are returned.
If method = "asympt"
is selected the asymptotic
-value is estimated as implemented in the
function
pHayStonLSA
of the package NSM3.
Either a list of class "PMCMR"
or a
list with class "osrt"
that contains 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 statistic(s)
critical values for .
a character string describing the alternative hypothesis.
the parameter(s) of the test distribution.
a string that denotes the test distribution.
There are print and summary methods available.
A list with class "PMCMR"
containing the following components:
a character string indicating what type of test was performed.
a character string giving the name(s) of the data.
lower-triangle matrix of the estimated quantiles of the pairwise test statistics.
lower-triangle matrix of the p-values for the pairwise tests.
a character string describing the alternative hypothesis.
a character string describing the method for p-value adjustment.
a data frame of the input data.
a string that denotes the test distribution.
If method = "asympt"
is selected, this function calls
an internal probability function pHS
. The GPL-2 code for
this function was taken from pHayStonLSA
of the
the package NSM3:
Grant Schneider, Eric Chicken and Rachel Becvarik (2020) NSM3: Functions and Datasets to Accompany Hollander, Wolfe, and Chicken - Nonparametric Statistical Methods, Third Edition. R package version 1.15. https://CRAN.R-project.org/package=NSM3
Hayter, A. J.(1990) A One-Sided Studentised Range Test for Testing Against a Simple Ordered Alternative, Journal of the American Statistical Association 85, 778–785.
Hayter, A.J., Stone, G. (1991) Distribution free multiple comparisons for monotonically ordered treatment effects. Austral J Statist 33, 335–346.
## Example from Shirley (1977) ## Reaction times of mice to stimuli to their tails. x <- c(2.4, 3, 3, 2.2, 2.2, 2.2, 2.2, 2.8, 2, 3, 2.8, 2.2, 3.8, 9.4, 8.4, 3, 3.2, 4.4, 3.2, 7.4, 9.8, 3.2, 5.8, 7.8, 2.6, 2.2, 6.2, 9.4, 7.8, 3.4, 7, 9.8, 9.4, 8.8, 8.8, 3.4, 9, 8.4, 2.4, 7.8) g <- gl(4, 10) ## Shirley's test ## one-sided test using look-up table shirleyWilliamsTest(x ~ g, alternative = "greater") ## Chacko's global hypothesis test for 'greater' chackoTest(x , g) ## post-hoc test, default is standard normal distribution (NPT'-test) summary(chaAllPairsNashimotoTest(x, g, p.adjust.method = "none")) ## same but h-distribution (NPY'-test) chaAllPairsNashimotoTest(x, g, dist = "h") ## NPM-test NPMTest(x, g) ## Hayter-Stone test hayterStoneTest(x, g) ## all-pairs comparisons hsAllPairsTest(x, g)
## Example from Shirley (1977) ## Reaction times of mice to stimuli to their tails. x <- c(2.4, 3, 3, 2.2, 2.2, 2.2, 2.2, 2.8, 2, 3, 2.8, 2.2, 3.8, 9.4, 8.4, 3, 3.2, 4.4, 3.2, 7.4, 9.8, 3.2, 5.8, 7.8, 2.6, 2.2, 6.2, 9.4, 7.8, 3.4, 7, 9.8, 9.4, 8.8, 8.8, 3.4, 9, 8.4, 2.4, 7.8) g <- gl(4, 10) ## Shirley's test ## one-sided test using look-up table shirleyWilliamsTest(x ~ g, alternative = "greater") ## Chacko's global hypothesis test for 'greater' chackoTest(x , g) ## post-hoc test, default is standard normal distribution (NPT'-test) summary(chaAllPairsNashimotoTest(x, g, p.adjust.method = "none")) ## same but h-distribution (NPY'-test) chaAllPairsNashimotoTest(x, g, dist = "h") ## NPM-test NPMTest(x, g) ## Hayter-Stone test hayterStoneTest(x, g) ## all-pairs comparisons hsAllPairsTest(x, g)
Performs the Johnson-Mehrotra test for testing against ordered alternatives in a balanced one-factorial sampling design.
johnsonTest(x, ...) ## Default S3 method: johnsonTest(x, g, alternative = c("two.sided", "greater", "less"), ...) ## S3 method for class 'formula' johnsonTest( formula, data, subset, na.action, alternative = c("two.sided", "greater", "less"), ... )
johnsonTest(x, ...) ## Default S3 method: johnsonTest(x, g, alternative = c("two.sided", "greater", "less"), ...) ## S3 method for class 'formula' johnsonTest( formula, data, subset, na.action, alternative = c("two.sided", "greater", "less"), ... )
x |
a numeric vector of data values, or a list of numeric data vectors. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
alternative |
the alternative hypothesis. Defaults to |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
The null hypothesis, H
is tested against a simple order hypothesis,
H
.
The p-values are estimated from the standard normal distribution.
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.
Factor labels for g
must be assigned in such a way,
that they can be increasingly ordered from zero-dose
control to the highest dose level, e.g. integers
{0, 1, 2, ..., k} or letters {a, b, c, ...}.
Otherwise the function may not select the correct values
for intended zero-dose control.
It is safer, to i) label the factor levels as given above,
and to ii) sort the data according to increasing dose-levels
prior to call the function (see order
, factor
).
Bortz, J. (1993). Statistik für Sozialwissenschaftler (4th ed.). Berlin: Springer.
Johnson, R. A., Mehrotra, K. G. (1972) Some c-sample nonparametric tests for ordered alternatives. Journal of the Indian Statistical Association 9, 8–23.
kruskalTest
and shirleyWilliamsTest
of the package PMCMRplus,
kruskal.test
of the library stats.
## Example from Sachs (1997, p. 402) x <- c(106, 114, 116, 127, 145, 110, 125, 143, 148, 151, 136, 139, 149, 160, 174) g <- gl(3,5) levels(g) <- c("A", "B", "C") ## Chacko's test chackoTest(x, g) ## Cuzick's test cuzickTest(x, g) ## Johnson-Mehrotra test johnsonTest(x, g) ## Jonckheere-Terpstra test jonckheereTest(x, g) ## Le's test leTest(x, g) ## Spearman type test spearmanTest(x, g) ## Murakami's BWS trend test bwsTrendTest(x, g) ## Fligner-Wolfe test flignerWolfeTest(x, g) ## Shan-Young-Kang test shanTest(x, g)
## Example from Sachs (1997, p. 402) x <- c(106, 114, 116, 127, 145, 110, 125, 143, 148, 151, 136, 139, 149, 160, 174) g <- gl(3,5) levels(g) <- c("A", "B", "C") ## Chacko's test chackoTest(x, g) ## Cuzick's test cuzickTest(x, g) ## Johnson-Mehrotra test johnsonTest(x, g) ## Jonckheere-Terpstra test jonckheereTest(x, g) ## Le's test leTest(x, g) ## Spearman type test spearmanTest(x, g) ## Murakami's BWS trend test bwsTrendTest(x, g) ## Fligner-Wolfe test flignerWolfeTest(x, g) ## Shan-Young-Kang test shanTest(x, g)
Performs the Jonckheere-Terpstra test for testing against ordered alternatives.
jonckheereTest(x, ...) ## Default S3 method: jonckheereTest( x, g, alternative = c("two.sided", "greater", "less"), continuity = FALSE, ... ) ## S3 method for class 'formula' jonckheereTest( formula, data, subset, na.action, alternative = c("two.sided", "greater", "less"), continuity = FALSE, ... )
jonckheereTest(x, ...) ## Default S3 method: jonckheereTest( x, g, alternative = c("two.sided", "greater", "less"), continuity = FALSE, ... ) ## S3 method for class 'formula' jonckheereTest( formula, data, subset, na.action, alternative = c("two.sided", "greater", "less"), continuity = FALSE, ... )
x |
a numeric vector of data values, or a list of numeric data vectors. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
alternative |
the alternative hypothesis. Defaults to |
continuity |
logical indicator whether a continuity correction
shall be performed. Defaults to |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
The null hypothesis, H
is tested against a simple order hypothesis,
H
.
The p-values are estimated from the standard normal distribution.
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 code for the computation of the standard deviation
for the Jonckheere-Terpstra test in the presence of ties was taken from:
Kloke, J., McKean, J. (2016) npsm: Package for Nonparametric Statistical Methods using R. R package version 0.5. https://CRAN.R-project.org/package=npsm
jonckheereTest(x, g, alternative = "two.sided", continuity = TRUE)
is
equivalent to
cor.test(x, as.numeric(g), method = "kendall", alternative = "two.sided", continuity = TRUE)
Factor labels for g
must be assigned in such a way,
that they can be increasingly ordered from zero-dose
control to the highest dose level, e.g. integers
{0, 1, 2, ..., k} or letters {a, b, c, ...}.
Otherwise the function may not select the correct values
for intended zero-dose control.
It is safer, to i) label the factor levels as given above,
and to ii) sort the data according to increasing dose-levels
prior to call the function (see order
, factor
).
Jonckheere, A. R. (1954) A distribution-free k-sample test against ordered alternatives. Biometrica 41, 133–145.
Kloke, J., McKean, J. W. (2015) Nonparametric statistical methods using R. Boca Raton, FL: Chapman & Hall/CRC.
kruskalTest
and shirleyWilliamsTest
of the package PMCMRplus,
kruskal.test
of the library stats.
## Example from Sachs (1997, p. 402) x <- c(106, 114, 116, 127, 145, 110, 125, 143, 148, 151, 136, 139, 149, 160, 174) g <- gl(3,5) levels(g) <- c("A", "B", "C") ## Chacko's test chackoTest(x, g) ## Cuzick's test cuzickTest(x, g) ## Johnson-Mehrotra test johnsonTest(x, g) ## Jonckheere-Terpstra test jonckheereTest(x, g) ## Le's test leTest(x, g) ## Spearman type test spearmanTest(x, g) ## Murakami's BWS trend test bwsTrendTest(x, g) ## Fligner-Wolfe test flignerWolfeTest(x, g) ## Shan-Young-Kang test shanTest(x, g)
## Example from Sachs (1997, p. 402) x <- c(106, 114, 116, 127, 145, 110, 125, 143, 148, 151, 136, 139, 149, 160, 174) g <- gl(3,5) levels(g) <- c("A", "B", "C") ## Chacko's test chackoTest(x, g) ## Cuzick's test cuzickTest(x, g) ## Johnson-Mehrotra test johnsonTest(x, g) ## Jonckheere-Terpstra test jonckheereTest(x, g) ## Le's test leTest(x, g) ## Spearman type test spearmanTest(x, g) ## Murakami's BWS trend test bwsTrendTest(x, g) ## Fligner-Wolfe test flignerWolfeTest(x, g) ## Shan-Young-Kang test shanTest(x, g)
Performs a Kruskal-Wallis rank sum test.
kruskalTest(x, ...) ## Default S3 method: kruskalTest(x, g, dist = c("Chisquare", "KruskalWallis", "FDist"), ...) ## S3 method for class 'formula' kruskalTest( formula, data, subset, na.action, dist = c("Chisquare", "KruskalWallis", "FDist"), ... )
kruskalTest(x, ...) ## Default S3 method: kruskalTest(x, g, dist = c("Chisquare", "KruskalWallis", "FDist"), ...) ## S3 method for class 'formula' kruskalTest( formula, data, subset, na.action, dist = c("Chisquare", "KruskalWallis", "FDist"), ... )
x |
a numeric vector of data values, or a list of numeric data vectors. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
dist |
the test distribution. Defaults's to |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
For one-factorial designs with non-normally distributed
residuals the Kruskal-Wallis rank sum test can be performed to test
the H against
the H
with at least
one strict inequality.
Let be the joint rank of
,
with
,
The test statistic is calculated as
with the mean rank of the -th group
the expected value
and the expected variance as
In case of ties the statistic is divided by
According to Conover and Imam (1981), the statistic is related
to the
-quantile as
which is equivalent to a one-way ANOVA F-test using rank transformed data (see examples).
The function provides three different dist
for -value estimation:
-values are computed from the
Chisquare
distribution with degree of freedom.
-values are computed from the
pKruskalWallis
of the package SuppDists.
-values are computed from the
FDist
distribution
with degree of freedom.
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.
Conover, W.J., Iman, R.L. (1981) Rank Transformations as a Bridge Between Parametric and Nonparametric Statistics. Am Stat 35, 124–129.
Kruskal, W.H., Wallis, W.A. (1952) Use of Ranks in One-Criterion Variance Analysis. J Am Stat Assoc 47, 583–621.
Sachs, L. (1997) Angewandte Statistik. Berlin: Springer.
kruskal.test
, pKruskalWallis
,
Chisquare
, FDist
## 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) ## End(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) ## End(Not run) ## Median Test asymptotic medianTest(x ~ g, dat) ## Median Test with simulated p-values set.seed(112) medianTest(x ~ g, dat, simulate.p.value = TRUE)
## 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) ## End(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) ## End(Not run) ## Median Test asymptotic medianTest(x ~ g, dat) ## Median Test with simulated p-values set.seed(112) medianTest(x ~ g, dat, simulate.p.value = TRUE)
Performs Conover's non-parametric all-pairs comparison test for Kruskal-type ranked data.
kwAllPairsConoverTest(x, ...) ## Default S3 method: kwAllPairsConoverTest( x, g, p.adjust.method = c("single-step", p.adjust.methods), ... ) ## S3 method for class 'formula' kwAllPairsConoverTest( formula, data, subset, na.action, p.adjust.method = c("single-step", p.adjust.methods), ... )
kwAllPairsConoverTest(x, ...) ## Default S3 method: kwAllPairsConoverTest( x, g, p.adjust.method = c("single-step", p.adjust.methods), ... ) ## S3 method for class 'formula' kwAllPairsConoverTest( formula, data, subset, na.action, p.adjust.method = c("single-step", p.adjust.methods), ... )
x |
a numeric vector of data values, or a list of numeric data vectors. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
p.adjust.method |
method for adjusting p values
(see |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
For all-pairs comparisons in an one-factorial layout
with non-normally distributed residuals Conover's non-parametric test
can be performed. A total of
hypotheses can be tested. The null hypothesis
H
is tested in the two-tailed test
against the alternative
A
.
If p.adjust.method == "single-step"
the p-values are computed
from the studentized range distribution. Otherwise,
the p-values are computed from the t-distribution using
any of the p-adjustment methods as included in p.adjust
.
A list with class "PMCMR"
containing the following components:
a character string indicating what type of test was performed.
a character string giving the name(s) of the data.
lower-triangle matrix of the estimated quantiles of the pairwise test statistics.
lower-triangle matrix of the p-values for the pairwise tests.
a character string describing the alternative hypothesis.
a character string describing the method for p-value adjustment.
a data frame of the input data.
a string that denotes the test distribution.
Conover, W. J, Iman, R. L. (1979) On multiple-comparisons procedures, Tech. Rep. LA-7677-MS, Los Alamos Scientific Laboratory.
Tukey
, TDist
,
p.adjust
, kruskalTest
,
kwAllPairsDunnTest
, kwAllPairsNemenyiTest
## Data set InsectSprays ## Global test kruskalTest(count ~ spray, data = InsectSprays) ## Conover's all-pairs comparison test ## single-step means Tukey's p-adjustment ans <- kwAllPairsConoverTest(count ~ spray, data = InsectSprays, p.adjust.method = "single-step") summary(ans) ## Dunn's all-pairs comparison test ans <- kwAllPairsDunnTest(count ~ spray, data = InsectSprays, p.adjust.method = "bonferroni") summary(ans) ## Nemenyi's all-pairs comparison test ans <- kwAllPairsNemenyiTest(count ~ spray, data = InsectSprays) summary(ans) ## Brown-Mood all-pairs median test ans <- medianAllPairsTest(count ~ spray, data = InsectSprays) summary(ans)
## Data set InsectSprays ## Global test kruskalTest(count ~ spray, data = InsectSprays) ## Conover's all-pairs comparison test ## single-step means Tukey's p-adjustment ans <- kwAllPairsConoverTest(count ~ spray, data = InsectSprays, p.adjust.method = "single-step") summary(ans) ## Dunn's all-pairs comparison test ans <- kwAllPairsDunnTest(count ~ spray, data = InsectSprays, p.adjust.method = "bonferroni") summary(ans) ## Nemenyi's all-pairs comparison test ans <- kwAllPairsNemenyiTest(count ~ spray, data = InsectSprays) summary(ans) ## Brown-Mood all-pairs median test ans <- medianAllPairsTest(count ~ spray, data = InsectSprays) summary(ans)
Performs Dunn's non-parametric all-pairs comparison test for Kruskal-type ranked data.
kwAllPairsDunnTest(x, ...) ## Default S3 method: kwAllPairsDunnTest(x, g, p.adjust.method = p.adjust.methods, ...) ## S3 method for class 'formula' kwAllPairsDunnTest( formula, data, subset, na.action, p.adjust.method = p.adjust.methods, ... )
kwAllPairsDunnTest(x, ...) ## Default S3 method: kwAllPairsDunnTest(x, g, p.adjust.method = p.adjust.methods, ...) ## S3 method for class 'formula' kwAllPairsDunnTest( formula, data, subset, na.action, p.adjust.method = p.adjust.methods, ... )
x |
a numeric vector of data values, or a list of numeric data vectors. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
p.adjust.method |
method for adjusting p values
(see |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
For all-pairs comparisons in an one-factorial layout
with non-normally distributed residuals Dunn's non-parametric test
can be performed. A total of
hypotheses can be tested. The null hypothesis
H
is tested in the two-tailed test
against the alternative
A
.
The p-values are computed from the standard normal distribution using
any of the p-adjustment methods as included in p.adjust
.
Originally, Dunn (1964) proposed Bonferroni's p-adjustment method.
A list with class "PMCMR"
containing the following components:
a character string indicating what type of test was performed.
a character string giving the name(s) of the data.
lower-triangle matrix of the estimated quantiles of the pairwise test statistics.
lower-triangle matrix of the p-values for the pairwise tests.
a character string describing the alternative hypothesis.
a character string describing the method for p-value adjustment.
a data frame of the input data.
a string that denotes the test distribution.
Dunn, O. J. (1964) Multiple comparisons using rank sums, Technometrics 6, 241–252.
Siegel, S., Castellan Jr., N. J. (1988) Nonparametric Statistics for The Behavioral Sciences. New York: McGraw-Hill.
Normal
, p.adjust
,
kruskalTest
,
kwAllPairsConoverTest
, kwAllPairsNemenyiTest
## Data set InsectSprays ## Global test kruskalTest(count ~ spray, data = InsectSprays) ## Conover's all-pairs comparison test ## single-step means Tukey's p-adjustment ans <- kwAllPairsConoverTest(count ~ spray, data = InsectSprays, p.adjust.method = "single-step") summary(ans) ## Dunn's all-pairs comparison test ans <- kwAllPairsDunnTest(count ~ spray, data = InsectSprays, p.adjust.method = "bonferroni") summary(ans) ## Nemenyi's all-pairs comparison test ans <- kwAllPairsNemenyiTest(count ~ spray, data = InsectSprays) summary(ans) ## Brown-Mood all-pairs median test ans <- medianAllPairsTest(count ~ spray, data = InsectSprays) summary(ans)
## Data set InsectSprays ## Global test kruskalTest(count ~ spray, data = InsectSprays) ## Conover's all-pairs comparison test ## single-step means Tukey's p-adjustment ans <- kwAllPairsConoverTest(count ~ spray, data = InsectSprays, p.adjust.method = "single-step") summary(ans) ## Dunn's all-pairs comparison test ans <- kwAllPairsDunnTest(count ~ spray, data = InsectSprays, p.adjust.method = "bonferroni") summary(ans) ## Nemenyi's all-pairs comparison test ans <- kwAllPairsNemenyiTest(count ~ spray, data = InsectSprays) summary(ans) ## Brown-Mood all-pairs median test ans <- medianAllPairsTest(count ~ spray, data = InsectSprays) summary(ans)
Performs Nemenyi's non-parametric all-pairs comparison test for Kruskal-type ranked data.
kwAllPairsNemenyiTest(x, ...) ## Default S3 method: kwAllPairsNemenyiTest(x, g, dist = c("Tukey", "Chisquare"), ...) ## S3 method for class 'formula' kwAllPairsNemenyiTest( formula, data, subset, na.action, dist = c("Tukey", "Chisquare"), ... )
kwAllPairsNemenyiTest(x, ...) ## Default S3 method: kwAllPairsNemenyiTest(x, g, dist = c("Tukey", "Chisquare"), ...) ## S3 method for class 'formula' kwAllPairsNemenyiTest( formula, data, subset, na.action, dist = c("Tukey", "Chisquare"), ... )
x |
a numeric vector of data values, or a list of numeric data vectors. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
dist |
the distribution for determining the p-value.
Defaults to |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
For all-pairs comparisons in an one-factorial layout
with non-normally distributed residuals Nemenyi's non-parametric test
can be performed. A total of
hypotheses can be tested. The null hypothesis
H
is tested in the two-tailed test
against the alternative
A
.
Let be the rank of
,
where
is jointly ranked
from
,
then the test statistic under the absence of ties is calculated as
with the mean rank of the
-th and
-th group and the expected variance as
A pairwise difference is significant, if ,
with
the number of groups and
the degree of freedom.
Sachs(1997) has given a modified approach for
Nemenyi's test in the presence of ties for
provided that the
kruskalTest
indicates significance:
In the presence of ties, the test statistic is
corrected according to , with
The function provides two different dist
for -value estimation:
The -values are computed from the studentized
range distribution (alias
Tukey
),
.
The -values are computed from the
Chisquare
distribution with degree
of freedom.
A list with class "PMCMR"
containing the following components:
a character string indicating what type of test was performed.
a character string giving the name(s) of the data.
lower-triangle matrix of the estimated quantiles of the pairwise test statistics.
lower-triangle matrix of the p-values for the pairwise tests.
a character string describing the alternative hypothesis.
a character string describing the method for p-value adjustment.
a data frame of the input data.
a string that denotes the test distribution.
Nemenyi, P. (1963) Distribution-free Multiple Comparisons. Ph.D. thesis, Princeton University.
Sachs, L. (1997) Angewandte Statistik. Berlin: Springer.
Wilcoxon, F., Wilcox, R. A. (1964) Some rapid approximate statistical procedures. Pearl River: Lederle Laboratories.
Tukey
, Chisquare
,
p.adjust
, kruskalTest
,
kwAllPairsDunnTest
, kwAllPairsConoverTest
## Data set InsectSprays ## Global test kruskalTest(count ~ spray, data = InsectSprays) ## Conover's all-pairs comparison test ## single-step means Tukey's p-adjustment ans <- kwAllPairsConoverTest(count ~ spray, data = InsectSprays, p.adjust.method = "single-step") summary(ans) ## Dunn's all-pairs comparison test ans <- kwAllPairsDunnTest(count ~ spray, data = InsectSprays, p.adjust.method = "bonferroni") summary(ans) ## Nemenyi's all-pairs comparison test ans <- kwAllPairsNemenyiTest(count ~ spray, data = InsectSprays) summary(ans) ## Brown-Mood all-pairs median test ans <- medianAllPairsTest(count ~ spray, data = InsectSprays) summary(ans)
## Data set InsectSprays ## Global test kruskalTest(count ~ spray, data = InsectSprays) ## Conover's all-pairs comparison test ## single-step means Tukey's p-adjustment ans <- kwAllPairsConoverTest(count ~ spray, data = InsectSprays, p.adjust.method = "single-step") summary(ans) ## Dunn's all-pairs comparison test ans <- kwAllPairsDunnTest(count ~ spray, data = InsectSprays, p.adjust.method = "bonferroni") summary(ans) ## Nemenyi's all-pairs comparison test ans <- kwAllPairsNemenyiTest(count ~ spray, data = InsectSprays) summary(ans) ## Brown-Mood all-pairs median test ans <- medianAllPairsTest(count ~ spray, data = InsectSprays) summary(ans)
Performs Conover's non-parametric many-to-one comparison test for Kruskal-type ranked data.
kwManyOneConoverTest(x, ...) ## Default S3 method: kwManyOneConoverTest( x, g, alternative = c("two.sided", "greater", "less"), p.adjust.method = c("single-step", p.adjust.methods), ... ) ## S3 method for class 'formula' kwManyOneConoverTest( formula, data, subset, na.action, alternative = c("two.sided", "greater", "less"), p.adjust.method = c("single-step", p.adjust.methods), ... )
kwManyOneConoverTest(x, ...) ## Default S3 method: kwManyOneConoverTest( x, g, alternative = c("two.sided", "greater", "less"), p.adjust.method = c("single-step", p.adjust.methods), ... ) ## S3 method for class 'formula' kwManyOneConoverTest( formula, data, subset, na.action, alternative = c("two.sided", "greater", "less"), p.adjust.method = c("single-step", p.adjust.methods), ... )
x |
a numeric vector of data values, or a list of numeric data vectors. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
alternative |
the alternative hypothesis. Defaults to |
p.adjust.method |
method for adjusting p values
(see |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
For many-to-one comparisons (pairwise comparisons with one control)
in an one-factorial layout with non-normally distributed
residuals Conover's non-parametric test can be performed.
Let there be groups including the control,
then the number of treatment levels is
.
Then
pairwise comparisons can be performed between
the
-th treatment level and the control.
H
is tested in the two-tailed case against
A
.
If p.adjust.method == "single-step"
is selected,
the -values will be computed
from the multivariate
distribution. Otherwise,
the
-values are computed from the
-distribution using
any of the
-adjustment methods as included in
p.adjust
.
A list with class "PMCMR"
containing the following components:
a character string indicating what type of test was performed.
a character string giving the name(s) of the data.
lower-triangle matrix of the estimated quantiles of the pairwise test statistics.
lower-triangle matrix of the p-values for the pairwise tests.
a character string describing the alternative hypothesis.
a character string describing the method for p-value adjustment.
a data frame of the input data.
a string that denotes the test distribution.
Factor labels for g
must be assigned in such a way,
that they can be increasingly ordered from zero-dose
control to the highest dose level, e.g. integers
{0, 1, 2, ..., k} or letters {a, b, c, ...}.
Otherwise the function may not select the correct values
for intended zero-dose control.
It is safer, to i) label the factor levels as given above,
and to ii) sort the data according to increasing dose-levels
prior to call the function (see order
, factor
).
Conover, W. J, Iman, R. L. (1979) On multiple-comparisons procedures, Tech. Rep. LA-7677-MS, Los Alamos Scientific Laboratory.
pmvt
, TDist
, kruskalTest
,
kwManyOneDunnTest
, kwManyOneNdwTest
## Data set PlantGrowth ## Global test kruskalTest(weight ~ group, data = PlantGrowth) ## Conover's many-one comparison test ## single-step means p-value from multivariate t distribution ans <- kwManyOneConoverTest(weight ~ group, data = PlantGrowth, p.adjust.method = "single-step") summary(ans) ## Conover's many-one comparison test ans <- kwManyOneConoverTest(weight ~ group, data = PlantGrowth, p.adjust.method = "holm") summary(ans) ## Dunn's many-one comparison test ans <- kwManyOneDunnTest(weight ~ group, data = PlantGrowth, p.adjust.method = "holm") summary(ans) ## Nemenyi's many-one comparison test ans <- kwManyOneNdwTest(weight ~ group, data = PlantGrowth, p.adjust.method = "holm") summary(ans) ## Many one U test ans <- manyOneUTest(weight ~ group, data = PlantGrowth, p.adjust.method = "holm") summary(ans) ## Chen Test ans <- chenTest(weight ~ group, data = PlantGrowth, p.adjust.method = "holm") summary(ans)
## Data set PlantGrowth ## Global test kruskalTest(weight ~ group, data = PlantGrowth) ## Conover's many-one comparison test ## single-step means p-value from multivariate t distribution ans <- kwManyOneConoverTest(weight ~ group, data = PlantGrowth, p.adjust.method = "single-step") summary(ans) ## Conover's many-one comparison test ans <- kwManyOneConoverTest(weight ~ group, data = PlantGrowth, p.adjust.method = "holm") summary(ans) ## Dunn's many-one comparison test ans <- kwManyOneDunnTest(weight ~ group, data = PlantGrowth, p.adjust.method = "holm") summary(ans) ## Nemenyi's many-one comparison test ans <- kwManyOneNdwTest(weight ~ group, data = PlantGrowth, p.adjust.method = "holm") summary(ans) ## Many one U test ans <- manyOneUTest(weight ~ group, data = PlantGrowth, p.adjust.method = "holm") summary(ans) ## Chen Test ans <- chenTest(weight ~ group, data = PlantGrowth, p.adjust.method = "holm") summary(ans)
Performs Dunn's non-parametric many-to-one comparison test for Kruskal-type ranked data.
kwManyOneDunnTest(x, ...) ## Default S3 method: kwManyOneDunnTest( x, g, alternative = c("two.sided", "greater", "less"), p.adjust.method = c("single-step", p.adjust.methods), ... ) ## S3 method for class 'formula' kwManyOneDunnTest( formula, data, subset, na.action, alternative = c("two.sided", "greater", "less"), p.adjust.method = c("single-step", p.adjust.methods), ... )
kwManyOneDunnTest(x, ...) ## Default S3 method: kwManyOneDunnTest( x, g, alternative = c("two.sided", "greater", "less"), p.adjust.method = c("single-step", p.adjust.methods), ... ) ## S3 method for class 'formula' kwManyOneDunnTest( formula, data, subset, na.action, alternative = c("two.sided", "greater", "less"), p.adjust.method = c("single-step", p.adjust.methods), ... )
x |
a numeric vector of data values, or a list of numeric data vectors. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
alternative |
the alternative hypothesis. Defaults to |
p.adjust.method |
method for adjusting p values
(see |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
For many-to-one comparisons (pairwise comparisons with one control)
in an one-factorial layout with non-normally distributed
residuals Dunn's non-parametric test can be performed.
Let there be groups including the control,
then the number of treatment levels is
.
Then
pairwise comparisons can be performed between
the
-th treatment level and the control.
H
is tested in the two-tailed case against
A
.
If p.adjust.method == "single-step"
is selected,
the -values will be computed
from the multivariate normal distribution. Otherwise,
the
-values are computed from the standard normal distribution using
any of the
-adjustment methods as included in
p.adjust
.
A list with class "PMCMR"
containing the following components:
a character string indicating what type of test was performed.
a character string giving the name(s) of the data.
lower-triangle matrix of the estimated quantiles of the pairwise test statistics.
lower-triangle matrix of the p-values for the pairwise tests.
a character string describing the alternative hypothesis.
a character string describing the method for p-value adjustment.
a data frame of the input data.
a string that denotes the test distribution.
Factor labels for g
must be assigned in such a way,
that they can be increasingly ordered from zero-dose
control to the highest dose level, e.g. integers
{0, 1, 2, ..., k} or letters {a, b, c, ...}.
Otherwise the function may not select the correct values
for intended zero-dose control.
It is safer, to i) label the factor levels as given above,
and to ii) sort the data according to increasing dose-levels
prior to call the function (see order
, factor
).
Dunn, O. J. (1964) Multiple comparisons using rank sums, Technometrics 6, 241–252.
Siegel, S., Castellan Jr., N. J. (1988) Nonparametric Statistics for The Behavioral Sciences. New York: McGraw-Hill.
pmvnorm
,
TDist
,
kruskalTest
,
kwManyOneConoverTest
,
kwManyOneNdwTest
## Data set PlantGrowth ## Global test kruskalTest(weight ~ group, data = PlantGrowth) ## Conover's many-one comparison test ## single-step means p-value from multivariate t distribution ans <- kwManyOneConoverTest(weight ~ group, data = PlantGrowth, p.adjust.method = "single-step") summary(ans) ## Conover's many-one comparison test ans <- kwManyOneConoverTest(weight ~ group, data = PlantGrowth, p.adjust.method = "holm") summary(ans) ## Dunn's many-one comparison test ans <- kwManyOneDunnTest(weight ~ group, data = PlantGrowth, p.adjust.method = "holm") summary(ans) ## Nemenyi's many-one comparison test ans <- kwManyOneNdwTest(weight ~ group, data = PlantGrowth, p.adjust.method = "holm") summary(ans) ## Many one U test ans <- manyOneUTest(weight ~ group, data = PlantGrowth, p.adjust.method = "holm") summary(ans) ## Chen Test ans <- chenTest(weight ~ group, data = PlantGrowth, p.adjust.method = "holm") summary(ans)
## Data set PlantGrowth ## Global test kruskalTest(weight ~ group, data = PlantGrowth) ## Conover's many-one comparison test ## single-step means p-value from multivariate t distribution ans <- kwManyOneConoverTest(weight ~ group, data = PlantGrowth, p.adjust.method = "single-step") summary(ans) ## Conover's many-one comparison test ans <- kwManyOneConoverTest(weight ~ group, data = PlantGrowth, p.adjust.method = "holm") summary(ans) ## Dunn's many-one comparison test ans <- kwManyOneDunnTest(weight ~ group, data = PlantGrowth, p.adjust.method = "holm") summary(ans) ## Nemenyi's many-one comparison test ans <- kwManyOneNdwTest(weight ~ group, data = PlantGrowth, p.adjust.method = "holm") summary(ans) ## Many one U test ans <- manyOneUTest(weight ~ group, data = PlantGrowth, p.adjust.method = "holm") summary(ans) ## Chen Test ans <- chenTest(weight ~ group, data = PlantGrowth, p.adjust.method = "holm") summary(ans)
Performs Nemenyi-Damico-Wolfe non-parametric many-to-one comparison test for Kruskal-type ranked data.
kwManyOneNdwTest(x, ...) ## Default S3 method: kwManyOneNdwTest( x, g, alternative = c("two.sided", "greater", "less"), p.adjust.method = c("single-step", p.adjust.methods), ... ) ## S3 method for class 'formula' kwManyOneNdwTest( formula, data, subset, na.action, alternative = c("two.sided", "greater", "less"), p.adjust.method = c("single-step", p.adjust.methods), ... )
kwManyOneNdwTest(x, ...) ## Default S3 method: kwManyOneNdwTest( x, g, alternative = c("two.sided", "greater", "less"), p.adjust.method = c("single-step", p.adjust.methods), ... ) ## S3 method for class 'formula' kwManyOneNdwTest( formula, data, subset, na.action, alternative = c("two.sided", "greater", "less"), p.adjust.method = c("single-step", p.adjust.methods), ... )
x |
a numeric vector of data values, or a list of numeric data vectors. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
alternative |
the alternative hypothesis. Defaults to |
p.adjust.method |
method for adjusting p values
(see |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
For many-to-one comparisons (pairwise comparisons with one control)
in an one-factorial layout with non-normally distributed
residuals the Nemenyi-Damico-Wolfe non-parametric test can be performed.
Let there be groups including the control,
then the number of treatment levels is
.
Then
pairwise comparisons can be performed between
the
-th treatment level and the control.
H
is tested in the two-tailed case against
A
.
If p.adjust.method == "single-step"
is selected,
the -values will be computed
from the multivariate normal distribution. Otherwise,
the
-values are computed from the standard normal distribution using
any of the
-adjustment methods as included in
p.adjust
.
A list with class "PMCMR"
containing the following components:
a character string indicating what type of test was performed.
a character string giving the name(s) of the data.
lower-triangle matrix of the estimated quantiles of the pairwise test statistics.
lower-triangle matrix of the p-values for the pairwise tests.
a character string describing the alternative hypothesis.
a character string describing the method for p-value adjustment.
a data frame of the input data.
a string that denotes the test distribution.
This function is essentially the same as kwManyOneDunnTest
, but
there is no tie correction included. Therefore, the implementation of
Dunn's test is superior, when ties are present.
Damico, J. A., Wolfe, D. A. (1989) Extended tables of the exact distribution of a rank statistic for treatments versus control multiple comparisons in one-way layout designs, Communications in Statistics - Theory and Methods 18, 3327–3353.
Nemenyi, P. (1963) Distribution-free Multiple Comparisons, Ph.D. thesis, Princeton University.
pmvt
, TDist
, kruskalTest
,
kwManyOneDunnTest
, kwManyOneConoverTest
## Data set PlantGrowth ## Global test kruskalTest(weight ~ group, data = PlantGrowth) ## Conover's many-one comparison test ## single-step means p-value from multivariate t distribution ans <- kwManyOneConoverTest(weight ~ group, data = PlantGrowth, p.adjust.method = "single-step") summary(ans) ## Conover's many-one comparison test ans <- kwManyOneConoverTest(weight ~ group, data = PlantGrowth, p.adjust.method = "holm") summary(ans) ## Dunn's many-one comparison test ans <- kwManyOneDunnTest(weight ~ group, data = PlantGrowth, p.adjust.method = "holm") summary(ans) ## Nemenyi's many-one comparison test ans <- kwManyOneNdwTest(weight ~ group, data = PlantGrowth, p.adjust.method = "holm") summary(ans) ## Many one U test ans <- manyOneUTest(weight ~ group, data = PlantGrowth, p.adjust.method = "holm") summary(ans) ## Chen Test ans <- chenTest(weight ~ group, data = PlantGrowth, p.adjust.method = "holm") summary(ans)
## Data set PlantGrowth ## Global test kruskalTest(weight ~ group, data = PlantGrowth) ## Conover's many-one comparison test ## single-step means p-value from multivariate t distribution ans <- kwManyOneConoverTest(weight ~ group, data = PlantGrowth, p.adjust.method = "single-step") summary(ans) ## Conover's many-one comparison test ans <- kwManyOneConoverTest(weight ~ group, data = PlantGrowth, p.adjust.method = "holm") summary(ans) ## Dunn's many-one comparison test ans <- kwManyOneDunnTest(weight ~ group, data = PlantGrowth, p.adjust.method = "holm") summary(ans) ## Nemenyi's many-one comparison test ans <- kwManyOneNdwTest(weight ~ group, data = PlantGrowth, p.adjust.method = "holm") summary(ans) ## Many one U test ans <- manyOneUTest(weight ~ group, data = PlantGrowth, p.adjust.method = "holm") summary(ans) ## Chen Test ans <- chenTest(weight ~ group, data = PlantGrowth, p.adjust.method = "holm") summary(ans)
Performs Le's test for testing against ordered alternatives.
leTest(x, ...) ## Default S3 method: leTest(x, g, alternative = c("two.sided", "greater", "less"), ...) ## S3 method for class 'formula' leTest( formula, data, subset, na.action, alternative = c("two.sided", "greater", "less"), ... )
leTest(x, ...) ## Default S3 method: leTest(x, g, alternative = c("two.sided", "greater", "less"), ...) ## S3 method for class 'formula' leTest( formula, data, subset, na.action, alternative = c("two.sided", "greater", "less"), ... )
x |
a numeric vector of data values, or a list of numeric data vectors. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
alternative |
the alternative hypothesis. Defaults to |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
The null hypothesis, H
is tested against a simple order hypothesis,
H
.
The p-values are estimated from the standard normal distribution.
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.
Factor labels for g
must be assigned in such a way,
that they can be increasingly ordered from zero-dose
control to the highest dose level, e.g. integers
{0, 1, 2, ..., k} or letters {a, b, c, ...}.
Otherwise the function may not select the correct values
for intended zero-dose control.
It is safer, to i) label the factor levels as given above,
and to ii) sort the data according to increasing dose-levels
prior to call the function (see order
, factor
).
Le, C. T. (1988) A new rank test against ordered alternatives in k-sample problems, Biometrical Journal 30, 87–92.
kruskalTest
and shirleyWilliamsTest
of the package PMCMRplus,
kruskal.test
of the library stats.
## Example from Sachs (1997, p. 402) x <- c(106, 114, 116, 127, 145, 110, 125, 143, 148, 151, 136, 139, 149, 160, 174) g <- gl(3,5) levels(g) <- c("A", "B", "C") ## Chacko's test chackoTest(x, g) ## Cuzick's test cuzickTest(x, g) ## Johnson-Mehrotra test johnsonTest(x, g) ## Jonckheere-Terpstra test jonckheereTest(x, g) ## Le's test leTest(x, g) ## Spearman type test spearmanTest(x, g) ## Murakami's BWS trend test bwsTrendTest(x, g) ## Fligner-Wolfe test flignerWolfeTest(x, g) ## Shan-Young-Kang test shanTest(x, g)
## Example from Sachs (1997, p. 402) x <- c(106, 114, 116, 127, 145, 110, 125, 143, 148, 151, 136, 139, 149, 160, 174) g <- gl(3,5) levels(g) <- c("A", "B", "C") ## Chacko's test chackoTest(x, g) ## Cuzick's test cuzickTest(x, g) ## Johnson-Mehrotra test johnsonTest(x, g) ## Jonckheere-Terpstra test jonckheereTest(x, g) ## Le's test leTest(x, g) ## Spearman type test spearmanTest(x, g) ## Murakami's BWS trend test bwsTrendTest(x, g) ## Fligner-Wolfe test flignerWolfeTest(x, g) ## Shan-Young-Kang test shanTest(x, g)
Performs the least significant difference all-pairs comparisons test for normally distributed data with equal group variances.
lsdTest(x, ...) ## Default S3 method: lsdTest(x, g, ...) ## S3 method for class 'formula' lsdTest(formula, data, subset, na.action, ...) ## S3 method for class 'aov' lsdTest(x, ...)
lsdTest(x, ...) ## Default S3 method: lsdTest(x, g, ...) ## S3 method for class 'formula' lsdTest(formula, data, subset, na.action, ...) ## S3 method for class 'aov' lsdTest(x, ...)
x |
a numeric vector of data values, a list of numeric data vectors or a fitted model object, usually an aov fit. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
For all-pairs comparisons in an one-factorial layout
with normally distributed residuals and equal variances
the least signifiant difference test can be performed
after a significant ANOVA F-test.
Let denote a continuous random variable
with the
-the realization (
)
in the
-th group (
). Furthermore, the total
sample size is
. A total of
hypotheses can be tested: The null hypothesis is
H
is tested against the alternative
A
(two-tailed). Fisher's LSD all-pairs test
statistics are given by
with the within-group ANOVA variance.
The null hypothesis is rejected if
,
with
degree of freedom. The p-values (two-tailed)
are computed from the
TDist
distribution.
A list with class "PMCMR"
containing the following components:
a character string indicating what type of test was performed.
a character string giving the name(s) of the data.
lower-triangle matrix of the estimated quantiles of the pairwise test statistics.
lower-triangle matrix of the p-values for the pairwise tests.
a character string describing the alternative hypothesis.
a character string describing the method for p-value adjustment.
a data frame of the input data.
a string that denotes the test distribution.
As there is no p-value adjustment included, this function is equivalent
to Fisher's protected LSD test, provided that the LSD test is
only applied after a significant one-way ANOVA F-test.
If one is interested in other types of LSD test (i.e.
with p-value adustment) see function pairwise.t.test
.
Sachs, L. (1997) Angewandte Statistik, New York: Springer.
fit <- aov(weight ~ feed, chickwts) shapiro.test(residuals(fit)) bartlett.test(weight ~ feed, chickwts) anova(fit) ## also works with fitted objects of class aov res <- lsdTest(fit) summary(res) summaryGroup(res)
fit <- aov(weight ~ feed, chickwts) shapiro.test(residuals(fit)) bartlett.test(weight ~ feed, chickwts) anova(fit) ## also works with fitted objects of class aov res <- lsdTest(fit) summary(res) summaryGroup(res)
Performs Mack-Wolfe non-parametric test for umbrella alternatives.
mackWolfeTest(x, ...) ## Default S3 method: mackWolfeTest(x, g, p = NULL, nperm = 1000, ...) ## S3 method for class 'formula' mackWolfeTest(formula, data, subset, na.action, p = NULL, nperm = 1000, ...)
mackWolfeTest(x, ...) ## Default S3 method: mackWolfeTest(x, g, p = NULL, nperm = 1000, ...) ## S3 method for class 'formula' mackWolfeTest(formula, data, subset, na.action, p = NULL, nperm = 1000, ...)
x |
a numeric vector of data values, or a list of numeric data vectors. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
p |
the a-priori known peak as an ordinal number of the treatment
group including the zero dose level, i.e. |
nperm |
number of permutations for the assymptotic permutation test.
Defaults to |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
In dose-finding studies one may assume an increasing treatment effect with increasing dose level. However, the test subject may actually succumb to toxic effects at high doses, which leads to decresing treatment effects.
The scope of the Mack-Wolfe Test is to test for umbrella alternatives
for either a known or unknown point (i.e. dose-level),
where the peak (umbrella point) is present.
H is tested
against the alternative A
for some
, with at least one strict inequality.
If p = NULL
(peak unknown), the upper-tail -value is computed
via an asymptotic bootstrap permutation test.
If an integer value for p
is given (peak known), the
upper-tail -value is computed from the standard normal
distribution (
pnorm
).
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.
One may increase the number of permutations to e.g. nperm = 10000
in order to get more precise p-values. However, this will be on
the expense of computational time.
Chen, I. Y. (1991) Notes on the Mack-Wolfe and Chen-Wolfe Tests for Umbrella Alternatives, Biom. J. 33, 281–290.
Mack, G. A., Wolfe, D. A. (1981) K-sample rank tests for umbrella alternatives, J. Amer. Statist. Assoc. 76, 175–181.
## Example from Table 6.10 of Hollander and Wolfe (1999). ## Plates with Salmonella bacteria of strain TA98 were exposed to ## various doses of Acid Red 114 (in mu g / ml). ## The data are the numbers of visible revertant colonies on 12 plates. ## Assume a peak at D333 (i.e. p = 3). x <- c(22, 23, 35, 60, 59, 54, 98, 78, 50, 60, 82, 59, 22, 44, 33, 23, 21, 25) g <- as.ordered(rep(c(0, 100, 333, 1000, 3333, 10000), each=3)) plot(x ~ g) mackWolfeTest(x=x, g=g, p=3)
## Example from Table 6.10 of Hollander and Wolfe (1999). ## Plates with Salmonella bacteria of strain TA98 were exposed to ## various doses of Acid Red 114 (in mu g / ml). ## The data are the numbers of visible revertant colonies on 12 plates. ## Assume a peak at D333 (i.e. p = 3). x <- c(22, 23, 35, 60, 59, 54, 98, 78, 50, 60, 82, 59, 22, 44, 33, 23, 21, 25) g <- as.ordered(rep(c(0, 100, 333, 1000, 3333, 10000), each=3)) plot(x ~ g) mackWolfeTest(x=x, g=g, p=3)
Distribution function and quantile function for Mandel's h distribution.
qmandelh(p, k, lower.tail = TRUE, log.p = FALSE) pmandelh(q, k, lower.tail = TRUE, log.p = FALSE)
qmandelh(p, k, lower.tail = TRUE, log.p = FALSE) pmandelh(q, k, lower.tail = TRUE, log.p = FALSE)
p |
vector of probabilities. |
k |
number of groups. |
lower.tail |
logical; if TRUE (default),
probabilities are |
log.p |
logical; if |
q |
vector of quantiles. |
pmandelh
gives the distribution function and
qmandelh
gives the quantile function.
The code for pmandelh
was taken from:
Stephen L R Ellison. (2017). metRology: Support for Metrological
Applications. R package version 0.9-26-2.
https://CRAN.R-project.org/package=metRology
Practice E 691 (2005) Standard Practice for Conducting an Interlaboratory Study to Determine the Precision of a Test Method, ASTM International.
## We need a two-sided upper-tail quantile qmandelh(p = 0.005/2, k = 7, lower.tail=FALSE)
## We need a two-sided upper-tail quantile qmandelh(p = 0.005/2, k = 7, lower.tail=FALSE)
Distribution function and quantile function for Mandel's k distribution.
qmandelk(p, k, n, lower.tail = TRUE, log.p = FALSE) pmandelk(q, k, n, lower.tail = TRUE, log.p = FALSE)
qmandelk(p, k, n, lower.tail = TRUE, log.p = FALSE) pmandelk(q, k, n, lower.tail = TRUE, log.p = FALSE)
p |
vector of probabilities. |
k |
number of groups. |
n |
number of replicates per group. |
lower.tail |
logical; if TRUE (default),
probabilities are |
log.p |
logical; if |
q |
vector of quantiles. |
pmandelk
gives the distribution function and
qmandelk
gives the quantile function.
The code for pmandelk
was taken from:
Stephen L R Ellison. (2017). metRology: Support for Metrological
Applications. R package version 0.9-26-2.
https://CRAN.R-project.org/package=metRology
The functions are only appropriate for balanced designs.
Practice E 691 (2005) Standard Practice for Conducting an Interlaboratory Study to Determine the Precision of a Test Method, ASTM International.
qmandelk(0.005, 7, 3, lower.tail=FALSE)
qmandelk(0.005, 7, 3, lower.tail=FALSE)
The function calculates the consistency statistics h and corresponding p-values for each group (lab) according to Practice E 691 ASTM.
mandelhTest(x, ...) ## Default S3 method: mandelhTest(x, g, ...) ## S3 method for class 'formula' mandelhTest(formula, data, subset, na.action, ...)
mandelhTest(x, ...) ## Default S3 method: mandelhTest(x, g, ...) ## S3 method for class 'formula' mandelhTest(formula, data, subset, na.action, ...)
x |
a numeric vector of data values, or a list of numeric data vectors. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
A list with class "mandel"
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 p-value for the test.
the estimated quantiles of Mandel's statistic.
a character string describing the alternative hypothesis.
a character vector describing the levels of the groups.
the number of replicates for each group.
Practice E 691 (2005) Standard Practice for Conducting an Interlaboratory Study to Determine the Precision of a Test Method, ASTM International.
data(Pentosan) mandelhTest(value ~ lab, data=Pentosan, subset=(material == "A"))
data(Pentosan) mandelhTest(value ~ lab, data=Pentosan, subset=(material == "A"))
The function calculates the consistency statistics k and corresponding p-values for each group (lab) according to Practice E 691 ASTM.
mandelkTest(x, ...) ## Default S3 method: mandelkTest(x, g, ...) ## S3 method for class 'formula' mandelkTest(formula, data, subset, na.action, ...)
mandelkTest(x, ...) ## Default S3 method: mandelkTest(x, g, ...) ## S3 method for class 'formula' mandelkTest(formula, data, subset, na.action, ...)
x |
a numeric vector of data values, or a list of numeric data vectors. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
A list with class "mandel"
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 p-value for the test.
the estimated quantiles of Mandel's statistic.
a character string describing the alternative hypothesis.
a character vector describing the levels of the groups.
the number of replicates for each group.
Practice E 691 (2005) Standard Practice for Conducting an Interlaboratory Study to Determine the Precision of a Test Method, ASTM International.
data(Pentosan) mandelkTest(value ~ lab, data=Pentosan, subset=(material == "A"))
data(Pentosan) mandelkTest(value ~ lab, data=Pentosan, subset=(material == "A"))
Performs pairwise comparisons of multiple group levels with one control.
manyOneUTest(x, ...) ## Default S3 method: manyOneUTest( x, g, alternative = c("two.sided", "greater", "less"), p.adjust.method = c("single-step", p.adjust.methods), ... ) ## S3 method for class 'formula' manyOneUTest( formula, data, subset, na.action, alternative = c("two.sided", "greater", "less"), p.adjust.method = c("single-step", p.adjust.methods), ... )
manyOneUTest(x, ...) ## Default S3 method: manyOneUTest( x, g, alternative = c("two.sided", "greater", "less"), p.adjust.method = c("single-step", p.adjust.methods), ... ) ## S3 method for class 'formula' manyOneUTest( formula, data, subset, na.action, alternative = c("two.sided", "greater", "less"), p.adjust.method = c("single-step", p.adjust.methods), ... )
x |
a numeric vector of data values, or a list of numeric data vectors. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
alternative |
the alternative hypothesis. Defaults to |
p.adjust.method |
method for adjusting p values
(see |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
This functions performs Wilcoxon, Mann and Whitney's U-test
for a one factorial design where each factor level is tested against
one control ( tests). As the data are re-ranked
for each comparison, this test is only suitable for
balanced (or almost balanced) experimental designs.
For the two-tailed test and p.adjust.method = "single-step"
the multivariate normal distribution is used for controlling
Type 1 error and to calculate p-values. Otherwise,
the p-values are calculated from the standard normal distribution
with any latter p-adjustment as available by p.adjust
.
A list with class "PMCMR"
containing the following components:
a character string indicating what type of test was performed.
a character string giving the name(s) of the data.
lower-triangle matrix of the estimated quantiles of the pairwise test statistics.
lower-triangle matrix of the p-values for the pairwise tests.
a character string describing the alternative hypothesis.
a character string describing the method for p-value adjustment.
a data frame of the input data.
a string that denotes the test distribution.
Factor labels for g
must be assigned in such a way,
that they can be increasingly ordered from zero-dose
control to the highest dose level, e.g. integers
{0, 1, 2, ..., k} or letters {a, b, c, ...}.
Otherwise the function may not select the correct values
for intended zero-dose control.
It is safer, to i) label the factor levels as given above,
and to ii) sort the data according to increasing dose-levels
prior to call the function (see order
, factor
).
OECD (ed. 2006) Current approaches in the statistical analysis of ecotoxicity data: A guidance to application, OECD Series on testing and assessment, No. 54.
## Data set PlantGrowth ## Global test kruskalTest(weight ~ group, data = PlantGrowth) ## Conover's many-one comparison test ## single-step means p-value from multivariate t distribution ans <- kwManyOneConoverTest(weight ~ group, data = PlantGrowth, p.adjust.method = "single-step") summary(ans) ## Conover's many-one comparison test ans <- kwManyOneConoverTest(weight ~ group, data = PlantGrowth, p.adjust.method = "holm") summary(ans) ## Dunn's many-one comparison test ans <- kwManyOneDunnTest(weight ~ group, data = PlantGrowth, p.adjust.method = "holm") summary(ans) ## Nemenyi's many-one comparison test ans <- kwManyOneNdwTest(weight ~ group, data = PlantGrowth, p.adjust.method = "holm") summary(ans) ## Many one U test ans <- manyOneUTest(weight ~ group, data = PlantGrowth, p.adjust.method = "holm") summary(ans) ## Chen Test ans <- chenTest(weight ~ group, data = PlantGrowth, p.adjust.method = "holm") summary(ans)
## Data set PlantGrowth ## Global test kruskalTest(weight ~ group, data = PlantGrowth) ## Conover's many-one comparison test ## single-step means p-value from multivariate t distribution ans <- kwManyOneConoverTest(weight ~ group, data = PlantGrowth, p.adjust.method = "single-step") summary(ans) ## Conover's many-one comparison test ans <- kwManyOneConoverTest(weight ~ group, data = PlantGrowth, p.adjust.method = "holm") summary(ans) ## Dunn's many-one comparison test ans <- kwManyOneDunnTest(weight ~ group, data = PlantGrowth, p.adjust.method = "holm") summary(ans) ## Nemenyi's many-one comparison test ans <- kwManyOneNdwTest(weight ~ group, data = PlantGrowth, p.adjust.method = "holm") summary(ans) ## Many one U test ans <- manyOneUTest(weight ~ group, data = PlantGrowth, p.adjust.method = "holm") summary(ans) ## Chen Test ans <- chenTest(weight ~ group, data = PlantGrowth, p.adjust.method = "holm") summary(ans)
Performs Brown-Mood All Pairs Median Test.
medianAllPairsTest(x, ...) ## Default S3 method: medianAllPairsTest(x, g, p.adjust.method = p.adjust.methods, ...) ## S3 method for class 'formula' medianAllPairsTest( formula, data, subset, na.action, p.adjust.method = p.adjust.methods, ... )
medianAllPairsTest(x, ...) ## Default S3 method: medianAllPairsTest(x, g, p.adjust.method = p.adjust.methods, ...) ## S3 method for class 'formula' medianAllPairsTest( formula, data, subset, na.action, p.adjust.method = p.adjust.methods, ... )
x |
a numeric vector of data values, or a list of numeric data vectors. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
p.adjust.method |
method for adjusting p values
(see |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
For all-pairs comparisons in an one-factorial layout
with non-normally distributed residuals Brown-Mood
non-parametric Median test
can be performed. A total of
hypotheses can be tested. The null hypothesis
H
is tested in the two-tailed test
against the alternative
A
.
In this procedure the joined median is used for classification,
but pairwise Pearson Chisquare-Tests are conducted. Any method
as given by p.adjust.methods
can be used
to account for multiplicity.
A list with class "PMCMR"
containing the following components:
a character string indicating what type of test was performed.
a character string giving the name(s) of the data.
lower-triangle matrix of the estimated quantiles of the pairwise test statistics.
lower-triangle matrix of the p-values for the pairwise tests.
a character string describing the alternative hypothesis.
a character string describing the method for p-value adjustment.
a data frame of the input data.
a string that denotes the test distribution.
Brown, G.W., Mood, A.M., 1951, On Median Tests for Linear Hypotheses, in: Proceedings of the Second Berkeley Symposium on Mathematical Statistics and Probability. University of California Press, pp. 159–167.
## Data set InsectSprays ## Global test kruskalTest(count ~ spray, data = InsectSprays) ## Conover's all-pairs comparison test ## single-step means Tukey's p-adjustment ans <- kwAllPairsConoverTest(count ~ spray, data = InsectSprays, p.adjust.method = "single-step") summary(ans) ## Dunn's all-pairs comparison test ans <- kwAllPairsDunnTest(count ~ spray, data = InsectSprays, p.adjust.method = "bonferroni") summary(ans) ## Nemenyi's all-pairs comparison test ans <- kwAllPairsNemenyiTest(count ~ spray, data = InsectSprays) summary(ans) ## Brown-Mood all-pairs median test ans <- medianAllPairsTest(count ~ spray, data = InsectSprays) summary(ans)
## Data set InsectSprays ## Global test kruskalTest(count ~ spray, data = InsectSprays) ## Conover's all-pairs comparison test ## single-step means Tukey's p-adjustment ans <- kwAllPairsConoverTest(count ~ spray, data = InsectSprays, p.adjust.method = "single-step") summary(ans) ## Dunn's all-pairs comparison test ans <- kwAllPairsDunnTest(count ~ spray, data = InsectSprays, p.adjust.method = "bonferroni") summary(ans) ## Nemenyi's all-pairs comparison test ans <- kwAllPairsNemenyiTest(count ~ spray, data = InsectSprays) summary(ans) ## Brown-Mood all-pairs median test ans <- medianAllPairsTest(count ~ spray, data = InsectSprays) summary(ans)
Performs Brown-Mood Median Test.
medianTest(x, ...) ## Default S3 method: medianTest(x, g, simulate.p.value = FALSE, B = 2000, ...) ## S3 method for class 'formula' medianTest( formula, data, subset, na.action, simulate.p.value = FALSE, B = 2000, ... )
medianTest(x, ...) ## Default S3 method: medianTest(x, g, simulate.p.value = FALSE, B = 2000, ...) ## S3 method for class 'formula' medianTest( formula, data, subset, na.action, simulate.p.value = FALSE, B = 2000, ... )
x |
a numeric vector of data values, or a list of numeric data vectors. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
simulate.p.value |
a logical indicating whether to compute p-values by Monte-Carlo simulation. |
B |
an integer specifying the number of replicates used in the Monte-Carlo test. |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
The null hypothesis, H
is tested against the alternative,
H
, with at least
one unequality beeing strict.
A list with class ‘htest’. For details see
chisq.test
.
Brown, G.W., Mood, A.M., 1951, On Median Tests for Linear Hypotheses, in: Proceedings of the Second Berkeley Symposium on Mathematical Statistics and Probability. University of California Press, pp. 159–167.
## 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) ## End(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) ## End(Not run) ## Median Test asymptotic medianTest(x ~ g, dat) ## Median Test with simulated p-values set.seed(112) medianTest(x ~ g, dat, simulate.p.value = TRUE)
## 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) ## End(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) ## End(Not run) ## Median Test asymptotic medianTest(x ~ g, dat) ## Median Test with simulated p-values set.seed(112) medianTest(x ~ g, dat, simulate.p.value = TRUE)
The function has implemented the nonparametric test of
Madhava Rao and Raghunath (2016) for testing paired two-samples
for symmetry. The null hypothesis
is tested against the alternative
.
mrrTest(x, ...) ## Default S3 method: mrrTest(x, y = NULL, m = NULL, ...) ## S3 method for class 'formula' mrrTest(formula, data, subset, na.action, ...)
mrrTest(x, ...) ## Default S3 method: mrrTest(x, y = NULL, m = NULL, ...) ## S3 method for class 'formula' mrrTest(formula, data, subset, na.action, ...)
x |
numeric vector of data values. Non-finite (e.g., infinite or missing) values will be omitted. |
... |
further arguments to be passed to or from methods. |
y |
an optional numeric vector of data values: as with x non-finite values will be omitted. |
m |
numeric, optional integer number, whereas |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
Let and
denote
continuous variables that were observed
on the same
th test item (e.g. patient)
with
. Let
Let be the
th order statistic,
and
the
number of clusters, with the condition:
Further, let the divider denote ,
, and else
The two counts are
and
The test statistic is
The exact p-values for are taken from an
internal look-up table. The exact p-values were taken
from Table 7, Appendix B of Madhava Rao and Raghunath (2016).
If m = NULL
the function uses for
all prime numbers, otherwise it tries to find an value for
m in such a way, that for
all variables
are integer.
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 function returns an error code if a value for m
is provided that does not lead to an integer of the ratio
.
The function also returns an error code, if a tabulated
value for given ,
and calculated
can not be found in the look-up table.
Madhava Rao, K.S., Ragunath, M. (2016) A Simple Nonparametric Test for Testing Treatment Versus Control. J Stat Adv Theory Appl 16, 133–162. doi:10.18642/jsata_7100121717
## Madhava Rao and Raghunath (2016), p. 151 ## Inulin clearance of living donors ## and recipients of their kidneys x <- c(61.4, 63.3, 63.7, 80.0, 77.3, 84.0, 105.0) y <- c(70.8, 89.2, 65.8, 67.1, 87.3, 85.1, 88.1) mrrTest(x, y) ## formula method ## Student's Sleep Data mrrTest(extra ~ group, data = sleep)
## Madhava Rao and Raghunath (2016), p. 151 ## Inulin clearance of living donors ## and recipients of their kidneys x <- c(61.4, 63.3, 63.7, 80.0, 77.3, 84.0, 105.0) y <- c(70.8, 89.2, 65.8, 67.1, 87.3, 85.1, 88.1) mrrTest(x, y) ## formula method ## Student's Sleep Data mrrTest(extra ~ group, data = sleep)
Performs Nashimoto-Wright's extended one-sided studentised range test against an ordered alternative for normal data with equal variances.
MTest(x, ...) ## Default S3 method: MTest(x, g, alternative = c("greater", "less"), ...) ## S3 method for class 'formula' MTest( formula, data, subset, na.action, alternative = c("greater", "less"), ... ) ## S3 method for class 'aov' MTest(x, alternative = c("greater", "less"), ...)
MTest(x, ...) ## Default S3 method: MTest(x, g, alternative = c("greater", "less"), ...) ## S3 method for class 'formula' MTest( formula, data, subset, na.action, alternative = c("greater", "less"), ... ) ## S3 method for class 'aov' MTest(x, alternative = c("greater", "less"), ...)
x |
a numeric vector of data values, or a list of numeric data vectors. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
alternative |
the alternative hypothesis. Defaults to |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
The procedure uses the property of a simple order,
.
The null hypothesis H
is tested against
the alternative A
for any
.
The all-pairs comparisons test statistics for a balanced design are
with ,
the arithmetic mean of the
th group,
and
the within ANOVA variance. The null hypothesis is rejected,
if
, with
degree of freedom.
For the unbalanced case with moderate imbalance the test statistic is
The null hypothesis is rejected, if .
The function does not return p-values. Instead the critical h-values
as given in the tables of Hayter (1990) for (one-sided)
are looked up according to the number of groups (
) and
the degree of freedoms (
).
a character string indicating what type of test was performed.
a character string giving the name(s) of the data.
the estimated statistic(s)
critical values for .
a character string describing the alternative hypothesis.
the parameter(s) of the test distribution.
a string that denotes the test distribution.
There are print and summary methods available.
The function will give a warning for the unbalanced case and returns the
critical value .
Hayter, A. J.(1990) A One-Sided Studentised Range Test for Testing Against a Simple Ordered Alternative, Journal of the American Statistical Association 85, 778–785.
Nashimoto, K., Wright, F.T., (2005) Multiple comparison procedures for detecting differences in simply ordered means. Comput. Statist. Data Anal. 48, 291–306.
## md <- aov(weight ~ group, PlantGrowth) anova(md) osrtTest(md) MTest(md)
## md <- aov(weight ~ group, PlantGrowth) anova(md) osrtTest(md) MTest(md)
Performs Lu-Smith all-pairs comparison normal scores test.
normalScoresAllPairsTest(x, ...) ## Default S3 method: normalScoresAllPairsTest( x, g, p.adjust.method = c("single-step", p.adjust.methods), ... ) ## S3 method for class 'formula' normalScoresAllPairsTest( formula, data, subset, na.action, p.adjust.method = c("single-step", p.adjust.methods), ... )
normalScoresAllPairsTest(x, ...) ## Default S3 method: normalScoresAllPairsTest( x, g, p.adjust.method = c("single-step", p.adjust.methods), ... ) ## S3 method for class 'formula' normalScoresAllPairsTest( formula, data, subset, na.action, p.adjust.method = c("single-step", p.adjust.methods), ... )
x |
a numeric vector of data values, or a list of numeric data vectors. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
p.adjust.method |
method for adjusting p values (see |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
For all-pairs comparisons in an one-factorial layout
with non-normally distributed residuals Lu and Smith's
normal scores transformation can be used prior to
an all-pairs comparison test. A total of
hypotheses can be tested. The null hypothesis
H
is tested in the two-tailed test
against the alternative
A
.
For
p.adjust.method = "single-step"
the
Tukey's studentized range distribution is used to calculate
p-values (see Tukey
). Otherwise, the
t-distribution is used for the calculation of p-values
with a latter p-value adjustment as
performed by p.adjust
.
A list with class "PMCMR"
containing the following components:
a character string indicating what type of test was performed.
a character string giving the name(s) of the data.
lower-triangle matrix of the estimated quantiles of the pairwise test statistics.
lower-triangle matrix of the p-values for the pairwise tests.
a character string describing the alternative hypothesis.
a character string describing the method for p-value adjustment.
a data frame of the input data.
a string that denotes the test distribution.
Lu, H., Smith, P. (1979) Distribution of normal scores statistic for nonparametric one-way analysis of variance. Journal of the American Statistical Association 74, 715–722.
normalScoresTest
, normalScoresManyOneTest
, normOrder
.
Performs Lu-Smith multiple comparison normal scores test with one control.
normalScoresManyOneTest(x, ...) ## Default S3 method: normalScoresManyOneTest( x, g, alternative = c("two.sided", "greater", "less"), p.adjust.method = c("single-step", p.adjust.methods), ... ) ## S3 method for class 'formula' normalScoresManyOneTest( formula, data, subset, na.action, alternative = c("two.sided", "greater", "less"), p.adjust.method = c("single-step", p.adjust.methods), ... )
normalScoresManyOneTest(x, ...) ## Default S3 method: normalScoresManyOneTest( x, g, alternative = c("two.sided", "greater", "less"), p.adjust.method = c("single-step", p.adjust.methods), ... ) ## S3 method for class 'formula' normalScoresManyOneTest( formula, data, subset, na.action, alternative = c("two.sided", "greater", "less"), p.adjust.method = c("single-step", p.adjust.methods), ... )
x |
a numeric vector of data values, or a list of numeric data vectors. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
alternative |
the alternative hypothesis. Defaults to |
p.adjust.method |
method for adjusting p values (see |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
For many-to-one comparisons in an one-factorial layout
with non-normally distributed residuals Lu and Smith's
normal scores transformation can be used prior to
a many-to-one comparison test. A total of
hypotheses can be tested. The null hypothesis
H
is tested in the two-tailed test
against the alternative
A
.
For
p.adjust.method = "single-step"
the
multivariate t distribution is used to calculate
p-values (see pmvt
). Otherwise, the
t-distribution is used for the calculation of p-values
with a latter p-value adjustment as
performed by p.adjust
.
A list with class "PMCMR"
containing the following components:
a character string indicating what type of test was performed.
a character string giving the name(s) of the data.
lower-triangle matrix of the estimated quantiles of the pairwise test statistics.
lower-triangle matrix of the p-values for the pairwise tests.
a character string describing the alternative hypothesis.
a character string describing the method for p-value adjustment.
a data frame of the input data.
a string that denotes the test distribution.
Factor labels for g
must be assigned in such a way,
that they can be increasingly ordered from zero-dose
control to the highest dose level, e.g. integers
{0, 1, 2, ..., k} or letters {a, b, c, ...}.
Otherwise the function may not select the correct values
for intended zero-dose control.
It is safer, to i) label the factor levels as given above,
and to ii) sort the data according to increasing dose-levels
prior to call the function (see order
, factor
).
Lu, H., Smith, P. (1979) Distribution of normal scores statistic for nonparametric one-way analysis of variance. Journal of the American Statistical Association 74, 715–722.
normalScoresTest
, normalScoresAllPairsTest
, normOrder
, pmvt
.
## Data set PlantGrowth ## Global test normalScoresTest(weight ~ group, data = PlantGrowth) ## Lu-Smith's many-one comparison test ans <- normalScoresManyOneTest(weight ~ group, data = PlantGrowth, p.adjust.method = "holm") summary(ans)
## Data set PlantGrowth ## Global test normalScoresTest(weight ~ group, data = PlantGrowth) ## Lu-Smith's many-one comparison test ans <- normalScoresManyOneTest(weight ~ group, data = PlantGrowth, p.adjust.method = "holm") summary(ans)
Performs the Lu-Smith normal score test
normalScoresTest(x, ...) ## Default S3 method: normalScoresTest(x, g, ...) ## S3 method for class 'formula' normalScoresTest(formula, data, subset, na.action, ...)
normalScoresTest(x, ...) ## Default S3 method: normalScoresTest(x, g, ...) ## S3 method for class 'formula' normalScoresTest(formula, data, subset, na.action, ...)
x |
a numeric vector of data values, or a list of numeric data vectors. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
For one-factorial designs with non-normally distributed
residuals the Lu-Smith normal score test can be performed to test
the H against
the H
with at least
one strict inequality. This function is basically a wrapper function to
pNormScore
of the package SuppDists.
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.
Lu, H., Smith, P. (1979) Distribution of normal scores statistic for nonparametric one-way analysis of variance. Journal of the American Statistical Association 74, 715–722.
vanWaerdenTest
, kruskalTest
,
pNormScore
normalScoresTest(count ~ spray, data = InsectSprays)
normalScoresTest(count ~ spray, data = InsectSprays)
Performs Nashimoto and Wright's all-pairs comparison procedure for simply ordered mean ranksums.
NPMTest(x, ...) ## Default S3 method: NPMTest( x, g, alternative = c("greater", "less"), method = c("look-up", "boot", "asympt"), nperm = 10000, ... ) ## S3 method for class 'formula' NPMTest( formula, data, subset, na.action, alternative = c("greater", "less"), method = c("look-up", "boot", "asympt"), nperm = 10000, ... )
NPMTest(x, ...) ## Default S3 method: NPMTest( x, g, alternative = c("greater", "less"), method = c("look-up", "boot", "asympt"), nperm = 10000, ... ) ## S3 method for class 'formula' NPMTest( formula, data, subset, na.action, alternative = c("greater", "less"), method = c("look-up", "boot", "asympt"), nperm = 10000, ... )
x |
a numeric vector of data values, or a list of numeric data vectors. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
alternative |
the alternative hypothesis. Defaults to |
method |
a character string specifying the test statistic to use.
Defaults to |
nperm |
number of permutations for the asymptotic permutation test.
Defaults to |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
The procedure uses the property of a simple order,
.
The null hypothesis H
is tested against
the alternative A
for any
.
The all-pairs comparisons test statistics for a balanced design are
with ,
the mean rank for the
th group,
and
. The null hypothesis is rejected,
if
.
For the unbalanced case with moderate imbalance the test statistic is
The null hypothesis is rejected, if .
If method = "look-up"
the function will not return
p-values. Instead the critical h-values
as given in the tables of Hayter (1990) for
(one-sided)
are looked up according to the number of groups (
) and
the degree of freedoms (
).
If method = "boot"
an asymetric permutation test
is conducted and -values is returned.
If method = "asympt"
is selected the asymptotic
-value is estimated as implemented in the
function
pHayStonLSA
of the package NSM3.
a character string indicating what type of test was performed.
a character string giving the name(s) of the data.
the estimated statistic(s)
critical values for .
a character string describing the alternative hypothesis.
the parameter(s) of the test distribution.
a string that denotes the test distribution.
There are print and summary methods available.
Either a list of class "PMCMR"
or a
list with class "osrt"
that contains 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 statistic(s)
critical values for .
a character string describing the alternative hypothesis.
the parameter(s) of the test distribution.
a string that denotes the test distribution.
There are print and summary methods available.
A list with class "PMCMR"
containing the following components:
a character string indicating what type of test was performed.
a character string giving the name(s) of the data.
lower-triangle matrix of the estimated quantiles of the pairwise test statistics.
lower-triangle matrix of the p-values for the pairwise tests.
a character string describing the alternative hypothesis.
a character string describing the method for p-value adjustment.
a data frame of the input data.
a string that denotes the test distribution.
The function will give a warning for the unbalanced case and returns the
critical value .
If method = "asympt"
is selected, this function calls
an internal probability function pHS
. The GPL-2 code for
this function was taken from pHayStonLSA
of the
the package NSM3:
Grant Schneider, Eric Chicken and Rachel Becvarik (2020) NSM3: Functions and Datasets to Accompany Hollander, Wolfe, and Chicken - Nonparametric Statistical Methods, Third Edition. R package version 1.15. https://CRAN.R-project.org/package=NSM3
Hayter, A. J.(1990) A One-Sided Studentised Range Test for Testing Against a Simple Ordered Alternative, Journal of the American Statistical Association 85, 778–785.
Nashimoto, K., Wright, F.T. (2007) Nonparametric Multiple-Comparison Methods for Simply Ordered Medians. Comput Stat Data Anal 51, 5068–5076.
## Example from Shirley (1977) ## Reaction times of mice to stimuli to their tails. x <- c(2.4, 3, 3, 2.2, 2.2, 2.2, 2.2, 2.8, 2, 3, 2.8, 2.2, 3.8, 9.4, 8.4, 3, 3.2, 4.4, 3.2, 7.4, 9.8, 3.2, 5.8, 7.8, 2.6, 2.2, 6.2, 9.4, 7.8, 3.4, 7, 9.8, 9.4, 8.8, 8.8, 3.4, 9, 8.4, 2.4, 7.8) g <- gl(4, 10) ## Shirley's test ## one-sided test using look-up table shirleyWilliamsTest(x ~ g, alternative = "greater") ## Chacko's global hypothesis test for 'greater' chackoTest(x , g) ## post-hoc test, default is standard normal distribution (NPT'-test) summary(chaAllPairsNashimotoTest(x, g, p.adjust.method = "none")) ## same but h-distribution (NPY'-test) chaAllPairsNashimotoTest(x, g, dist = "h") ## NPM-test NPMTest(x, g) ## Hayter-Stone test hayterStoneTest(x, g) ## all-pairs comparisons hsAllPairsTest(x, g)
## Example from Shirley (1977) ## Reaction times of mice to stimuli to their tails. x <- c(2.4, 3, 3, 2.2, 2.2, 2.2, 2.2, 2.8, 2, 3, 2.8, 2.2, 3.8, 9.4, 8.4, 3, 3.2, 4.4, 3.2, 7.4, 9.8, 3.2, 5.8, 7.8, 2.6, 2.2, 6.2, 9.4, 7.8, 3.4, 7, 9.8, 9.4, 8.8, 8.8, 3.4, 9, 8.4, 2.4, 7.8) g <- gl(4, 10) ## Shirley's test ## one-sided test using look-up table shirleyWilliamsTest(x ~ g, alternative = "greater") ## Chacko's global hypothesis test for 'greater' chackoTest(x , g) ## post-hoc test, default is standard normal distribution (NPT'-test) summary(chaAllPairsNashimotoTest(x, g, p.adjust.method = "none")) ## same but h-distribution (NPY'-test) chaAllPairsNashimotoTest(x, g, dist = "h") ## NPM-test NPMTest(x, g) ## Hayter-Stone test hayterStoneTest(x, g) ## all-pairs comparisons hsAllPairsTest(x, g)
Performs Hayter's one-sided studentized range test against an ordered alternative for normal data with equal variances.
osrtTest(x, ...) ## Default S3 method: osrtTest(x, g, alternative = c("greater", "less"), ...) ## S3 method for class 'formula' osrtTest( formula, data, subset, na.action, alternative = c("greater", "less"), ... ) ## S3 method for class 'aov' osrtTest(x, alternative = c("greater", "less"), ...)
osrtTest(x, ...) ## Default S3 method: osrtTest(x, g, alternative = c("greater", "less"), ...) ## S3 method for class 'formula' osrtTest( formula, data, subset, na.action, alternative = c("greater", "less"), ... ) ## S3 method for class 'aov' osrtTest(x, alternative = c("greater", "less"), ...)
x |
a numeric vector of data values, or a list of numeric data vectors. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
alternative |
the alternative hypothesis. Defaults to |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
Hayter's one-sided studentized range test (OSRT) can be used
for testing several treatment levels with a zero control in a balanced
one-factorial design with normally distributed variables that have a
common variance. The null hypothesis, H:
is tested against a simple order alternative,
A:
, with at least one inequality being strict.
The test statistic is calculated as,
with the number of groups,
and
the within ANOVA variance. The null hypothesis
is rejected, if
, with
degree of freedom.
For the unbalanced case with moderate imbalance the test statistic is
The function does not return p-values. Instead the critical h-values
as given in the tables of Hayter (1990) for (one-sided)
are looked up according to the number of groups (
) and
the degree of freedoms (
).
Non tabulated values are linearly interpolated with the function
approx
.
A list with class "osrt"
that contains 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 statistic(s)
critical values for .
a character string describing the alternative hypothesis.
the parameter(s) of the test distribution.
a string that denotes the test distribution.
There are print and summary methods available.
Hayter (1990) has tabulated critical h-values for balanced designs only.
For some unbalanced designs some critical h-values
can be found in Hayter et al. 2001. ' The function will give
a warning for the unbalanced case and returns the
critical value
.
Hayter, A. J.(1990) A One-Sided Studentised Range Test for Testing Against a Simple Ordered Alternative, Journal of the American Statistical Association 85, 778–785.
Hayter, A.J., Miwa, T., Liu, W. (2001) Efficient Directional Inference Methodologies for the Comparisons of Three Ordered Treatment Effects. J Japan Statist Soc 31, 153–174.
link{hayterStoneTest}
MTest
## md <- aov(weight ~ group, PlantGrowth) anova(md) osrtTest(md) MTest(md)
## md <- aov(weight ~ group, PlantGrowth) anova(md) osrtTest(md) MTest(md)
Performs Page's ordered aligned rank sum test.
pageTest(y, ...) ## Default S3 method: pageTest( y, groups, blocks, alternative = c("two.sided", "greater", "less"), ... )
pageTest(y, ...) ## Default S3 method: pageTest( y, groups, blocks, alternative = c("two.sided", "greater", "less"), ... )
y |
a numeric vector of data values, or a list of numeric data vectors. |
groups |
a vector or factor object giving the group for the
corresponding elements of |
blocks |
a vector or factor object giving the block for the
corresponding elements of |
alternative |
the alternative hypothesis.
Defaults to |
... |
further arguments to be passed to or from methods. |
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.
Page, E. B. (1963) Ordered hypotheses for multiple treatments: A significance test for linear ranks, Journal of the American Statistical Association 58, 216–230.
Sachs, L. (1997) Angewandte Statistik. Berlin: Springer.
## Sachs (1997), pp. 671 ff. ## 9 reviewers (blocks) ## assigned ranks to 4 objects (groups). data(reviewers) ## See Sachs (1997) p. 677 pageTest(reviewers, alternative = "greater")
## Sachs (1997), pp. 671 ff. ## 9 reviewers (blocks) ## assigned ranks to 4 objects (groups). data(reviewers) ## See Sachs (1997) p. 677 pageTest(reviewers, alternative = "greater")
A benchmark dataset of an interlaboratory study for determining the precision of a test method on several levels of the material Pentosan.
A data frame with 189 obs. of 3 variables:
numeric, test result (no unit specified)
factor, identifier of the lab (1–7)
factor, identifier of the level of the material (A–I)
Tab. 8, Practice E 691, 2005, Standard Practice for Conducting an Interlaboratory Study to Determine the Precision of a Test Method, ASTM International.
Plotting method for objects inheriting from class "mandel"
.
## S3 method for class 'mandel' plot(x, alpha = 0.005, ...)
## S3 method for class 'mandel' plot(x, alpha = 0.005, ...)
x |
an object with class |
alpha |
level of significance. Defaults to |
... |
further arguments, currently ignored. |
demo(Pentosan)
## ## Not run: data(Pentosan) md <- mandelkTest(value ~ lab, Pentosan, subset = (material == "B")) plot(md) ## End(Not run)
## ## Not run: data(Pentosan) md <- mandelkTest(value ~ lab, Pentosan, subset = (material == "B")) plot(md) ## End(Not run)
Plotting method for objects inheriting from class "PMCMR"
.
## S3 method for class 'PMCMR' plot(x, alpha = 0.05, ...)
## S3 method for class 'PMCMR' plot(x, alpha = 0.05, ...)
x |
an object of class |
alpha |
the selected alpha-level. Defaults to 0.05. |
... |
further arguments for method |
A box-whisker plot for each factor level. The range of the whiskers indicate
the extremes (boxplot = x, ..., range=0
). Letter symbols are depicted on top of each box.
Different letters indicate significant
differences between groups on the selected level of alpha.
## data set InsectSprays ans <- kwAllPairsNemenyiTest(count ~ spray, data = InsectSprays) plot(ans) plot(ans, col="red",main="My title", xlab="Spray", "Count")
## data set InsectSprays ans <- kwAllPairsNemenyiTest(count ~ spray, data = InsectSprays) plot(ans) plot(ans, col="red",main="My title", xlab="Spray", "Count")
Compute average per-pair power of Dunnetts's multiple comparison test with one control.
power.dunnett.test(n, groups, delta, within.var, sig.level = 0.05)
power.dunnett.test(n, groups, delta, within.var, sig.level = 0.05)
n |
Number of observations (per group) |
groups |
Number of groups (including control) |
delta |
true difference in means |
within.var |
Within group variance |
sig.level |
Significance level (Type I error probability) |
The function has implemented the following Eq. to estimate average per-pair power for two-sided tests:
with the two-sided
quantile of
the multivariate t-distribution, with
degree of freedom,
the number of groups
and correlation matrix
.
The non-centrality parameter for the non-central student t-distribution is
Object of class ‘power.htest
’,
a list of the arguments
(including the computed one) augmented with
method
and note
elements.
The results for power are seed depending.
The Eqs. were taken from Lecture 5, Determining Sample Size, Statistics 514, Fall 2015, Purdue University, IN, USA.
set.seed(113) power.dunnett.test(n = 9, groups = 5, delta = 30, within.var = 333.7) ## compare with t-test, bonferroni corrected power.t.test(n = 9, delta = 30, sd = sqrt(333.7), sig.level = 0.05 / 4) ## Not run: ## asymptotic Monte-Carlo power analysis set.seed(113) powerMCTests(mu = c(rep(0,4), 30), n = 9, parms = list(mean = 0, sd = sqrt(333.7)), test = "dunnettTest", alternative = "two.sided") ## End(Not run)
set.seed(113) power.dunnett.test(n = 9, groups = 5, delta = 30, within.var = 333.7) ## compare with t-test, bonferroni corrected power.t.test(n = 9, delta = 30, sd = sqrt(333.7), sig.level = 0.05 / 4) ## Not run: ## asymptotic Monte-Carlo power analysis set.seed(113) powerMCTests(mu = c(rep(0,4), 30), n = 9, parms = list(mean = 0, sd = sqrt(333.7)), test = "dunnettTest", alternative = "two.sided") ## End(Not run)
Compute average per-pair power of Tukey's test for multiple comparison of means.
power.tukey.test(n, groups, delta, within.var, sig.level = 0.05)
power.tukey.test(n, groups, delta, within.var, sig.level = 0.05)
n |
number of observations (per group) |
groups |
number of groups |
delta |
true difference in means |
within.var |
within group variance |
sig.level |
significance level (Type I error probability) |
The function has implemented the following Eq. to estimate average per-pair power for two-sided tests:
with the upper
quantile of
the studentised range distribution, with
degree of freedom and
the number of groups;
and
the probability function of the non-central student t-distribution
with non-centrality parameter
Object of class ‘power.htest
’,
a list of the arguments
(including the computed one) augmented with
method
and note
elements.
The Eqs. were taken from Lecture 5, Determining Sample Size, Statistics 514, Fall 2015, Purdue University, IN, USA.
power.tukey.test(n = 11, groups = 5, delta = 30, within.var = 333.7) ## compare with t-test, Bonferroni-correction power.t.test(n = 11, delta = 30, sd = sqrt(333.7), sig.level = 0.05 / 10) ## Not run: powerMCTests(mu = c(rep(0,4), 30), n = 11, parms = list(mean = 0,sd = sqrt(333.7)), test = "tukeyTest") ## End(Not run)
power.tukey.test(n = 11, groups = 5, delta = 30, within.var = 333.7) ## compare with t-test, Bonferroni-correction power.t.test(n = 11, delta = 30, sd = sqrt(333.7), sig.level = 0.05 / 10) ## Not run: powerMCTests(mu = c(rep(0,4), 30), n = 11, parms = list(mean = 0,sd = sqrt(333.7)), test = "tukeyTest") ## End(Not run)
Compute the power of a Williams' test, or determine parameters to obtain a target power.
power.williams.test(n = NULL, k, delta, sd = 1, power = NULL, ...)
power.williams.test(n = NULL, k, delta, sd = 1, power = NULL, ...)
n |
number of observations (per group). |
k |
number of treatment groups. |
delta |
clinically meaningful minimal difference (between a treatment group and control). |
sd |
common standard deviation. |
power |
power of test (1 minus Type II error probability). |
... |
further arguments, currently ignored. |
Exactly one of the parameters n
or power
must be passed as NULL
, and that
parameter is determined from the others.
The function has implemented the following Eq. in order to estimate power (Chow et al. 2008):
with the clinically meaningful minimal difference,
the critical Williams' t-statistic
for
,
degree of freedom
and
the probability function of the standard normal function.
The required sample size (balanced design) is estimated based on the expression as given by the PASS manual, p. 595-2:
Object of class ‘power.htest
’, a list of the arguments
(including the
computed one) augmented with method and note elements.
The current function calculates power for sig.level = 0.05
significance level (Type I error probability) only (one-sided test).
Chow, S.-C., Shao, J., Wan, H., 2008, Sample Size Calculations in Clinical Research, 2nd ed, Chapman & Hall/CRC: Boca Raton, FL.
## Chow et al. 2008, p. 288 depicts 53 (rounded), ## better use ceiling for rounding power.williams.test(power = 0.8, k = 3, delta = 11, sd = 22) power.williams.test(n = 54, k = 3, delta = 11, sd = 22) ## PASS manual example: ## up-rounded n values are: ## 116, 52, 29, 14, 8 and 5 ## according to PASS manual, p. 595-5 D <- c(10, 15, 20, 30, 40, 50) y <- sapply(D, function(delta) { power.williams.test(power = 0.9, k = 4, delta = delta, sd = 25)$n }) ceiling(y) ## Not run: ## compare with power.t.test ## and bonferroni correction power.t.test(power = 0.9, delta = 50, sd = 25, sig.level = 0.05 / 4, alternative = "one.sided") ## End(Not run)
## Chow et al. 2008, p. 288 depicts 53 (rounded), ## better use ceiling for rounding power.williams.test(power = 0.8, k = 3, delta = 11, sd = 22) power.williams.test(n = 54, k = 3, delta = 11, sd = 22) ## PASS manual example: ## up-rounded n values are: ## 116, 52, 29, 14, 8 and 5 ## according to PASS manual, p. 595-5 D <- c(10, 15, 20, 30, 40, 50) y <- sapply(D, function(delta) { power.williams.test(power = 0.9, k = 4, delta = delta, sd = 25)$n }) ceiling(y) ## Not run: ## compare with power.t.test ## and bonferroni correction power.t.test(power = 0.9, delta = 50, sd = 25, sig.level = 0.05 / 4, alternative = "one.sided") ## End(Not run)
Performs power simulation for one-factorial all-pairs and Many-To-One comparison tests.
powerMCTests( mu, n = 10, errfn = c("Normal", "Lognormal", "Exponential", "Chisquare", "TDist", "Cauchy", "Weibull"), parms = list(mean = 0, sd = 1), test = c("kwManyOneConoverTest", "kwManyOneDunnTest", "kwManyOneNdwTest", "vanWaerdenManyOneTest", "normalScoresManyOneTest", "dunnettTest", "tamhaneDunnettTest", "ManyOneUTest", "chenTest", "kwAllPairsNemenyiTest", "kwAllPairsDunnTest", "kwAllPairsConoverTest", "normalScoresAllPairsTest", "vanWaerdenAllPairsTest", "dscfAllPairsTest", "gamesHowellTest", "lsdTest", "scheffeTest", "tamhaneT2Test", "tukeyTest", "dunnettT3Test", "pairwise.t.test", "pairwise.wilcox.test", "adManyOneTest", "adAllPairsTest", "bwsManyOneTest", "bwsAllPairsTest", "welchManyOneTTest"), alternative = c("two.sided", "greater", "less"), p.adjust.method = c("single-step", p.adjust.methods), alpha = 0.05, FWER = TRUE, replicates = 1000 )
powerMCTests( mu, n = 10, errfn = c("Normal", "Lognormal", "Exponential", "Chisquare", "TDist", "Cauchy", "Weibull"), parms = list(mean = 0, sd = 1), test = c("kwManyOneConoverTest", "kwManyOneDunnTest", "kwManyOneNdwTest", "vanWaerdenManyOneTest", "normalScoresManyOneTest", "dunnettTest", "tamhaneDunnettTest", "ManyOneUTest", "chenTest", "kwAllPairsNemenyiTest", "kwAllPairsDunnTest", "kwAllPairsConoverTest", "normalScoresAllPairsTest", "vanWaerdenAllPairsTest", "dscfAllPairsTest", "gamesHowellTest", "lsdTest", "scheffeTest", "tamhaneT2Test", "tukeyTest", "dunnettT3Test", "pairwise.t.test", "pairwise.wilcox.test", "adManyOneTest", "adAllPairsTest", "bwsManyOneTest", "bwsAllPairsTest", "welchManyOneTTest"), alternative = c("two.sided", "greater", "less"), p.adjust.method = c("single-step", p.adjust.methods), alpha = 0.05, FWER = TRUE, replicates = 1000 )
mu |
numeric vector of group means. |
n |
number of replicates per group. If |
errfn |
the error function. Defaults to |
parms |
a list that denotes the arguments for the error function.
Defaults to |
test |
the multiple comparison test for which the power analysis is
to be performed. Defaults to |
alternative |
the alternative hypothesis. Defaults to |
p.adjust.method |
method for adjusting p values (see |
alpha |
the nominal level of Type I Error. |
FWER |
logical, indicates whether the family-wise error should be computed.
Defaults to |
replicates |
the number of Monte Carlo replicates or runs. Defaults to |
The linear model of a one-way ANOVA can be written as:
For each Monte Carlo run, the function simulates based on the given error function and
the corresponding parameters. Then the specified all-pairs
or many-to-one comparison test is performed.
Finally, several effect sizes (Cohen's f ans R-squared),
error rates (per comparison error rate,
false discovery rate and familywise error rate)
and test powers (any-pair power, average per-pair power
and all-pairs power) are calculated.
An object with class powerPMCMR
.
## Not run: mu <- c(0, 0, 1, 2) n <- c(5, 4, 5, 5) set.seed(100) powerMCTests(mu, n, errfn="Normal", parms=list(mean=0, sd=1), test="dunnettTest", replicates=1E4) powerMCTests(mu, n, errfn="Normal", parms=list(mean=0, sd=1), test="kwManyOneDunnTest", p.adjust.method = "bonferroni", replicates=1E4) ## End(Not run)
## Not run: mu <- c(0, 0, 1, 2) n <- c(5, 4, 5, 5) set.seed(100) powerMCTests(mu, n, errfn="Normal", parms=list(mean=0, sd=1), test="dunnettTest", replicates=1E4) powerMCTests(mu, n, errfn="Normal", parms=list(mean=0, sd=1), test="kwManyOneDunnTest", p.adjust.method = "bonferroni", replicates=1E4) ## End(Not run)
Performs power simulation for one-factorial single hypothesis tests.
powerOneWayTests( mu, n = 10, errfn = c("Normal", "Lognormal", "Exponential", "Chisquare", "TDist", "Cauchy", "Weibull"), parms = list(mean = 0, sd = 1), test = c("kruskalTest", "leTest", "vanWaerdenTest", "normalScoresTest", "spearmanTest", "cuzickTest", "jonckheereTest", "johnsonTest", "oneway.test", "adKSampleTest", "bwsKSampleTest", "bwsTrendTest", "mackWolfeTest", "chackoTest", "flignerWolfeTest"), alternative = c("two.sided", "greater", "less"), var.equal = TRUE, dist = NULL, alpha = 0.05, FWER = TRUE, replicates = 1000, p = NULL )
powerOneWayTests( mu, n = 10, errfn = c("Normal", "Lognormal", "Exponential", "Chisquare", "TDist", "Cauchy", "Weibull"), parms = list(mean = 0, sd = 1), test = c("kruskalTest", "leTest", "vanWaerdenTest", "normalScoresTest", "spearmanTest", "cuzickTest", "jonckheereTest", "johnsonTest", "oneway.test", "adKSampleTest", "bwsKSampleTest", "bwsTrendTest", "mackWolfeTest", "chackoTest", "flignerWolfeTest"), alternative = c("two.sided", "greater", "less"), var.equal = TRUE, dist = NULL, alpha = 0.05, FWER = TRUE, replicates = 1000, p = NULL )
mu |
numeric vector of group means. |
n |
number of replicates per group. If |
errfn |
the error function. Defaults to |
parms |
a list that denotes the arguments for the error function.
Defaults to |
test |
the test for which the power analysis is
to be performed. Defaults to |
alternative |
the alternative hypothesis. Defaults to |
var.equal |
a logical variable indicating whether to treat the variances
in the samples as equal. |
dist |
the test distribution. Only relevant for
|
alpha |
the nominal level of Type I Error. |
FWER |
logical, indicates whether the family-wise error should be computed.
Defaults to |
replicates |
the number of Monte Carlo replicates or runs. Defaults to |
p |
the a-priori known peak as an ordinal number of the treatment
group including the zero dose level, i.e. |
The linear model of a one-way ANOVA can be written as:
For each Monte Carlo run, the function simulates based on the given error function and
the corresponding parameters. Then the specified test is performed.
Finally, Type I and Type II error rates are calculated.
An object with class powerOneWayPMCMR
.
powerMCTests
,
pwr.anova.test
,
power.anova.test
## Not run: set.seed(12) mu <- c(0, 0, 1, 2) n <- c(5, 4, 5, 5) parms <- list(mean=0, sd=1) powerOneWayTests(mu, n, parms, test = "cuzickTest", alternative = "two.sided", replicates = 1E4) ## Compare power estimation for ## one-way ANOVA with balanced design ## as given by functions ## power.anova.test, pwr.anova.test ## and powerOneWayTest groupmeans <- c(120, 130, 140, 150) SEsq <- 500 # within-variance n <- 10 k <- length(groupmeans) df <- n * k - k SSQ.E <- SEsq * df SSQ.A <- n * var(groupmeans) * (k - 1) sd.errfn <- sqrt(SSQ.E / (n * k - 1)) R2 <- c("R-squared" = SSQ.A / (SSQ.A + SSQ.E)) cohensf <- sqrt(R2 / (1 - R2)) names(cohensf) <- "Cohens f" ## R stats power function power.anova.test(groups = k, between.var = var(groupmeans), within.var = SEsq, n = n) ## pwr power function pwr.anova.test(k = k, n = n, f = cohensf, sig.level=0.05) ## this Monte-Carlo based estimation set.seed(200) powerOneWayTests(mu = groupmeans, n = n, parms = list(mean=0, sd=sd.errfn), test = "oneway.test", var.equal = TRUE, replicates = 5E3) ## Compare with effect sizes R2 cohensf ## End(Not run)
## Not run: set.seed(12) mu <- c(0, 0, 1, 2) n <- c(5, 4, 5, 5) parms <- list(mean=0, sd=1) powerOneWayTests(mu, n, parms, test = "cuzickTest", alternative = "two.sided", replicates = 1E4) ## Compare power estimation for ## one-way ANOVA with balanced design ## as given by functions ## power.anova.test, pwr.anova.test ## and powerOneWayTest groupmeans <- c(120, 130, 140, 150) SEsq <- 500 # within-variance n <- 10 k <- length(groupmeans) df <- n * k - k SSQ.E <- SEsq * df SSQ.A <- n * var(groupmeans) * (k - 1) sd.errfn <- sqrt(SSQ.E / (n * k - 1)) R2 <- c("R-squared" = SSQ.A / (SSQ.A + SSQ.E)) cohensf <- sqrt(R2 / (1 - R2)) names(cohensf) <- "Cohens f" ## R stats power function power.anova.test(groups = k, between.var = var(groupmeans), within.var = SEsq, n = n) ## pwr power function pwr.anova.test(k = k, n = n, f = cohensf, sig.level=0.05) ## this Monte-Carlo based estimation set.seed(200) powerOneWayTests(mu = groupmeans, n = n, parms = list(mean=0, sd=sd.errfn), test = "oneway.test", var.equal = TRUE, replicates = 5E3) ## Compare with effect sizes R2 cohensf ## End(Not run)
print.gesdTest
is the gesdTest method of the generic
print
function which prints its argument
and returns it invisibly (via invisible(x)
).
## S3 method for class 'gesdTest' print(x, ...)
## S3 method for class 'gesdTest' print(x, ...)
x |
an object used to select a method. |
... |
further arguments. Currently ignored. |
print.mandel
is the mandel method of the generic
print
function which prints its argument
and returns it invisibly (via invisible(x)
).
## S3 method for class 'mandel' print(x, ...)
## S3 method for class 'mandel' print(x, ...)
x |
an object used to select a method. |
... |
further arguments. Currently ignored. |
print.osrt
is the osrt method of the generic
print
function which prints its argument
and returns it invisibly (via invisible(x)
).
## S3 method for class 'osrt' print(x, ...)
## S3 method for class 'osrt' print(x, ...)
x |
an object used to select a method. |
... |
further arguments. Currently ignored. |
summary.osrt
print.PMCMR
is the PMCMR method of the generic
print
function which prints its argument
and returns it invisibly (via invisible(x)
).
## S3 method for class 'PMCMR' print(x, ...)
## S3 method for class 'PMCMR' print(x, ...)
x |
an object used to select a method. |
... |
further arguments. Currently ignored. |
print.powerOneWayPMCMR
is the
powerOneWayPMCMR method of the generic
print
function which prints its argument
and returns it invisibly (via invisible(x)
).
## S3 method for class 'powerOneWayPMCMR' print(x, ...)
## S3 method for class 'powerOneWayPMCMR' print(x, ...)
x |
an object used to select a method. |
... |
further arguments. Currently ignored. |
print.powerPMCMR
is the powerPMCMR method of the generic
print
function which prints its argument
and returns it invisibly (via invisible(x)
).
## S3 method for class 'powerPMCMR' print(x, ...)
## S3 method for class 'powerPMCMR' print(x, ...)
x |
an object used to select a method. |
... |
further arguments. Currently ignored. |
powerMCTests
, powerOneWayTests
print.trendPMCMR
is the trendPMCMR method of the generic
print
function which prints its argument
and returns it invisibly (via invisible(x)
).
## S3 method for class 'trendPMCMR' print(x, ...)
## S3 method for class 'trendPMCMR' print(x, ...)
x |
an object used to select a method. |
... |
further arguments. Currently ignored. |
Distribution function and quantile function for the distribution of Dunnett's many-to-one comparisons test.
qDunnett(p, n0, n) pDunnett(q, n0, n, lower.tail = TRUE)
qDunnett(p, n0, n) pDunnett(q, n0, n, lower.tail = TRUE)
p |
vector of probabilities. |
n0 |
sample size for control group. |
n |
vector of sample sizes for treatment groups. |
q |
vector of quantiles. |
lower.tail |
logical; if TRUE (default),
probabilities are |
Dunnett's distribution is a special case of the multivariate t distribution.
Let the total sample size be , with
the
number of treatment groups, than the quantile
is calculated with
degree of freedom and
the correlation
The functions determines via the length of the input
vector
n
.
Quantiles and p-values are computed with the functions of the package mvtnorm.
pDunnett
gives the distribution function and
qDunnett
gives its inverse, the quantile function.
The results are seed depending.
## Table gives 2.34 for df = 6, m = 2, one-sided set.seed(112) qval <- qDunnett(p = 0.05, n0 = 3, n = rep(3,2)) round(qval, 2) set.seed(112) pDunnett(qval, n0=3, n = rep(3,2), lower.tail = FALSE) ## Table gives 2.65 for df = 20, m = 4, two-sided set.seed(112) qval <- qDunnett(p = 0.05/2, n0 = 5, n = rep(5,4)) round(qval, 2) set.seed(112) 2 * pDunnett(qval, n0= 5, n = rep(5,4), lower.tail= FALSE)
## Table gives 2.34 for df = 6, m = 2, one-sided set.seed(112) qval <- qDunnett(p = 0.05, n0 = 3, n = rep(3,2)) round(qval, 2) set.seed(112) pDunnett(qval, n0=3, n = rep(3,2), lower.tail = FALSE) ## Table gives 2.65 for df = 20, m = 4, two-sided set.seed(112) qval <- qDunnett(p = 0.05/2, n0 = 5, n = rep(5,4)) round(qval, 2) set.seed(112) 2 * pDunnett(qval, n0= 5, n = rep(5,4), lower.tail= FALSE)
The data set contains 4 classifiers (blocks), i.e. bias, linearity, precision and resolution, for 11 different qPCR analysis methods. The null hypothesis is that there is no preferred ranking of the method results per gene for the performance parameters analyzed. The rank scores were obtained by averaging results across a large set of 69 genes in a biomarker data file.
A data frame with 4 observations on the following 11 variables.
a numeric vector
a numeric vector
a numeric vector
a numeric vector
a numeric vector
a numeric vector
a numeric vector
a numeric vector
a numeric vector
a numeric vector
a numeric vector
Data were taken from Table 2 of Ruijter et al. (2013, p. 38). See also Eisinga et al. (2017, pp. 14–15).
Eisinga, R., Heskes, T., Pelzer, B., Te Grotenhuis, M. (2017) Exact p-values for pairwise comparison of Friedman rank sums, with application to comparing classifiers. BMC Bioinformatics, 18:68.
Ruijter, J. M. et al. (2013) Evaluation of qPCR curve analysis methods for reliable biomarker discovery: Bias, resolution, precision, and implications, Methods 59, 32–46.
Performs Quade multiple-comparison test for unreplicated blocked data.
quadeAllPairsTest(y, ...) ## Default S3 method: quadeAllPairsTest( y, groups, blocks, dist = c("TDist", "Normal"), p.adjust.method = p.adjust.methods, ... )
quadeAllPairsTest(y, ...) ## Default S3 method: quadeAllPairsTest( y, groups, blocks, dist = c("TDist", "Normal"), p.adjust.method = p.adjust.methods, ... )
y |
a numeric vector of data values, or a list of numeric data vectors. |
groups |
a vector or factor object giving the group for the
corresponding elements of |
blocks |
a vector or factor object giving the block for the
corresponding elements of |
dist |
the test distribution. Defaults to |
p.adjust.method |
method for adjusting p values
(see |
... |
further arguments to be passed to or from methods. |
For all-pairs comparisons of unreplicated blocked data
Quade's test can be applied.
A total of
hypotheses can be tested. The null hypothesis
H
is tested in the two-tailed test
against the alternative
A
.
The function has included two methods for approximate p-value estimation:
p-values are computed from the t distribution
p-values are computed from the standard normal distribution
If no p-value adjustment is performed (p.adjust.method = "none"
),
than a simple protected test is recommended, i.e.
all-pairs comparisons should only be applied after a significant
quade.test
. However, any method as implemented in
p.adjust.methods
can be selected by the user.
A list with class "PMCMR"
containing the following components:
a character string indicating what type of test was performed.
a character string giving the name(s) of the data.
lower-triangle matrix of the estimated quantiles of the pairwise test statistics.
lower-triangle matrix of the p-values for the pairwise tests.
a character string describing the alternative hypothesis.
a character string describing the method for p-value adjustment.
a data frame of the input data.
a string that denotes the test distribution.
W. J. Conover (1999), Practical nonparametric Statistics, 3rd. Edition, Wiley.
N. A. Heckert and J. J. Filliben (2003). NIST Handbook 148: Dataplot Reference Manual, Volume 2: Let Subcommands and Library Functions. National Institute of Standards and Technology Handbook Series, June 2003.
D. Quade (1979), Using weighted rankings in the analysis of complete blocks with additive block effects. Journal of the American Statistical Association, 74, 680-683.
## Sachs, 1997, p. 675 ## Six persons (block) received six different diuretics ## (A to F, treatment). ## The responses are the Na-concentration (mval) ## in the urine measured 2 hours after each treatment. ## y <- matrix(c( 3.88, 5.64, 5.76, 4.25, 5.91, 4.33, 30.58, 30.14, 16.92, 23.19, 26.74, 10.91, 25.24, 33.52, 25.45, 18.85, 20.45, 26.67, 4.44, 7.94, 4.04, 4.4, 4.23, 4.36, 29.41, 30.72, 32.92, 28.23, 23.35, 12, 38.87, 33.12, 39.15, 28.06, 38.23, 26.65),nrow=6, ncol=6, dimnames=list(1:6, LETTERS[1:6])) print(y) ## Global test quade.test(y) ## All-pairs comparisons quadeAllPairsTest(y, dist="TDist", p.adjust.method="holm")
## Sachs, 1997, p. 675 ## Six persons (block) received six different diuretics ## (A to F, treatment). ## The responses are the Na-concentration (mval) ## in the urine measured 2 hours after each treatment. ## y <- matrix(c( 3.88, 5.64, 5.76, 4.25, 5.91, 4.33, 30.58, 30.14, 16.92, 23.19, 26.74, 10.91, 25.24, 33.52, 25.45, 18.85, 20.45, 26.67, 4.44, 7.94, 4.04, 4.4, 4.23, 4.36, 29.41, 30.72, 32.92, 28.23, 23.35, 12, 38.87, 33.12, 39.15, 28.06, 38.23, 26.65),nrow=6, ncol=6, dimnames=list(1:6, LETTERS[1:6])) print(y) ## Global test quade.test(y) ## All-pairs comparisons quadeAllPairsTest(y, dist="TDist", p.adjust.method="holm")
9 reviewers (blocks) assigned ranks to 4 objects (groups).
The format is a 9 x 4 Matrix with Friedman type rankings:
reviewers, 1, 2, ..., 9
groups, A, B, ..., D
Sachs (1997), p. 671 ff.
Sachs, L. (1997) Angewandte Statistik, New York: Springer.
data(reviewers) friedmanTest(reviewers) pageTest(reviewers) frdAllPairsExactTest(reviewers, p.adjust = "bonferroni")
data(reviewers) friedmanTest(reviewers) pageTest(reviewers) frdAllPairsExactTest(reviewers, p.adjust = "bonferroni")
Performs Scheffe's all-pairs comparisons test for normally distributed data with equal group variances.
scheffeTest(x, ...) ## Default S3 method: scheffeTest(x, g, ...) ## S3 method for class 'formula' scheffeTest(formula, data, subset, na.action, ...) ## S3 method for class 'aov' scheffeTest(x, ...)
scheffeTest(x, ...) ## Default S3 method: scheffeTest(x, g, ...) ## S3 method for class 'formula' scheffeTest(formula, data, subset, na.action, ...) ## S3 method for class 'aov' scheffeTest(x, ...)
x |
a numeric vector of data values, a list of numeric data vectors or a fitted model object, usually an aov fit. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
For all-pairs comparisons in an one-factorial layout
with normally distributed residuals and equal variances
Scheffe's test can be performed.
Let denote a continuous random variable
with the
-the realization (
)
in the
-th group (
). Furthermore, the total
sample size is
. A total of
hypotheses can be tested: The null hypothesis is
H
is tested against the alternative
A
(two-tailed). Scheffe's all-pairs test
statistics are given by
with the within-group ANOVA variance.
The null hypothesis is rejected if
,
with
degree of freedom. The p-values
are computed from the
FDist
distribution.
A list with class "PMCMR"
containing the following components:
a character string indicating what type of test was performed.
a character string giving the name(s) of the data.
lower-triangle matrix of the estimated quantiles of the pairwise test statistics.
lower-triangle matrix of the p-values for the pairwise tests.
a character string describing the alternative hypothesis.
a character string describing the method for p-value adjustment.
a data frame of the input data.
a string that denotes the test distribution.
Bortz, J. (1993) Statistik für Sozialwissenschaftler. 4. Aufl., Berlin: Springer.
Sachs, L. (1997) Angewandte Statistik, New York: Springer.
Scheffe, H. (1953) A Method for Judging all Contrasts in the Analysis of Variance, Biometrika 40, 87–110.
fit <- aov(weight ~ feed, chickwts) shapiro.test(residuals(fit)) bartlett.test(weight ~ feed, chickwts) anova(fit) ## also works with fitted objects of class aov res <- scheffeTest(fit) summary(res) summaryGroup(res)
fit <- aov(weight ~ feed, chickwts) shapiro.test(residuals(fit)) bartlett.test(weight ~ feed, chickwts) anova(fit) ## also works with fitted objects of class aov res <- scheffeTest(fit) summary(res) summaryGroup(res)
Performs the Shan-Young-Kang test for testing against ordered alternatives.
shanTest(x, ...) ## Default S3 method: shanTest(x, g, alternative = c("greater", "less"), ...) ## S3 method for class 'formula' shanTest( formula, data, subset, na.action, alternative = c("greater", "less"), ... )
shanTest(x, ...) ## Default S3 method: shanTest(x, g, alternative = c("greater", "less"), ...) ## S3 method for class 'formula' shanTest( formula, data, subset, na.action, alternative = c("greater", "less"), ... )
x |
a numeric vector of data values, or a list of numeric data vectors. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
alternative |
the alternative hypothesis.
Defaults to |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
The null hypothesis, H
is tested against a simple order hypothesis,
H
.
Let be the rank of
,
where
is jointly ranked
from
,
the the test statistic is
with
where
The test statistic is asymptotically normal distributed:
The p-values are estimated from the standard normal distribution.
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 variance estimation (see Theorem 2.1, Shan et al. 2014)
can become negative for certain combinations of . In these cases the function will return
a warning and the returned p-value will be
NaN
.
Factor labels for g
must be assigned in such a way,
that they can be increasingly ordered from zero-dose
control to the highest dose level, e.g. integers
{0, 1, 2, ..., k} or letters {a, b, c, ...}.
Otherwise the function may not select the correct values
for intended zero-dose control.
It is safer, to i) label the factor levels as given above,
and to ii) sort the data according to increasing dose-levels
prior to call the function (see order
, factor
).
Shan, G., Young, D., Kang, L. (2014) A New Powerful Nonparametric Rank Test for Ordered Alternative Problem. PLOS ONE 9, e112924. https://doi.org/10.1371/journal.pone.0112924
kruskalTest
and shirleyWilliamsTest
of the package PMCMRplus,
kruskal.test
of the library stats.
## Example from Sachs (1997, p. 402) x <- c(106, 114, 116, 127, 145, 110, 125, 143, 148, 151, 136, 139, 149, 160, 174) g <- gl(3,5) levels(g) <- c("A", "B", "C") ## Chacko's test chackoTest(x, g) ## Cuzick's test cuzickTest(x, g) ## Johnson-Mehrotra test johnsonTest(x, g) ## Jonckheere-Terpstra test jonckheereTest(x, g) ## Le's test leTest(x, g) ## Spearman type test spearmanTest(x, g) ## Murakami's BWS trend test bwsTrendTest(x, g) ## Fligner-Wolfe test flignerWolfeTest(x, g) ## Shan-Young-Kang test shanTest(x, g)
## Example from Sachs (1997, p. 402) x <- c(106, 114, 116, 127, 145, 110, 125, 143, 148, 151, 136, 139, 149, 160, 174) g <- gl(3,5) levels(g) <- c("A", "B", "C") ## Chacko's test chackoTest(x, g) ## Cuzick's test cuzickTest(x, g) ## Johnson-Mehrotra test johnsonTest(x, g) ## Jonckheere-Terpstra test jonckheereTest(x, g) ## Le's test leTest(x, g) ## Spearman type test spearmanTest(x, g) ## Murakami's BWS trend test bwsTrendTest(x, g) ## Fligner-Wolfe test flignerWolfeTest(x, g) ## Shan-Young-Kang test shanTest(x, g)
Performs Shirley's nonparametric equivalent of William's test for contrasting increasing dose levels of a treatment.
shirleyWilliamsTest(x, ...) ## Default S3 method: shirleyWilliamsTest( x, g, alternative = c("two.sided", "greater", "less"), method = c("look-up", "boot"), nperm = 10000, ... ) ## S3 method for class 'formula' shirleyWilliamsTest( formula, data, subset, na.action, alternative = c("two.sided", "greater", "less"), method = c("look-up", "boot"), nperm = 10000, ... )
shirleyWilliamsTest(x, ...) ## Default S3 method: shirleyWilliamsTest( x, g, alternative = c("two.sided", "greater", "less"), method = c("look-up", "boot"), nperm = 10000, ... ) ## S3 method for class 'formula' shirleyWilliamsTest( formula, data, subset, na.action, alternative = c("two.sided", "greater", "less"), method = c("look-up", "boot"), nperm = 10000, ... )
x |
a numeric vector of data values, or a list of numeric data vectors. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
alternative |
the alternative hypothesis. Defaults to |
method |
a character string specifying the test statistic to use.
Defaults to |
nperm |
number of permutations for the asymptotic permutation test.
Defaults to |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
The Shirley-William test is a non-parametric step-down trend test for testing several treatment levels
with a zero control. Let there be groups including the control and let
the zero dose level be indicated with
and the highest
dose level with
, then the following
m = k - 1
hypotheses are tested:
Let be the rank of
,
where
is jointly ranked
from
,
then the test statistic is
with expected variance of
where and
the ties for the
-th comparison is given by
The procedure starts from the highest dose level () to the the lowest dose level (
) and
stops at the first non-significant test. The consequent lowest effect dose
is the treatment level of the previous test number. This function has
included the modifications as recommended by Williams (1986), i.e.
the data are re-ranked for each of the
-th comparison.
If method = "look-up"
is selected, the function does not return p-values.
Instead the critical -values
as given in the tables of Williams (1972) for
(one-sided)
are looked up according to the degree of freedoms (
) and the order number of the
dose level (
) and (potentially) modified according to the given extrapolation
coefficient
.
Non tabulated values are linearly interpolated with the function
approx
.
For the comparison of the first dose level (i = 1) with the control, the critical
z-value from the standard normal distribution is used (Normal
).
If method = "boot"
, the p-values are estimated through an assymptotic
boot-strap method. The p-values for H
are calculated from the t distribution with infinite degree of freedom.
Either a list with class "osrt"
or a list with class "PMCMR"
.
a character string indicating what type of test was performed.
a character string giving the name(s) of the data.
the estimated statistic(s)
critical values for .
a character string describing the alternative hypothesis.
the parameter(s) of the test distribution.
a string that denotes the test distribution.
There are print and summary methods available.
A list with class "PMCMR"
containing the following components:
a character string indicating what type of test was performed.
a character string giving the name(s) of the data.
lower-triangle matrix of the estimated quantiles of the pairwise test statistics.
lower-triangle matrix of the p-values for the pairwise tests.
a character string describing the alternative hypothesis.
a character string describing the method for p-value adjustment.
a data frame of the input data.
a string that denotes the test distribution.
For method = "look-up"
, only tests on the level of
can be performed for alternative hypotheses less or greater.
For method = "boot"
only the alternative "two.sided"
can be calculated.
One may increase the number of permutations to e.g. nperm = 10000
in order to get more precise p-values. However, this will be on the expense of
computational time.
Shirley, E., (1977) Nonparametric Equivalent of Williams Test for Contrasting Increasing Dose Levels of a Treatment, Biometrics 33, 386–389.
Williams, D. A. (1986) Note on Shirley's nonparametric test for comparing several dose levels with a zero-dose control, Biometrics 42, 183–186.
## Example from Shirley (1977) ## Reaction times of mice to stimuli to their tails. x <- c(2.4, 3, 3, 2.2, 2.2, 2.2, 2.2, 2.8, 2, 3, 2.8, 2.2, 3.8, 9.4, 8.4, 3, 3.2, 4.4, 3.2, 7.4, 9.8, 3.2, 5.8, 7.8, 2.6, 2.2, 6.2, 9.4, 7.8, 3.4, 7, 9.8, 9.4, 8.8, 8.8, 3.4, 9, 8.4, 2.4, 7.8) g <- gl(4, 10) ## Shirley's test ## one-sided test using look-up table shirleyWilliamsTest(x ~ g, alternative = "greater") ## Chacko's global hypothesis test for 'greater' chackoTest(x , g) ## post-hoc test, default is standard normal distribution (NPT'-test) summary(chaAllPairsNashimotoTest(x, g, p.adjust.method = "none")) ## same but h-distribution (NPY'-test) chaAllPairsNashimotoTest(x, g, dist = "h") ## NPM-test NPMTest(x, g) ## Hayter-Stone test hayterStoneTest(x, g) ## all-pairs comparisons hsAllPairsTest(x, g)
## Example from Shirley (1977) ## Reaction times of mice to stimuli to their tails. x <- c(2.4, 3, 3, 2.2, 2.2, 2.2, 2.2, 2.8, 2, 3, 2.8, 2.2, 3.8, 9.4, 8.4, 3, 3.2, 4.4, 3.2, 7.4, 9.8, 3.2, 5.8, 7.8, 2.6, 2.2, 6.2, 9.4, 7.8, 3.4, 7, 9.8, 9.4, 8.8, 8.8, 3.4, 9, 8.4, 2.4, 7.8) g <- gl(4, 10) ## Shirley's test ## one-sided test using look-up table shirleyWilliamsTest(x ~ g, alternative = "greater") ## Chacko's global hypothesis test for 'greater' chackoTest(x , g) ## post-hoc test, default is standard normal distribution (NPT'-test) summary(chaAllPairsNashimotoTest(x, g, p.adjust.method = "none")) ## same but h-distribution (NPY'-test) chaAllPairsNashimotoTest(x, g, dist = "h") ## NPM-test NPMTest(x, g) ## Hayter-Stone test hayterStoneTest(x, g) ## all-pairs comparisons hsAllPairsTest(x, g)
Performs Siegel-Tukey non-parametric rank dispersion test.
siegelTukeyTest(x, ...) ## Default S3 method: siegelTukeyTest( x, y, alternative = c("two.sided", "greater", "less"), median.corr = FALSE, ... ) ## S3 method for class 'formula' siegelTukeyTest(formula, data, subset, na.action, ...)
siegelTukeyTest(x, ...) ## Default S3 method: siegelTukeyTest( x, y, alternative = c("two.sided", "greater", "less"), median.corr = FALSE, ... ) ## S3 method for class 'formula' siegelTukeyTest(formula, data, subset, na.action, ...)
x , y
|
numeric vectors of data values. |
... |
further arguments to be passed to or from methods. |
alternative |
a character string specifying the
alternative hypothesis, must be one of |
median.corr |
logical indicator, whether median correction
should be performed prior testing. Defaults to |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
Let and
denote two identically and independently
distributed variables of at least ordinal scale.
Further, let
, and
denote
location and scale parameter of the common, but unknown distribution.
Then for the two-tailed case, the null hypothesis
H:
is
tested against the alternative,
A:
.
The data are combinedly ranked according to Siegel-Tukey.
The ranking is done by alternate extremes (rank 1 is lowest,
2 and 3 are the two highest, 4 and 5 are the two next lowest, etc.).
If no ties are present, the p-values are computed from
the Wilcoxon distribution (see Wilcoxon
).
In the case of ties, a tie correction is done according
to Sachs (1997) and approximate p-values are computed
from the standard normal distribution (see Normal
).
If both medians differ, one can correct for medians to increase the specificity of the test.
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 algorithm for the Siegel-Tukey ranks was taken from the code of Daniel Malter. See also the blog from Tal Galili (02/2010, https://www.r-statistics.com/2010/02/siegel-tukey-a-non-parametric-test-for-equality-in-variability-r-code/, accessed 2018-08-05).
Sachs, L. (1997), Angewandte Statistik. Berlin: Springer.
Siegel, S., Tukey, J. W. (1960), A nonparametric sum of ranks procedure for relative spread in unpaired samples, Journal of the American Statistical Association 55, 429–455.
## Sachs, 1997, p. 376 A <- c(10.1, 7.3, 12.6, 2.4, 6.1, 8.5, 8.8, 9.4, 10.1, 9.8) B <- c(15.3, 3.6, 16.5, 2.9, 3.3, 4.2, 4.9, 7.3, 11.7, 13.7) siegelTukeyTest(A, B) ## from example var.test x <- rnorm(50, mean = 0, sd = 2) y <- rnorm(30, mean = 1, sd = 1) siegelTukeyTest(x, y, median.corr = TRUE) ## directional hypothesis A <- c(33, 62, 84, 85, 88, 93, 97) B <- c(4, 16, 48, 51, 66, 98) siegelTukeyTest(A, B, alternative = "greater")
## Sachs, 1997, p. 376 A <- c(10.1, 7.3, 12.6, 2.4, 6.1, 8.5, 8.8, 9.4, 10.1, 9.8) B <- c(15.3, 3.6, 16.5, 2.9, 3.3, 4.2, 4.9, 7.3, 11.7, 13.7) siegelTukeyTest(A, B) ## from example var.test x <- rnorm(50, mean = 0, sd = 2) y <- rnorm(30, mean = 1, sd = 1) siegelTukeyTest(x, y, median.corr = TRUE) ## directional hypothesis A <- c(33, 62, 84, 85, 88, 93, 97) B <- c(4, 16, 48, 51, 66, 98) siegelTukeyTest(A, B, alternative = "greater")
Performs Skillings-Mack rank sum test for partially balanced
incomplete block designs or partially balanced random block designs.
The null hypothesis
H is tested against the
alternative H
, with at least
one inequality beeing strict.
skillingsMackTest(y, ...) ## Default S3 method: skillingsMackTest(y, groups, blocks, ...)
skillingsMackTest(y, ...) ## Default S3 method: skillingsMackTest(y, groups, blocks, ...)
y |
a numeric vector of data values, or a list of numeric data vectors. |
groups |
a vector or factor object giving the group for the
corresponding elements of |
blocks |
a vector or factor object giving the block for the
corresponding elements of |
... |
further arguments to be passed to or from methods. |
The function has implemented the test of Skillings and Mack (1981). The test statistic is assymptotically chi-squared distributed with df = k - 1 degrees of freedom.
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 input vector/matrix 'y'
must contain NA
.
Skillings, J. H., Mack, G.A. (1981) On the use of a Friedman-type statistic in balanced and unbalanced block designs, Technometrics 23, 171–177.
## Example from Hollander and Wolfe 1999, ## originally appeared in Brady 1969. x <- cbind(c(3,1,5,2,0,0,0,0), c(5,3,4,NA,2,2,3,2), c(15,18,21,6,17,10,8,13)) colnames(x) <- c("R", "A", "B") rownames(x) <- 1:8 skillingsMackTest(x) ## Compare with Friedman Test for CRB ## Sachs, 1997, p. 675 ## Six persons (block) received six different diuretics ## (A to F, treatment). ## The responses are the Na-concentration (mval) ## in the urine measured 2 hours after each treatment. y <- matrix(c( 3.88, 5.64, 5.76, 4.25, 5.91, 4.33, 30.58, 30.14, 16.92, 23.19, 26.74, 10.91, 25.24, 33.52, 25.45, 18.85, 20.45, 26.67, 4.44, 7.94, 4.04, 4.4, 4.23, 4.36, 29.41, 30.72, 32.92, 28.23, 23.35, 12, 38.87, 33.12, 39.15, 28.06, 38.23, 26.65),nrow=6, ncol=6, dimnames=list(1:6, LETTERS[1:6])) print(y) friedmanTest(y) skillingsMackTest(y)
## Example from Hollander and Wolfe 1999, ## originally appeared in Brady 1969. x <- cbind(c(3,1,5,2,0,0,0,0), c(5,3,4,NA,2,2,3,2), c(15,18,21,6,17,10,8,13)) colnames(x) <- c("R", "A", "B") rownames(x) <- 1:8 skillingsMackTest(x) ## Compare with Friedman Test for CRB ## Sachs, 1997, p. 675 ## Six persons (block) received six different diuretics ## (A to F, treatment). ## The responses are the Na-concentration (mval) ## in the urine measured 2 hours after each treatment. y <- matrix(c( 3.88, 5.64, 5.76, 4.25, 5.91, 4.33, 30.58, 30.14, 16.92, 23.19, 26.74, 10.91, 25.24, 33.52, 25.45, 18.85, 20.45, 26.67, 4.44, 7.94, 4.04, 4.4, 4.23, 4.36, 29.41, 30.72, 32.92, 28.23, 23.35, 12, 38.87, 33.12, 39.15, 28.06, 38.23, 26.65),nrow=6, ncol=6, dimnames=list(1:6, LETTERS[1:6])) print(y) friedmanTest(y) skillingsMackTest(y)
Performs Student-Newman-Keuls all-pairs comparisons test for normally distributed data with equal group variances.
snkTest(x, ...) ## Default S3 method: snkTest(x, g, ...) ## S3 method for class 'formula' snkTest(formula, data, subset, na.action, ...) ## S3 method for class 'aov' snkTest(x, ...)
snkTest(x, ...) ## Default S3 method: snkTest(x, g, ...) ## S3 method for class 'formula' snkTest(formula, data, subset, na.action, ...) ## S3 method for class 'aov' snkTest(x, ...)
x |
a numeric vector of data values, a list of numeric data vectors or a fitted model object, usually an aov fit. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
For all-pairs comparisons in an one-factorial layout
with normally distributed residuals and equal variances
Student-Newman-Keuls test can be performed. A total of
hypotheses can be tested. The null hypothesis
H
is tested in the two-tailed test
against the alternative
A
.
The p-values are computed from the Tukey-distribution.
A list with class "PMCMR"
containing the following components:
a character string indicating what type of test was performed.
a character string giving the name(s) of the data.
lower-triangle matrix of the estimated quantiles of the pairwise test statistics.
lower-triangle matrix of the p-values for the pairwise tests.
a character string describing the alternative hypothesis.
a character string describing the method for p-value adjustment.
a data frame of the input data.
a string that denotes the test distribution.
Keuls, M. (1952) The use of the "studentized range" in connection with an analysis of variance, Euphytica 1, 112–122.
Newman, D. (1939) The distribution of range in samples from a normal population, expressed in terms of an independent estimate of standard deviation, Biometrika 31, 20–30.
Student (1927) Errors of routine analysis, Biometrika 19, 151–164.
fit <- aov(weight ~ feed, chickwts) shapiro.test(residuals(fit)) bartlett.test(weight ~ feed, chickwts) anova(fit) ## also works with fitted objects of class aov res <- snkTest(fit) summary(res) summaryGroup(res)
fit <- aov(weight ~ feed, chickwts) shapiro.test(residuals(fit)) bartlett.test(weight ~ feed, chickwts) anova(fit) ## also works with fitted objects of class aov res <- snkTest(fit) summary(res) summaryGroup(res)
Performs a Spearman type test for testing against ordered alternatives.
spearmanTest(x, ...) ## Default S3 method: spearmanTest(x, g, alternative = c("two.sided", "greater", "less"), ...) ## S3 method for class 'formula' spearmanTest( formula, data, subset, na.action, alternative = c("two.sided", "greater", "less"), ... )
spearmanTest(x, ...) ## Default S3 method: spearmanTest(x, g, alternative = c("two.sided", "greater", "less"), ...) ## S3 method for class 'formula' spearmanTest( formula, data, subset, na.action, alternative = c("two.sided", "greater", "less"), ... )
x |
a numeric vector of data values, or a list of numeric data vectors. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
alternative |
the alternative hypothesis. Defaults to |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
A one factorial design for dose finding comprises an ordered factor,
.e. treatment with increasing treatment levels.
The basic idea is to correlate the ranks with the increasing
order number
of the treatment levels (Kloke and McKean 2015).
More precisely,
is correlated with the expected mid-value ranks
under the assumption of strictly increasing median responses.
Let the expected mid-value rank of the first group denote
.
The following expected mid-value ranks are
for
.
The corresponding number of tied values for the
th group is
. #
The sum of squared residuals is
.
Consequently, Spearman's rank correlation coefficient can be calculated as:
with
and the number of ties of the
th group of ties.
Spearman's rank correlation coefficient can be tested for
significance with a
-test.
For a one-tailed test the null hypothesis of
is rejected and the alternative
is accepted if
with degree of freedom.
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.
Factor labels for g
must be assigned in such a way,
that they can be increasingly ordered from zero-dose
control to the highest dose level, e.g. integers
{0, 1, 2, ..., k} or letters {a, b, c, ...}.
Otherwise the function may not select the correct values
for intended zero-dose control.
It is safer, to i) label the factor levels as given above,
and to ii) sort the data according to increasing dose-levels
prior to call the function (see order
, factor
).
Kloke, J., McKean, J. W. (2015) Nonparametric statistical methods using R. Boca Raton, FL: Chapman & Hall/CRC.
kruskalTest
and shirleyWilliamsTest
of the package PMCMRplus,
kruskal.test
of the library stats.
## Example from Sachs (1997, p. 402) x <- c(106, 114, 116, 127, 145, 110, 125, 143, 148, 151, 136, 139, 149, 160, 174) g <- gl(3,5) levels(g) <- c("A", "B", "C") ## Chacko's test chackoTest(x, g) ## Cuzick's test cuzickTest(x, g) ## Johnson-Mehrotra test johnsonTest(x, g) ## Jonckheere-Terpstra test jonckheereTest(x, g) ## Le's test leTest(x, g) ## Spearman type test spearmanTest(x, g) ## Murakami's BWS trend test bwsTrendTest(x, g) ## Fligner-Wolfe test flignerWolfeTest(x, g) ## Shan-Young-Kang test shanTest(x, g)
## Example from Sachs (1997, p. 402) x <- c(106, 114, 116, 127, 145, 110, 125, 143, 148, 151, 136, 139, 149, 160, 174) g <- gl(3,5) levels(g) <- c("A", "B", "C") ## Chacko's test chackoTest(x, g) ## Cuzick's test cuzickTest(x, g) ## Johnson-Mehrotra test johnsonTest(x, g) ## Jonckheere-Terpstra test jonckheereTest(x, g) ## Le's test leTest(x, g) ## Spearman type test spearmanTest(x, g) ## Murakami's BWS trend test bwsTrendTest(x, g) ## Fligner-Wolfe test flignerWolfeTest(x, g) ## Shan-Young-Kang test shanTest(x, g)
Performs the non-parametric Steel's test for simultaneously testing k-treatments vs. one control.
steelsKSampleTest(x, ...) ## Default S3 method: steelsKSampleTest(x, g, alternative = c("two.sided", "greater", "less"), ...) ## S3 method for class 'formula' steelsKSampleTest( formula, data, subset, na.action, alternative = c("two.sided", "greater", "less"), ... )
steelsKSampleTest(x, ...) ## Default S3 method: steelsKSampleTest(x, g, alternative = c("two.sided", "greater", "less"), ...) ## S3 method for class 'formula' steelsKSampleTest( formula, data, subset, na.action, alternative = c("two.sided", "greater", "less"), ... )
x |
a numeric vector of data values, or a list of numeric data vectors. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
alternative |
the alternative hypothesis. Defaults to |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
It tests , against
(greater) with at least one inequality being strict.
The function is a wrapper function that calls Steel.test
of
the package kSamples with argument method = "asymptotic"
.
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.
Scholz, F. and Zhu, A. (2019). kSamples: K-Sample Rank Tests and their Combinations. R package version 1.2-9. https://CRAN.R-project.org/package=kSamples
Steel, R. G. D. (1959) A Multiple Comparison Rank Sum Test: Treatments Versus Control, Biometrics 15, 560–572.
## Example from Sachs (1997, p. 402) x <- c(106, 114, 116, 127, 145, 110, 125, 143, 148, 151, 136, 139, 149, 160, 174) g <- gl(3,5) levels(g) <- c("0", "I", "II") ## Steel's Test steelsKSampleTest(x ~ g, alternative = "greater") ## Example from USEPA (2002): ## Reproduction data from a Ceriodaphnia dubia ## 7-day chronic test to several concentrations ## of effluent. Dose level 50% is excluded. x <- c(20, 26, 26, 23, 24, 27, 26, 23, 27, 24, 13, 15, 14, 13, 23, 26, 0, 25, 26, 27, 18, 22, 13, 13, 23, 22, 20, 22, 23, 22, 14, 22, 20, 23, 20, 23, 25, 24, 25, 21, 9, 0, 9, 7, 6, 10, 12, 14, 9, 13, rep(0,10)) g <- gl(6, 10) levels(g) <- c("Control", "3%", "6%", "12%", "25%", "50%") ## NOEC at 3%, LOEC at 6% steelsKSampleTest(x ~ g, subset = g != "50%", alternative = "less")
## Example from Sachs (1997, p. 402) x <- c(106, 114, 116, 127, 145, 110, 125, 143, 148, 151, 136, 139, 149, 160, 174) g <- gl(3,5) levels(g) <- c("0", "I", "II") ## Steel's Test steelsKSampleTest(x ~ g, alternative = "greater") ## Example from USEPA (2002): ## Reproduction data from a Ceriodaphnia dubia ## 7-day chronic test to several concentrations ## of effluent. Dose level 50% is excluded. x <- c(20, 26, 26, 23, 24, 27, 26, 23, 27, 24, 13, 15, 14, 13, 23, 26, 0, 25, 26, 27, 18, 22, 13, 13, 23, 22, 20, 22, 23, 22, 14, 22, 20, 23, 20, 23, 25, 24, 25, 21, 9, 0, 9, 7, 6, 10, 12, 14, 9, 13, rep(0,10)) g <- gl(6, 10) levels(g) <- c("Control", "3%", "6%", "12%", "25%", "50%") ## NOEC at 3%, LOEC at 6% steelsKSampleTest(x ~ g, subset = g != "50%", alternative = "less")
Performs Steel's non-parametric many-to-one comparison test for Wilcox-type ranked data.
steelTest(x, ...) ## Default S3 method: steelTest(x, g, alternative = c("greater", "less"), ...) ## S3 method for class 'formula' steelTest( formula, data, subset, na.action, alternative = c("greater", "less"), ... )
steelTest(x, ...) ## Default S3 method: steelTest(x, g, alternative = c("greater", "less"), ...) ## S3 method for class 'formula' steelTest( formula, data, subset, na.action, alternative = c("greater", "less"), ... )
x |
a numeric vector of data values, or a list of numeric data vectors. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
alternative |
the alternative hypothesis. Defaults to |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
For many-to-one comparisons (pairwise comparisons with one control)
in an one-factorial balanced layout with non-normally distributed
residuals Steels's non-parametric single-step test can be performed.
Let there be treatment levels (excluding the control),
then
pairwise comparisons can be performed between
the
-th treatment level and the control.
H
is tested in the one-tailed case (less) against
A
.
For each control - treatment level the data are ranked in increasing order.
The ranksum for the
-th treatment level is compared
to a critical
value and is significantly(
) less,
if
. For the
alternative = "greater"
the sign is changed.
The function does not return p-values. Instead the critical -values
as given in the tables of USEPA (2002) for
(one-sided, less)
are looked up according to the balanced sample sizes (
) and the order number of the
dose level (
).
A list with class "osrt"
that contains 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 statistic(s)
critical values for .
a character string describing the alternative hypothesis.
the parameter(s) of the test distribution.
a string that denotes the test distribution.
There are print and summary methods available.
The critical rank sum values were taken from Table E.5 of USEPA (2002).
USEPA (2002) Short-term Methods for Estimating the Chronic Toxicity of Effluents and Receiving Waters to Freshwater Organisms, 4th edition, EPA-821-R-02-013.
Steel's Many-to-One Rank test is only applicable for balanced designs and
directional hypotheses. An error message will occur, if the design is unbalanced.
In the current implementation, only one-sided tests on
the level of can be performed.
Steel, R. G. D. (1959) A multiple comparison rank sum test: treatments versus control, Biometrics 15, 560–572.
wilcox.test
, pairwise.wilcox.test
,
manyOneUTest
, flignerWolfeTest
,
shirleyWilliamsTest
, kwManyOneDunnTest
,
kwManyOneNdwTest
, kwManyOneConoverTest
,
print.osrt
, summary.osrt
## Example from Sachs (1997, p. 402) x <- c(106, 114, 116, 127, 145, 110, 125, 143, 148, 151, 136, 139, 149, 160, 174) g <- gl(3,5) levels(g) <- c("0", "I", "II") ## Steel's Test steelTest(x ~ g) ## Example from USEPA (2002): ## Reproduction data from a Ceriodaphnia dubia ## 7-day chronic test to several concentrations ## of effluent. Dose level 50% is excluded. x <- c(20, 26, 26, 23, 24, 27, 26, 23, 27, 24, 13, 15, 14, 13, 23, 26, 0, 25, 26, 27, 18, 22, 13, 13, 23, 22, 20, 22, 23, 22, 14, 22, 20, 23, 20, 23, 25, 24, 25, 21, 9, 0, 9, 7, 6, 10, 12, 14, 9, 13, rep(0,10)) g <- gl(6, 10) levels(g) <- c("Control", "3%", "6%", "12%", "25%", "50%") ## NOEC at 3%, LOEC at 6% steelTest(x ~ g, subset = g != "50%", alternative = "less")
## Example from Sachs (1997, p. 402) x <- c(106, 114, 116, 127, 145, 110, 125, 143, 148, 151, 136, 139, 149, 160, 174) g <- gl(3,5) levels(g) <- c("0", "I", "II") ## Steel's Test steelTest(x ~ g) ## Example from USEPA (2002): ## Reproduction data from a Ceriodaphnia dubia ## 7-day chronic test to several concentrations ## of effluent. Dose level 50% is excluded. x <- c(20, 26, 26, 23, 24, 27, 26, 23, 27, 24, 13, 15, 14, 13, 23, 26, 0, 25, 26, 27, 18, 22, 13, 13, 23, 22, 20, 22, 23, 22, 14, 22, 20, 23, 20, 23, 25, 24, 25, 21, 9, 0, 9, 7, 6, 10, 12, 14, 9, 13, rep(0,10)) g <- gl(6, 10) levels(g) <- c("Control", "3%", "6%", "12%", "25%", "50%") ## NOEC at 3%, LOEC at 6% steelTest(x ~ g, subset = g != "50%", alternative = "less")
Performs step-down trend test procedures for monotone responses to detect NOEC (LOEC) according to OECD (2006).
stepDownTrendTest(x, ...) ## Default S3 method: stepDownTrendTest( x, g, test = c("leTest", "spearmanTest", "jonckheereTest", "cuzickTest", "chackoTest", "johnsonTest"), alternative = c("two.sided", "greater", "less"), continuity = FALSE, ... ) ## S3 method for class 'formula' stepDownTrendTest( formula, data, subset, na.action, test = c("leTest", "spearmanTest", "jonckheereTest", "cuzickTest", "chackoTest", "johnsonTest"), alternative = c("two.sided", "greater", "less"), continuity = FALSE, ... )
stepDownTrendTest(x, ...) ## Default S3 method: stepDownTrendTest( x, g, test = c("leTest", "spearmanTest", "jonckheereTest", "cuzickTest", "chackoTest", "johnsonTest"), alternative = c("two.sided", "greater", "less"), continuity = FALSE, ... ) ## S3 method for class 'formula' stepDownTrendTest( formula, data, subset, na.action, test = c("leTest", "spearmanTest", "jonckheereTest", "cuzickTest", "chackoTest", "johnsonTest"), alternative = c("two.sided", "greater", "less"), continuity = FALSE, ... )
x |
a numeric vector of data values, or a list of numeric data vectors. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
test |
the trend test that shall be performed. Defaults to |
alternative |
the alternative hypothesis. Defaults to |
continuity |
logical indicator whether a continuity correction
shall be performed. Only relevant for |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
According to OECD 2006 one can perform a test for trend on responses from all dose groups including the control. If the trend test is significant at the 0.05 level, the high dose group is omitted, and the trend statistic with the remaining dose groups is re-compute The procedure is continued until the trend test is first non-significant at the 0.05 level, then stop.
The NOEC is the highest dose remaining at this stage. If this test is significant when only the lowest dose and control remain, then a NOEC cannot be established from the data.
A list with class "trendPMCMR"
containing the following components:
a character string indicating what type of test was performed.
a character string giving the name(s) of the data.
lower-triangle matrix of the estimated quantiles of the pairwise test statistics.
lower-triangle matrix of the p-values for the pairwise tests.
a character string describing the alternative hypothesis.
a character string describing the method for p-value adjustment.
a string that denotes the test distribution.
Factor labels for g
must be assigned in such a way,
that they can be increasingly ordered from zero-dose
control to the highest dose level, e.g. integers {0, 1, 2, ..., k} or
letters {a, b, c, ...}. Otherwise the function may not
select the correct values for intended zero-dose control.
It is safer, to i) label the factor levels as given above,
and to ii) sort the data according to increasing dose-levels
prior to call the function (see order
, factor
).
OECD (2006) Current Approaches in the Statistical Analysis of Ecotoxicity Data: A Guidance to Application, OECD Series on Testing and Assessment 52, Paris: Organisation for Econonomic Co-operation and Development.
leTest
, jonckheereTest
,
spearmanTest
, cuzickTest
,
chackoTest
, johnsonTest
res <- stepDownTrendTest(Y ~ DOSE, data = trout, test = "jonckheereTest", alternative = "less") ## print method res ## summary method summary(res)
res <- stepDownTrendTest(Y ~ DOSE, data = trout, test = "jonckheereTest", alternative = "less") ## print method res ## summary method summary(res)
Summarize an object of class gesdTest.
## S3 method for class 'gesdTest' summary(object, ...)
## S3 method for class 'gesdTest' summary(object, ...)
object |
an object of class |
... |
further arguments. Currenly ignored. |
"mandel"
summary.mandel
is a function
used to produce result summaries of the results of
the functions mandelhTest
or mandelkTest
.
## S3 method for class 'mandel' summary(object, ...)
## S3 method for class 'mandel' summary(object, ...)
object |
an object of class |
... |
further arguments. Currently ignored. |
Summarize an object of class osrt.
## S3 method for class 'osrt' summary(object, ...)
## S3 method for class 'osrt' summary(object, ...)
object |
an object of class |
... |
further arguments. Currenly ignored. |
Summarize an object of class PMCMR.
## S3 method for class 'PMCMR' summary(object, ...)
## S3 method for class 'PMCMR' summary(object, ...)
object |
an object of class |
... |
further arguments. Currenly ignored. |
A detailed output of all pairwise hypotheses, the test statistics, the corresponding p-values and symbols that indicates the level of significance.
ans <- vanWaerdenAllPairsTest(count ~ spray, InsectSprays) summary(ans)
ans <- vanWaerdenAllPairsTest(count ~ spray, InsectSprays) summary(ans)
Summarize an object of class trendPMCMR.
## S3 method for class 'trendPMCMR' summary(object, ...)
## S3 method for class 'trendPMCMR' summary(object, ...)
object |
an object of class |
... |
further arguments. Currenly ignored. |
A detailed output of all pairwise hypotheses, the test statistics, the corresponding p-values and symbols that indicates the level of significance.
Performes a grouped summary on an PMCMR object.
summaryGroup(x, alpha = 0.05, ...)
summaryGroup(x, alpha = 0.05, ...)
x |
an object of class |
alpha |
the selected alpha-level. Defaults to 0.05. |
... |
further arguments. Currently ignored. |
Provides summary statistics for each factor level and a letter symbol, whereas different letters indicate significant differences between factor levels based on the selected level of alpha.
Performs Tamhane-Dunnett's multiple comparisons test with one control.
For many-to-one comparisons in an one-factorial layout
with normally distributed residuals and unequal variances
Tamhane-Dunnett's test can be used.
Let denote a continuous random variable
with the
-the realization of the control group
(
) and
the
-the realization
in the
-th treatment group (
).
Furthermore, the total sample size is
.
A total of
hypotheses can be tested: The null hypothesis is
H
is tested against the alternative
A
(two-tailed). Tamhane-Dunnett's test
statistics are given by
The null hypothesis is rejected if
(two-tailed),
with
degree of freedom and the correlation
The p-values are computed from the multivariate-t
distribution as implemented in the function
pmvt
distribution.
tamhaneDunnettTest(x, ...) ## Default S3 method: tamhaneDunnettTest(x, g, alternative = c("two.sided", "greater", "less"), ...) ## S3 method for class 'formula' tamhaneDunnettTest( formula, data, subset, na.action, alternative = c("two.sided", "greater", "less"), ... ) ## S3 method for class 'aov' tamhaneDunnettTest(x, alternative = c("two.sided", "greater", "less"), ...)
tamhaneDunnettTest(x, ...) ## Default S3 method: tamhaneDunnettTest(x, g, alternative = c("two.sided", "greater", "less"), ...) ## S3 method for class 'formula' tamhaneDunnettTest( formula, data, subset, na.action, alternative = c("two.sided", "greater", "less"), ... ) ## S3 method for class 'aov' tamhaneDunnettTest(x, alternative = c("two.sided", "greater", "less"), ...)
x |
a numeric vector of data values, a list of numeric data vectors or a fitted model object, usually an aov fit. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
alternative |
the alternative hypothesis.
Defaults to |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
A list with class "PMCMR"
containing the following components:
a character string indicating what type of test was performed.
a character string giving the name(s) of the data.
lower-triangle matrix of the estimated quantiles of the pairwise test statistics.
lower-triangle matrix of the p-values for the pairwise tests.
a character string describing the alternative hypothesis.
a character string describing the method for p-value adjustment.
a data frame of the input data.
a string that denotes the test distribution.
OECD (ed. 2006) Current approaches in the statistical analysis of ecotoxicity data: A guidance to application - Annexes. OECD Series on testing and assessment, No. 54.
set.seed(245) mn <- c(1, 2, 2^2, 2^3, 2^4) x <- rep(mn, each=5) + rnorm(25) g <- factor(rep(1:5, each=5)) fit <- aov(x ~ g - 1) shapiro.test(residuals(fit)) bartlett.test(x ~ g - 1) anova(fit) ## works with object of class aov summary(tamhaneDunnettTest(fit, alternative = "greater"))
set.seed(245) mn <- c(1, 2, 2^2, 2^3, 2^4) x <- rep(mn, each=5) + rnorm(25) g <- factor(rep(1:5, each=5)) fit <- aov(x ~ g - 1) shapiro.test(residuals(fit)) bartlett.test(x ~ g - 1) anova(fit) ## works with object of class aov summary(tamhaneDunnettTest(fit, alternative = "greater"))
Performs Tamhane's T2 (or T2') all-pairs comparison test for normally distributed data with unequal variances.
tamhaneT2Test(x, ...) ## Default S3 method: tamhaneT2Test(x, g, welch = TRUE, ...) ## S3 method for class 'formula' tamhaneT2Test(formula, data, subset, na.action, welch = TRUE, ...) ## S3 method for class 'aov' tamhaneT2Test(x, welch = TRUE, ...)
tamhaneT2Test(x, ...) ## Default S3 method: tamhaneT2Test(x, g, welch = TRUE, ...) ## S3 method for class 'formula' tamhaneT2Test(formula, data, subset, na.action, welch = TRUE, ...) ## S3 method for class 'aov' tamhaneT2Test(x, welch = TRUE, ...)
x |
a numeric vector of data values, a list of numeric data vectors or a fitted model object, usually an aov fit. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
welch |
indicates, whether Welch's approximate solution for
calculating the degree of freedom shall be used or, as usually,
|
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
For all-pairs comparisons in an one-factorial layout
with normally distributed residuals but unequal groups variances
the T2 test (or T2' test) of Tamhane can be performed.
Let denote a continuous random variable
with the
-the realization (
)
in the
-th group (
). Furthermore, the total
sample size is
. A total of
hypotheses can be tested: The null hypothesis is
H
is tested against the alternative
A
(two-tailed). Tamhane T2 all-pairs
test statistics are given by
with the variance of the
-th group.
The null hypothesis is rejected (two-tailed) if
T2 test uses Welch's approximate solution for calculating the degree of freedom.
T2' test applies the following approximation for the degree of freedom
The p-values are computed from the TDist
-distribution
and adjusted according to Dunn-Sidak.
A list with class "PMCMR"
containing the following components:
a character string indicating what type of test was performed.
a character string giving the name(s) of the data.
lower-triangle matrix of the estimated quantiles of the pairwise test statistics.
lower-triangle matrix of the p-values for the pairwise tests.
a character string describing the alternative hypothesis.
a character string describing the method for p-value adjustment.
a data frame of the input data.
a string that denotes the test distribution.
T2 test is basically an all-pairs pairwise-t-test. Similar results
can be obtained with pairwise.t.test(..., var.equal=FALSE, p.adjust.mehod = FALSE)
.
A warning message appears in the modified T2' test, if none of in Tamhane (1979) given conditions for nearly balanced sample sizes and nearly balanced standard errors is true.
Thanks to Sirio Bolaños for his kind suggestion for adding T2' test into this function.
Tamhane, A. C. (1979) A Comparison of Procedures for Multiple Comparisons of Means with Unequal Variances, Journal of the American Statistical Association 74, 471–480.
dunnettT3Test
uryWigginsHochbergTest
fit <- aov(weight ~ feed, chickwts) shapiro.test(residuals(fit)) bartlett.test(weight ~ feed, chickwts) # var1 = varN anova(fit) ## also works with fitted objects of class aov res <- tamhaneT2Test(fit) summary(res) summaryGroup(res) res ## compare with pairwise.t.test WT <- pairwise.t.test(chickwts$weight, chickwts$feed, pool.sd = FALSE, p.adjust.method = "none") p.adj.sidak <- function(p, m) sapply(p, function(p) min(1, 1 - (1 - p)^m)) p.raw <- as.vector(WT$p.value) m <- length(p.raw[!is.na(p.raw)]) PADJ <- matrix(ans <- p.adj.sidak(p.raw, m), nrow = 5, ncol = 5) colnames(PADJ) <- colnames(WT$p.value) rownames(PADJ) <- rownames(WT$p.value) PADJ ## same without Welch's approximate solution summary(T2b <- tamhaneT2Test(fit, welch = FALSE))
fit <- aov(weight ~ feed, chickwts) shapiro.test(residuals(fit)) bartlett.test(weight ~ feed, chickwts) # var1 = varN anova(fit) ## also works with fitted objects of class aov res <- tamhaneT2Test(fit) summary(res) summaryGroup(res) res ## compare with pairwise.t.test WT <- pairwise.t.test(chickwts$weight, chickwts$feed, pool.sd = FALSE, p.adjust.method = "none") p.adj.sidak <- function(p, m) sapply(p, function(p) min(1, 1 - (1 - p)^m)) p.raw <- as.vector(WT$p.value) m <- length(p.raw[!is.na(p.raw)]) PADJ <- matrix(ans <- p.adj.sidak(p.raw, m), nrow = 5, ncol = 5) colnames(PADJ) <- colnames(WT$p.value) rownames(PADJ) <- rownames(WT$p.value) PADJ ## same without Welch's approximate solution summary(T2b <- tamhaneT2Test(fit, welch = FALSE))
The functions converts a list object of class "PMCMR"
or "osrt"
into a data.frame.
toTidy(mod, ...)
toTidy(mod, ...)
mod |
an object of class |
... |
further arguments. Currently ignored. |
A data.frame.
Indrajeet Patil (via email, 2020-1022), modified by Thorsten Pohlert
res <- tukeyTest(weight ~ Diet, data = ChickWeight, subset = Time == 21) toTidy(res)
res <- tukeyTest(weight ~ Diet, data = ChickWeight, subset = Time == 21) toTidy(res)
This data set contains results from a dose-response experiment with trouts. The experiment was conducted with five doses of 10, 25, 60, 150 and 1000 ppm, respectively, plus a zero-dose control. The response is trout weight in mg.
A data frame with 65 observations on the following 5 variables.
a numeric vector of dose concentration in ppm
a factor with levels 1
2
3
4
5
6
a factor with levels 1
2
a factor with levels 1
2
a numeric vector of trout weight in mg
ENV/JM/MONO(2006)18/ANN, page 113.
OECD (ed. 2006) Current approaches in the statistical analysis of ecotoxicity data: A guidance to application - Annexes. OECD Series on testing and assessment, No. 54, (ENV/JM/MONO(2006)18/ANN).
Performs Tukey's all-pairs comparisons test for normally distributed data with equal group variances.
tukeyTest(x, ...) ## Default S3 method: tukeyTest(x, g, ...) ## S3 method for class 'formula' tukeyTest(formula, data, subset, na.action, ...) ## S3 method for class 'aov' tukeyTest(x, ...)
tukeyTest(x, ...) ## Default S3 method: tukeyTest(x, g, ...) ## S3 method for class 'formula' tukeyTest(formula, data, subset, na.action, ...) ## S3 method for class 'aov' tukeyTest(x, ...)
x |
a numeric vector of data values, a list of numeric data vectors or a fitted model object, usually an aov fit. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
For all-pairs comparisons in an one-factorial layout
with normally distributed residuals and equal variances
Tukey's test can be performed.
Let denote a continuous random variable
with the
-the realization (
)
in the
-th group (
). Furthermore, the total
sample size is
. A total of
hypotheses can be tested: The null hypothesis is
H
is tested against the alternative
A
(two-tailed). Tukey's all-pairs test
statistics are given by
with the within-group ANOVA variance.
The null hypothesis is rejected if
,
with
degree of freedom. The p-values are computed
from the
Tukey
distribution.
A list with class "PMCMR"
containing the following components:
a character string indicating what type of test was performed.
a character string giving the name(s) of the data.
lower-triangle matrix of the estimated quantiles of the pairwise test statistics.
lower-triangle matrix of the p-values for the pairwise tests.
a character string describing the alternative hypothesis.
a character string describing the method for p-value adjustment.
a data frame of the input data.
a string that denotes the test distribution.
Sachs, L. (1997) Angewandte Statistik, New York: Springer.
Tukey, J. (1949) Comparing Individual Means in the Analysis of Variance, Biometrics 5, 99–114.
fit <- aov(weight ~ feed, chickwts) shapiro.test(residuals(fit)) bartlett.test(weight ~ feed, chickwts) anova(fit) ## also works with fitted objects of class aov res <- tukeyTest(fit) summary(res) summaryGroup(res)
fit <- aov(weight ~ feed, chickwts) shapiro.test(residuals(fit)) bartlett.test(weight ~ feed, chickwts) anova(fit) ## also works with fitted objects of class aov res <- tukeyTest(fit) summary(res) summaryGroup(res)
Performs Ury-Wiggins and Hochberg's all-pairs comparison test for normally distributed data with unequal variances.
uryWigginsHochbergTest(x, ...) ## Default S3 method: uryWigginsHochbergTest(x, g, p.adjust.method = p.adjust.methods, ...) ## S3 method for class 'formula' uryWigginsHochbergTest( formula, data, subset, na.action, p.adjust.method = p.adjust.methods, ... ) ## S3 method for class 'aov' uryWigginsHochbergTest(x, p.adjust.method = p.adjust.methods, ...)
uryWigginsHochbergTest(x, ...) ## Default S3 method: uryWigginsHochbergTest(x, g, p.adjust.method = p.adjust.methods, ...) ## S3 method for class 'formula' uryWigginsHochbergTest( formula, data, subset, na.action, p.adjust.method = p.adjust.methods, ... ) ## S3 method for class 'aov' uryWigginsHochbergTest(x, p.adjust.method = p.adjust.methods, ...)
x |
a numeric vector of data values, a list of numeric data vectors or a fitted model object, usually an aov fit. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
p.adjust.method |
method for adjusting p values
(see |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
For all-pairs comparisons in an one-factorial layout
with normally distributed residuals but unequal groups variances
the tests of Ury-Wiggins and Hochberg can be performed.
Let denote a continuous random variable
with the
-the realization (
)
in the
-th group (
). Furthermore, the total
sample size is
. A total of
hypotheses can be tested: The null hypothesis is
H
is tested against the alternative
A
(two-tailed). Ury-Wiggins and Hochberg
all-pairs test statistics are given by
with the variance of the
-th group.
The null hypothesis is rejected (two-tailed) if
with Welch's approximate equation for degree of freedom as
The p-values are computed from the TDist
-distribution.
The type of test depends
on the selected p-value adjustment method (see also p.adjust
):
the Ury-Wiggins test is performed with Bonferroni adjusted p-values.
the Hochberg test is performed with Hochberg's adjusted p-values
.
A list with class "PMCMR"
containing the following components:
a character string indicating what type of test was performed.
a character string giving the name(s) of the data.
lower-triangle matrix of the estimated quantiles of the pairwise test statistics.
lower-triangle matrix of the p-values for the pairwise tests.
a character string describing the alternative hypothesis.
a character string describing the method for p-value adjustment.
a data frame of the input data.
a string that denotes the test distribution.
Hochberg, Y. (1976) A Modification of the T-Method of Multiple Comparisons for a One-Way Layout With Unequal Variances, Journal of the American Statistical Association 71, 200–203.
Ury, H. and Wiggins, A. D. (1971) Large Sample and Other Multiple Comparisons Among Means, British Journal of Mathematical and Statistical Psychology 24, 174–194.
dunnettT3Test
tamhaneT2Test
TDist
fit <- aov(weight ~ feed, chickwts) shapiro.test(residuals(fit)) bartlett.test(weight ~ feed, chickwts) # var1 = varN anova(fit) ## also works with fitted objects of class aov res <- uryWigginsHochbergTest(fit) summary(res) summaryGroup(res)
fit <- aov(weight ~ feed, chickwts) shapiro.test(residuals(fit)) bartlett.test(weight ~ feed, chickwts) # var1 = varN anova(fit) ## also works with fitted objects of class aov res <- uryWigginsHochbergTest(fit) summary(res) summaryGroup(res)
Performs van-der-Waerden all-pairs comparison normal scores test.
vanWaerdenAllPairsTest(x, ...) ## Default S3 method: vanWaerdenAllPairsTest( x, g, p.adjust.method = c("single-step", p.adjust.methods), ... ) ## S3 method for class 'formula' vanWaerdenAllPairsTest( formula, data, subset, na.action, p.adjust.method = c("single-step", p.adjust.methods), ... )
vanWaerdenAllPairsTest(x, ...) ## Default S3 method: vanWaerdenAllPairsTest( x, g, p.adjust.method = c("single-step", p.adjust.methods), ... ) ## S3 method for class 'formula' vanWaerdenAllPairsTest( formula, data, subset, na.action, p.adjust.method = c("single-step", p.adjust.methods), ... )
x |
a numeric vector of data values, or a list of numeric data vectors. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
p.adjust.method |
method for adjusting p values (see |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
For all-pairs comparisons in an one-factorial layout
with non-normally distributed residuals van-der-Waerden's
normal scores transformation can be used prior to
an all-pairs comparison test. A total of
hypotheses can be tested. The null hypothesis
H
is tested in the two-tailed test
against the alternative
A
.
For
p.adjust.method = "single-step"
the
Tukey's studentized range distribution is used to calculate
p-values (see Tukey
). Otherwise, the
t-distribution is used for the calculation of p-values
with a latter p-value adjustment as
performed by p.adjust
.
A list with class "PMCMR"
containing the following components:
a character string indicating what type of test was performed.
a character string giving the name(s) of the data.
lower-triangle matrix of the estimated quantiles of the pairwise test statistics.
lower-triangle matrix of the p-values for the pairwise tests.
a character string describing the alternative hypothesis.
a character string describing the method for p-value adjustment.
a data frame of the input data.
a string that denotes the test distribution.
Conover, W. J., Iman, R. L. (1979) On multiple-comparisons procedures, Tech. Rep. LA-7677-MS, Los Alamos Scientific Laboratory.
van der Waerden, B. L. (1952) Order tests for the two-sample problem and their power, Indagationes Mathematicae 14, 453–458.
vanWaerdenTest
, vanWaerdenManyOneTest
,
normOrder
.
Performs van-der-Waerden's multiple comparison normal scores test with one control.
vanWaerdenManyOneTest(x, ...) ## Default S3 method: vanWaerdenManyOneTest( x, g, alternative = c("two.sided", "greater", "less"), p.adjust.method = c("single-step", p.adjust.methods), ... ) ## S3 method for class 'formula' vanWaerdenManyOneTest( formula, data, subset, na.action, alternative = c("two.sided", "greater", "less"), p.adjust.method = c("single-step", p.adjust.methods), ... )
vanWaerdenManyOneTest(x, ...) ## Default S3 method: vanWaerdenManyOneTest( x, g, alternative = c("two.sided", "greater", "less"), p.adjust.method = c("single-step", p.adjust.methods), ... ) ## S3 method for class 'formula' vanWaerdenManyOneTest( formula, data, subset, na.action, alternative = c("two.sided", "greater", "less"), p.adjust.method = c("single-step", p.adjust.methods), ... )
x |
a numeric vector of data values, or a list of numeric data vectors. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
alternative |
the alternative hypothesis. Defaults to |
p.adjust.method |
method for adjusting p values (see |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
For many-to-one comparisons in an one-factorial layout
with non-normally distributed residuals van-der-Waerden's
normal scores transformation can be used prior to
a many-to-one comparison test. A total of
hypotheses can be tested. The null hypothesis
H
is tested in the two-tailed test
against the alternative
A
.
For
p.adjust.method = "single-step"
the
multivariate t distribution is used to calculate
p-values (see pmvt
). Otherwise, the
t-distribution is used for the calculation of p-values
with a latter p-value adjustment as
performed by p.adjust
.
A list with class "PMCMR"
containing the following components:
a character string indicating what type of test was performed.
a character string giving the name(s) of the data.
lower-triangle matrix of the estimated quantiles of the pairwise test statistics.
lower-triangle matrix of the p-values for the pairwise tests.
a character string describing the alternative hypothesis.
a character string describing the method for p-value adjustment.
a data frame of the input data.
a string that denotes the test distribution.
Conover, W. J., Iman, R. L. (1979) On multiple-comparisons procedures, Tech. Rep. LA-7677-MS, Los Alamos Scientific Laboratory.
van der Waerden, B. L. (1952) Order tests for the two-sample problem and their power, Indagationes Mathematicae 14, 453–458.
vanWaerdenTest
, vanWaerdenAllPairsTest
,
pmvt
.
## Data set PlantGrowth ## Global test vanWaerdenTest(weight ~ group, data = PlantGrowth) ## van-der-Waerden's many-one comparison test ans <- vanWaerdenManyOneTest(weight ~ group, data = PlantGrowth, p.adjust.method = "holm") summary(ans)
## Data set PlantGrowth ## Global test vanWaerdenTest(weight ~ group, data = PlantGrowth) ## van-der-Waerden's many-one comparison test ans <- vanWaerdenManyOneTest(weight ~ group, data = PlantGrowth, p.adjust.method = "holm") summary(ans)
Performs van der Waerden's normal scores test.
vanWaerdenTest(x, ...) ## Default S3 method: vanWaerdenTest(x, g, ...) ## S3 method for class 'formula' vanWaerdenTest(formula, data, subset, na.action, ...)
vanWaerdenTest(x, ...) ## Default S3 method: vanWaerdenTest(x, g, ...) ## S3 method for class 'formula' vanWaerdenTest(formula, data, subset, na.action, ...)
x |
a numeric vector of data values, or a list of numeric data vectors. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
For one-factorial designs with non-normally distributed
residuals van der Waerden's normal scores test can be performed to test
the H against
the H
with at least
one strict inequality.
A tie correction is not applied in this function.
Conover, W. J., Iman, R. L. (1979) On multiple-comparisons procedures, Tech. Rep. LA-7677-MS, Los Alamos Scientific Laboratory.
van der Waerden, B. L. (1952) Order tests for the two-sample problem and their power, Indagationes Mathematicae 14, 453–458.
vanWaerdenTest(count ~ spray, data = InsectSprays)
vanWaerdenTest(count ~ spray, data = InsectSprays)
Performs Welchs's t-test for multiple comparisons with one control.
welchManyOneTTest(x, ...) ## Default S3 method: welchManyOneTTest( x, g, alternative = c("two.sided", "greater", "less"), p.adjust.method = p.adjust.methods, ... ) ## S3 method for class 'formula' welchManyOneTTest( formula, data, subset, na.action, alternative = c("two.sided", "greater", "less"), p.adjust.method = p.adjust.methods, ... ) ## S3 method for class 'aov' welchManyOneTTest( x, alternative = c("two.sided", "greater", "less"), p.adjust.method = p.adjust.methods, ... )
welchManyOneTTest(x, ...) ## Default S3 method: welchManyOneTTest( x, g, alternative = c("two.sided", "greater", "less"), p.adjust.method = p.adjust.methods, ... ) ## S3 method for class 'formula' welchManyOneTTest( formula, data, subset, na.action, alternative = c("two.sided", "greater", "less"), p.adjust.method = p.adjust.methods, ... ) ## S3 method for class 'aov' welchManyOneTTest( x, alternative = c("two.sided", "greater", "less"), p.adjust.method = p.adjust.methods, ... )
x |
a numeric vector of data values, a list of numeric data vectors or a fitted model object, usually an aov fit. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
alternative |
the alternative hypothesis.
Defaults to |
p.adjust.method |
method for adjusting p values
(see |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
For many-to-one comparisons in an one-factorial layout
with normally distributed residuals and unequal variances
Welch's t-test can be used. A total of
hypotheses can be tested. The null hypothesis
H
is tested in the two-tailed test
against the alternative
A
.
This function is basically a wrapper function for
t.test(..., var.equal = FALSE)
. The p-values for the test
are calculated from the t distribution
and can be adusted with any method that is implemented in
p.adjust.methods
.
A list with class "PMCMR"
containing the following components:
a character string indicating what type of test was performed.
a character string giving the name(s) of the data.
lower-triangle matrix of the estimated quantiles of the pairwise test statistics.
lower-triangle matrix of the p-values for the pairwise tests.
a character string describing the alternative hypothesis.
a character string describing the method for p-value adjustment.
a data frame of the input data.
a string that denotes the test distribution.
Welch, B. L. (1947) The generalization of "Student's" problem when several different population variances are involved, Biometrika 34, 28–35.
Welch, B. L. (1951) On the comparison of several mean values: An alternative approach, Biometrika 38, 330–336.
pairwise.t.test
, t.test
,
p.adjust
, tamhaneDunnettTest
set.seed(245) mn <- rep(c(1, 2^(1:4)), each=5) sd <- rep(1:5, each=5) x <- mn + rnorm(25, sd = sd) g <- factor(rep(1:5, each=5)) fit <- aov(x ~ g) shapiro.test(residuals(fit)) bartlett.test(x ~ g) anova(fit) summary(welchManyOneTTest(fit, alternative = "greater", p.adjust="holm"))
set.seed(245) mn <- rep(c(1, 2^(1:4)), each=5) sd <- rep(1:5, each=5) x <- mn + rnorm(25, sd = sd) g <- factor(rep(1:5, each=5)) fit <- aov(x ~ g) shapiro.test(residuals(fit)) bartlett.test(x ~ g) anova(fit) summary(welchManyOneTTest(fit, alternative = "greater", p.adjust="holm"))
Performs Williams' test for contrasting increasing (decreasing) dose levels of a treatment.
williamsTest(x, ...) ## Default S3 method: williamsTest(x, g, alternative = c("greater", "less"), ...) ## S3 method for class 'formula' williamsTest( formula, data, subset, na.action, alternative = c("greater", "less"), ... ) ## S3 method for class 'aov' williamsTest(x, alternative = c("greater", "less"), ...)
williamsTest(x, ...) ## Default S3 method: williamsTest(x, g, alternative = c("greater", "less"), ...) ## S3 method for class 'formula' williamsTest( formula, data, subset, na.action, alternative = c("greater", "less"), ... ) ## S3 method for class 'aov' williamsTest(x, alternative = c("greater", "less"), ...)
x |
a numeric vector of data values, or a list of numeric data vectors. |
... |
further arguments to be passed to or from methods. |
g |
a vector or factor object giving the group for the
corresponding elements of |
alternative |
the alternative hypothesis. Defaults to |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
Williams' test is a step-down trend test for testing several treatment levels
with a zero control in a one-factorial design with normally distributed
errors of homogeneous variance. Let there be groups including the control and let
the zero dose level be indicated with
and the treatment
levels indicated as
, then the following
hypotheses are tested:
where denotes the isotonic mean of the
th dose level group.
William's test bases on a order restriction:
where denotes the
-th isotonic
mean estimated with isotonic regression using the
pool adjacent violators algorithm (PAVA) with the vector
of means
and the vector of weights
.
For the alternative hypothesis of decreasing trend, max and min are interchanged in the above Equation.
The -the test statistic is calculated as follows:
The procedure starts from the highest dose level () to the the lowest dose level (
) and
stops at the first non-significant test. The consequent lowest effect dose
is the treatment level of the previous test number.
The function does not return p-values. Instead the critical t-values
as given in the tables of Williams (1972) for (one-sided)
are looked up according to the degree of freedoms (
) and the order number of the
dose level (
) and (potentially) modified according to the given extrapolation
coefficient
.
Non tabulated values are linearly interpolated as recommended by Williams (1972).
The function approx
is used.
For the comparison of the first dose level (i = 1) with the control, the critical t-value
from the Student t distribution is used (TDist
).
A list with class "osrt"
that contains 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 statistic(s)
critical values for .
a character string describing the alternative hypothesis.
the parameter(s) of the test distribution.
a string that denotes the test distribution.
There are print and summary methods available.
The source code for the application of the pool adjacent violators
theorem to calculate the isotonic means
was taken from the file "pava.f"
, which is included in the
package Iso:
Rolf Turner (2015). Iso: Functions to Perform Isotonic Regression. R package version 0.0-17. https://CRAN.R-project.org/package=Iso.
The file pava.f
is a Ratfor modification of Algorithm AS 206.1:
Bril, G., Dykstra, R., Pillers, C., Robertson, T. (1984) Statistical Algorithms: Algorithm AS 206: Isotonic Regression in Two Independent Variables, Appl. Statist., 34, 352–357.
The Algorith AS 206 is available from StatLib https://lib.stat.cmu.edu/apstat/. The Royal Statistical Society holds the copyright to these routines, but has given its permission for their distribution provided that no fee is charged.
In the current implementation, only tests on the level of
can be performed. The included extrapolation function assumes either
a balanced design, or designs, where the number of replicates in the control excdeeds the number of replicates
in the treatment levels. A warning message appears, if the following
condition is not met,
for
.
Williams, D. A. (1971) A test for differences between treatment means when several dose levels are compared with a zero dose control, Biometrics 27, 103–117.
Williams, D. A. (1972) The comparison of several dose levels with a zero dose control, Biometrics 28, 519–531.
TDist
, approx
, print.osrt
,
summary.osrt
## Example from Sachs (1997, p. 402) x <- c(106, 114, 116, 127, 145, 110, 125, 143, 148, 151, 136, 139, 149, 160, 174) g <- gl(3,5) levels(g) <- c("0", "I", "II") ## Williams Test williamsTest(x ~ g)
## Example from Sachs (1997, p. 402) x <- c(106, 114, 116, 127, 145, 110, 125, 143, 148, 151, 136, 139, 149, 160, 174) g <- gl(3,5) levels(g) <- c("0", "I", "II") ## Williams Test williamsTest(x ~ g)