Performs Williams' test for contrasting increasing (decreasing) dose levels of a treatment.
williamsTest(x, ...)# S3 method for default
williamsTest(x, g, alternative = c("greater", "less"), ...)
# S3 method for formula
williamsTest(formula, data, subset, na.action,
alternative = c("greater", "less"), ...)
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 greater
a formula of the form response ~ group
where
response
gives the data values and group
a vector or
factor of the corresponding groups.
an optional matrix or data frame (or similar: see
model.frame
) containing the variables in the
formula formula
. By default the variables are taken from
environment(formula)
.
an optional vector specifying a subset of observations to be used.
a function which indicates what should happen when
the data contain NA
s. Defaults to getOption("na.action")
.
A list with class "williamsTest"
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 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.
There are print and summary methods available.
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 \(k\) groups including the control and let the zero dose level be indicated with \(i = 0\) and the treatment levels indicated as \(1 \le i \le m\), then the following \(m = k - 1\) hypotheses are tested:
$$ \begin{array}{ll} \mathrm{H}_{m}: \bar{x}_0 = m_1 = \ldots = m_m, & \mathrm{A}_{m}: \bar{x}_0 \ge m_1 \ge \ldots m_m, \bar{x}_0 < m_m \\ \mathrm{H}_{m-1}: \bar{x}_0 = m_1 = \ldots = m_{m-1}, & \mathrm{A}_{m-1}: \bar{x}_0 \ge m_1 \ge \ldots m_{m-1}, \bar{x}_0 < m_{m-1} \\ \vdots & \vdots \\ \mathrm{H}_{1}: \bar{x}_0 = m_1, & \mathrm{A}_{1}: \bar{x}_0 < m_1,\\ \end{array} $$
where \(m_i\) denotes the isotonic mean of the \(i\)th dose level group. 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.
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\)) 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 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
).
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.
# NOT RUN {
## 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)
# }
Run the code above in your browser using DataLab