View source: R/shirleyWilliamsTest.R
shirleyWilliamsTest | R Documentation |
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,
...
)
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 k
groups including the control and let
the zero dose level be indicated with i = 0
and the highest
dose level with i = m
, then the following m = k - 1
hypotheses are tested:
\begin{array}{ll}
\mathrm{H}_{m}: \theta_0 = \theta_1 = \ldots = \theta_m, & \mathrm{A}_{m} = \theta_0 \le \theta_1 \le \ldots \theta_m, \theta_0 < \theta_m \\
\mathrm{H}_{m-1}: \theta_0 = \theta_1 = \ldots = \theta_{m-1}, & \mathrm{A}_{m-1} = \theta_0 \le \theta_1 \le \ldots \theta_{m-1}, \theta_0 < \theta_{m-1} \\
\vdots & \vdots \\
\mathrm{H}_{1}: \theta_0 = \theta_1, & \mathrm{A}_{1} = \theta_0 < \theta_1\\
\end{array}
Let R_{ij}
be the rank of X_{ij}
,
where X_{ij}
is jointly ranked
from \left\{1, 2, \ldots, N \right\}, ~~ N = \sum_{i=1}^k n_i
,
then the test statistic is
t_{i} = \frac{\max_{1 \le u \le i} \left(\sum_{j=u}^i n_j \bar{R}_j / \sum_{j=u}^i n_j \right) - \bar{R}_0}
{\sigma_{R_i} \sqrt{1/n_i + 1/n_0}},
with expected variance of
\sigma_{R_i}^2 = N_i \left(N_i + 1 \right) / 12 - T_i,
where N_i = n_0 + n_1 + n_2 + \ldots + n_i
and
T_i
the ties for the i
-th comparison is given by
T_i = \sum_{j=1}^i \frac{t_j^3 - t_j}{12 \left(N_i - 1\right)}.
The procedure starts from the highest dose level (m
) to the the lowest dose level (1
) 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 i
-th comparison.
If method = "look-up"
is selected, the function does not return p-values.
Instead the critical t'_{i,v,\alpha}
-values
as given in the tables of Williams (1972) for \alpha = 0.05
(one-sided)
are looked up according to the degree of freedoms (v = \infty
) and the order number of the
dose level (i
) and (potentially) modified according to the given extrapolation
coefficient \beta
.
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_1
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 \alpha = 0.05
.
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 \alpha = 0.05
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.
williamsTest
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.