Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

shirleyWilliamsTest

Shirley-Williams Test


Description

Performs Shirley's nonparametric equivalent of William's test for contrasting increasing dose levels of a treatment.

Usage

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

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 two.sided

method

a character string specifying the test statistic to use. Defaults to "look-up" that uses published Table values of Williams (1972).

nperm

number of permutations for the asymptotic permutation test. Defaults to 1000. Ignored, if method = "look-up".

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

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}: θ_0 = θ_1 = … = θ_m, & \mathrm{A}_{m} = θ_0 ≤ θ_1 ≤ … θ_m, θ_0 < θ_m \\ \mathrm{H}_{m-1}: θ_0 = θ_1 = … = θ_{m-1}, & \mathrm{A}_{m-1} = θ_0 ≤ θ_1 ≤ … θ_{m-1}, θ_0 < θ_{m-1} \\ \vdots & \vdots \\ \mathrm{H}_{1}: θ_0 = θ_1, & \mathrm{A}_{1} = θ_0 < θ_1\\ \end{array}

Let R_{ij} be the rank of X_{ij}, where X_{ij} is jointly ranked from ≤ft\{1, 2, …, N \right\}, ~~ N = ∑_{i=1}^k n_i, then the test statistic is

SEE PDF

with expected variance of

SEE PDF

where N_i = n_0 + n_1 + n_2 + … + n_i and T_i the ties for the i-th comparison is given by

SEE PDF

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,α}-values as given in the tables of Williams (1972) for α = 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 β.

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.

Value

Either a list with class "osrt" or a list with class "PMCMR".

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 α = 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.

A list with class "PMCMR" containing 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

lower-triangle matrix of the estimated quantiles of the pairwise test statistics.

p.value

lower-triangle matrix of the p-values for the pairwise tests.

alternative

a character string describing the alternative hypothesis.

p.adjust.method

a character string describing the method for p-value adjustment.

model

a data frame of the input data.

dist

a string that denotes the test distribution.

Note

For method = "look-up", only tests on the level of α = 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.

References

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.

See Also

Examples

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

PMCMRplus

Calculate Pairwise Multiple Comparisons of Mean Rank Sums Extended

v1.9.0
GPL (>= 3)
Authors
Thorsten Pohlert [aut, cre] (<https://orcid.org/0000-0003-3855-3025>)
Initial release
2021-01-12

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.