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"),
...
)
# S3 method for aov
williamsTest(x, 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 "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 \(\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.
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 \le m_1 \le \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 \le m_1 \le \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.
William's test bases on a order restriction:
$$ \mu_i^{*} = \max_{1\le u \le i}~\min_{i \le v \le m}~ \sum_{j=u}^v n_j \bar{x}_j^{*} ~/~ \sum_{j=u}^v n_j \qquad (1 \le i \le m), $$
where \(\bar{x}_j^*\) denotes the \(j\)-th isotonic mean estimated with isotonic regression using the pool adjacent violators algorithm (PAVA) with the vector of means \(\left\{\bar{x}_1, \bar{x}_2, \ldots, \bar{x}_m\right\}^T\) and the vector of weights \(\left\{n_1, n_2, \ldots, n_m\right\}^T\).
For the alternative hypothesis of decreasing trend, max and min are interchanged in the above Equation.
The \(i\)-the test statistic is calculated as follows:
$$ \bar{t}_i = \frac{\mu_m^* - \bar{x}_0}{s_{\mathrm{E}} \sqrt{1/n_m - 1/n_0}} $$
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