TestRankhist: Statistical tests for rank histograms

Description Usage Arguments Details Value References See Also Examples

View source: R/TestRankhist.R

Description

Perform statistical tests related to the deviation from flatness of a rank histogram.

Usage

1
TestRankhist(rank.hist)

Arguments

rank.hist

Vector of rank counts. Generated by function 'Rankhist()'

Details

Given a vector of rank counts 'x', the Pearson Chi^2 statistic is calculated by

sum((x - sum(x)/length(x))^2 / (sum(x)/length(x)))

and has a chi^2 distribution with (length(x)-1) degrees of freedom if every rank is equally likely on average. The Jolliffe-Primo test statistics are calculated by projecting the vector

(x-sum(x)/length(x)) / sqrt(sum(x)/length(x))

onto a linear, respectively squared contrast, i.e. a linear and quadratic function defined over the index set 1:length(x), who are mutually orthogonal, whose elements sum to zero, and whose squared elements sum to one. The projections independently have chi^2 distributions with 1 degree of freedom under the null hypothesis of a flat rank histogram.

Value

A dataframe whose columns refer to the Pearson Chi^2 statistic, the Jolliffe-Primo test statistic for slope, and the Jolliffe-Primo test statistic for convexity. The rows refer to the actual test statistic and its p-value under the null hypothesis of a flat rank histogram.

References

Pearson K. (1900): X. On the criterion that a given system of deviations from the probable in the case of a correlated system of variables is such that it can be reasonably supposed to have arisen from random sampling. Phil. Mag. Series 5, 50(302) doi: 10.1080/14786440009463897

Jolliffe I.T., Primo C. (2008): Evaluating rank histograms using decompositions of the chi-square test statistic. Mon. Wea. Rev. 136(6) doi: 10.1175/2007MWR2219.1

See Also

Rankhist, PlotRankhist

Examples

1
2
3

Example output

               pearson.chi2     jp.lin       jp.sq
test.statistic   23.9259259 0.01139601 0.005574136
p.value           0.4658397 0.91498565 0.940485125

SpecsVerification documentation built on March 26, 2020, 7:55 p.m.