Skip to contents

Gives each unit the score \(\binom{r - 1}{\zeta - 1}\), where \(r\) is the unit's rank within the block from 1 for the smallest outcome, and \(\zeta\) is the tuning parameter. The score counts the subsets of \(\zeta\) units in the block in which this unit has the largest outcome. With \(\zeta = 2\) it is \(r - 1\), the Wilcoxon score up to a constant; as \(\zeta\) grows only the highest-ranked units score at all.

Usage

stephenson_scores(y, zeta)

Arguments

y

Numeric outcomes for the units of one block.

zeta

A single tuning parameter, an integer of at least 1.

Value

A numeric vector of scores in the order of y.

Details

Tied outcomes receive the average of the ranks they span, and the binomial coefficient is then evaluated by R's choose() at a non-integer first argument, which is the product \((r-1)(r-2)\cdots(r-\zeta+1)/(\zeta-1)!\) and can be negative for a tied rank between \(\zeta - 1\) and \(\zeta\).

References

Stephenson, W. R. (1981). A general class of one-sample nonparametric test statistics based on subsamples. Journal of the American Statistical Association 76(374), 450–456.

Examples

stephenson_scores(c(0.3, -1.2, 2.5, 0.9, -0.4), zeta = 2)
#> [1] 2 0 4 3 1
stephenson_scores(seq_len(50), zeta = 10)[c(9, 10, 50)]
#> [1]          0          1 2054455634