williamsTest: Williams Trend Test

View source: R/williamsTest.R

williamsTestR Documentation

Williams Trend Test

Description

Performs Williams' test for contrasting increasing (decreasing) dose levels of a treatment.

Usage

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"), ...)

Arguments

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 "x". Ignored with a warning if "x" is a list.

alternative

the alternative hypothesis. Defaults to greater

formula

a formula of the form response ~ group where response gives the data values and group a vector or factor of the corresponding groups.

data

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).

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 NAs. Defaults to getOption("na.action").

Details

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 ith 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).

Value

A list with class "osrt" that contains the following components:

method

a character string indicating what type of test was performed.

data.name

a character string giving the name(s) of the data.

statistic

the estimated statistic(s)

crit.value

critical values for \alpha = 0.05.

alternative

a character string describing the alternative hypothesis.

parameter

the parameter(s) of the test distribution.

dist

a string that denotes the test distribution.

There are print and summary methods available.

Source

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 http://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.

Note

In the current implementation, only tests on the level of \alpha = 0.05 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, 1 \le n_0 / n_i \le 6 for 1 \le i \le m.

References

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.

See Also

TDist, approx, print.osrt, summary.osrt

Examples

## 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)


PMCMRplus documentation built on May 29, 2024, 8:34 a.m.