R: Exact Page Test for Ordered Alternatives

PageTest {DescTools} | R Documentation

## Exact Page Test for Ordered Alternatives

### Description

Performs a Page test for ordered alternatives using an exact algorithm by Stefan Wellek (1989) with unreplicated blocked data.

### Usage

    PageTest(y, ...)

    ## Default S3 method:
    PageTest(y, groups, blocks, ...)

    ## S3 method for class 'formula'
    PageTest(formula, data, subset, na.action, ...)

### Arguments

`y` | either a numeric vector of data values, or a data matrix.
`groups` | a vector giving the group for the corresponding elements of `y` if this is a vector; ignored if `y` is a matrix. If not a factor object, it is coerced to one.
`blocks` | a vector giving the block for the corresponding elements of `y` if this is a vector; ignored if `y` is a matrix. If not a factor object, it is coerced to one.
`formula` | a formula of the form `a ~ b | c`, where `a`, `b` and `c` give the data values and corresponding groups and blocks, respectively.
`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 `NA`s. Defaults to `getOption("na.action")`.
`...` | further arguments to be passed to or from methods.

### Details

`PageTest` can be used for analyzing unreplicated complete block designs (i.e., there is exactly one observation in `y` for each combination of levels of `groups` and `blocks`) where the normality assumption may be violated.

The null hypothesis is that apart from an effect of `blocks`, the location parameter of `y` is the same in each of the `groups`.
The implemented alternative is, that the location parameter will be monotonly greater along the groups,
H_{A}: θ_{1} ≤ θ_{2} ≤ θ_{3} ... (where at least one inequality is strict).
If the other direction is required, the order of the groups has to be reversed.
The Page test for ordered alternatives is slightly more powerful than the Friedman analysis of variance by ranks.

If `y` is a matrix, `groups` and `blocks` are obtained from the column and row indices, respectively. `NA`'s are not allowed in `groups` or `blocks`; if `y` contains `NA`'s, corresponding blocks are removed.

For small values of k (methods) or N (data objects), PageTest will calculate the exact p-values. For k, N > 15, Inf, a normal approximation is returned. Only one of these values will be returned.

### Value

A list with class `"htest"` containing the following components:

`statistic` | the L-statistic with names attribute “L”.
`p.value` | the p-value of the test.
`method` | the character string `"Page test for ordered alternatives"`.
`data.name` | a character string giving the names of the data.

### Note

Special thanks to Prof. S. Wellek for porting old GAUSS code to R.

### Author(s)

Stefan Wellek <stefan.wellek@zi-mannheim.de> (exact p-values), Andri Signorell <andri@signorell.net> (interface) (strongly based on R-Core code)

### References

Page, E. (1963): Ordered hypotheses for multiple treatments: A significance test for linear ranks. Journal of the American Statistical Association, 58, 216-230.

Siegel, S. & Castellan, N. J. Jr. (1988): Nonparametric statistics for the behavioral sciences. Boston, MA: McGraw-Hill.

Wellek, S. (1989): Computing exact p-values in Page's nonparametric test against trend. Biometrie und Informatik in Medizin und Biologie 20, 163-170

### See Also

`friedman.test`

### Examples

     # Craig's data from Siegel & Castellan, p 186
     soa.mat <- matrix(c(.797,.873,.888,.923,.942,.956,
      .794,.772,.908,.982,.946,.913,
      .838,.801,.853,.951,.883,.837,
      .815,.801,.747,.859,.887,.902), nrow=4, byrow=TRUE)
     PageTest(soa.mat)

    # Duller, pg. 236
    pers <- matrix(c(
    1, 72, 72, 71.5, 69, 70, 69.5, 68, 68, 67, 68,
    2, 83, 81, 81, 82, 82.5, 81, 79, 80.5, 80, 81,
    3, 95, 92, 91.5, 89, 89, 90.5, 89, 89, 88, 88,
    4, 71, 72, 71, 70.5, 70, 71, 71, 70, 69.5, 69,
    5, 79, 79, 78.5, 77, 77.5, 78, 77.5, 76, 76.5, 76,
    6, 80, 78.5, 78, 77, 77.5, 77, 76, 76, 75.5, 75.5
    ), nrow=6, byrow=TRUE)

    colnames(pers) <- c("person", paste("week",1:10))

    # Alternative: week10 < week9 < week8 ...
    PageTest(pers[, 11:2])

    # Sachs, pg. 464

    pers <- matrix(c(
      3,2,1,4,
      4,2,3,1,
      4,1,2,3,
      4,2,3,1,
      3,2,1,4,
      4,1,2,3,
      4,3,2,1,
      3,1,2,4,
      3,1,4,2),
      nrow=9, byrow=TRUE, dimnames=list(1:9, LETTERS[1:4]))

    # Alternative: B < C < D < A
    PageTest(pers[, c("B","C","D","A")])

    # long shape and formula interface
    plng <- data.frame(expand.grid(1:9, c("B","C","D","A")),
                       as.vector(pers[, c("B","C","D","A")]))
    colnames(plng) <- c("block","group","x")

    PageTest(plng$x, plng$group, plng$block)

    PageTest(x ~ group | block, data = plng)

    score <- matrix(c(
      3,4,6,9,
      4,3,7,8,
      3,4,4,6,
      5,6,8,9,
      4,4,9,9,
      6,7,11,10
      ), nrow=6, byrow=TRUE)

    PageTest(score)

[Package DescTools version 0.99.26 Index]