Given N replications of k different treatments/conditions, tests whether the median ordinal ranks \(m_i\) of the treatments are identical $$m_1 = m_2 = \ldots = m_k$$ against the alternative hypothesis $$m_1 \leq m_2 \leq \ldots \leq m_k$$ where at least one of the inequalities is a strict inequality (Siegel and Castellan 1988, p.184). Given that even a single point change in the distribution of ranks across conditions represents evidence against the null hypothesis, the Page test is simply a test for some ordered differences in ranks, but not a 'trend test' in any meaningful way (see also the Page test tutorial).

page.test(data, verbose = TRUE)

page.L(data, verbose = TRUE, ties.method = "average")

page.compute.exact(k, N, L)

Arguments

data

a matrix with the different conditions along its k columns and the N replications along rows. Conversion of the data to ordinal ranks is taken care of internally.

verbose

whether to print the final rankings based on which the L statistic is computed

ties.method

how to resolve tied ranks. Passed on to rank, should be left on "average" (the default).

k

number of conditions/generations

N

number of replications/chains

L

value of the Page L statistic

Value

page.test returns a list of class pagetest (and htest) containing the following elements:

statistic

value of the L statistic for the data set

parameter

a named vector specifying the number of conditions (k) and replications (N) of the data (which is the number of columns and rows of the data set, respectively)

p.value

significance level

p.type

whether the computed p-value is "exact" or "approximate"

Details

Tests the given matrix for monotonically increasing ranks across k linearly ordered conditions (along columns) based on N replications (along rows). To test for monotonically decreasing ranks, either reverse the order of columns, or simply invert the rank ordering by calling - on the entire dataset.

Exact p-values are computed for k up to 22, using the pre-computed null distributions from the pspearman package. For larger k, p-values are computed based on a Normal distribution approximation (Siegel and Castellan, 1988).

Functions

  • page.test: See above.

  • page.L: Calculate Page's L statistic for the given dataset.

  • page.compute.exact: Calculate exact significance levels of the Page L statistic. Returns a single numeric indicating the null probability of the Page statistic with the given k, N being greater or equal than the given L.

References

Siegel, S., and N. J. Castellan, Jr. (1988). Nonparametric Statistics for the Behavioral Sciences. McGraw-Hill.

See also

Examples

# exact p value computation for N=4, k=4 page.test(t(replicate(4, sample(4))))
#> Ranking used: #> [,1] [,2] [,3] [,4] #> N=1 2 4 3 1 #> N=2 3 4 2 1 #> N=3 1 4 3 2 #> N=4 4 2 1 3
#> #> Page test of monotonicity of ranks #> #> data: t(replicate(4, sample(4))) #> L = 93, k = 4, N = 4, p-value = 0.8992 #> alternative hypothesis: at least one difference in ranks #>
# exact p value computation for N=4, k=10 page.test(t(replicate(4, sample(10))))
#> Ranking used: #> [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] #> N=1 6 2 1 3 10 7 5 8 4 9 #> N=2 3 7 8 4 2 10 9 6 1 5 #> N=3 2 7 1 4 5 6 3 8 9 10 #> N=4 9 10 8 2 3 1 5 6 7 4
#> #> Page test of monotonicity of ranks #> #> data: t(replicate(4, sample(10))) #> L = 1269, k = 10, N = 4, p-value = 0.146 #> alternative hypothesis: at least one difference in ranks #>
# approximate p value computation for N=4, k=23 result <- page.test(t(replicate(4, sample(23))), verbose = FALSE)
#> Exact p value is not available for k=23, using Normal approximation.
print(result)
#> #> Page test of monotonicity of ranks #> #> data: t(replicate(4, sample(23))) #> L = 12581, k = 23, N = 4, p-value = 0.9389 #> alternative hypothesis: at least one difference in ranks #>
# raw calculation of the significance levels page.compute.exact(6, 4, 322)
#> [1] 0.03932265