Performs Shirley's nonparametric equivalent of William's test for contrasting increasing dose levels of a treatment.
shirleyWilliamsTest(x, ...)# S3 method for default
shirleyWilliamsTest(x, g, alternative = c("two.sided",
"greater", "less"), method = c("look-up", "boot"), nperm = 10000, ...)
# S3 method for formula
shirleyWilliamsTest(formula, data, subset, na.action,
alternative = c("two.sided", "greater", "less"), method = c("look-up",
"boot"), nperm = 10000, ...)
a numeric vector of data values, or a list of numeric data vectors.
further arguments to be passed to or from methods.
a vector or factor object giving the group for the
corresponding elements of "x"
.
Ignored with a warning if "x"
is a list.
the alternative hypothesis. Defaults to two.sided
a character string specifying the test statistic to use.
Defaults to "look-up"
that uses published Table values of Williams (1972).
number of permutations for the assymptotic permutation test.
Defaults to 1000
. Ignored, if method = "look-up"
.
a formula of the form response ~ group
where
response
gives the data values and group
a vector or
factor of the corresponding groups.
an optional matrix or data frame (or similar: see
model.frame
) containing the variables in the
formula formula
. By default the variables are taken from
environment(formula)
.
an optional vector specifying a subset of observations to be used.
a function which indicates what should happen when
the data contain NA
s. Defaults to getOption("na.action")
.
Either a list with class "williamsTest"
or al list with class "PMCMR"
.
The list with class "williamsTest"
.
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 critical t\'-values for \(\alpha = 0.05\).
the degree of freedom
a character string describing the alternative hypothesis.
a data frame of the input data.
a string that denotes the test 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.
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} $$
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).
If method = "look-up"
is selected, the function does not return p-values. Instead the critical t-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.
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.
# NOT RUN {
## Example from Shirley (1977)
## Reaction times of mice to stimuli to their tails.
y <- 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)
# }
# NOT RUN {
## two.sided test
summary(shirleyWilliamsTest(y ~ g, method = "boot", alternative = "two.sided"))
# }
# NOT RUN {
## one-sided test using look-up table
shirleyWilliamsTest(y ~ g, alternative = "greater")
# }
Run the code above in your browser using DataLab