P-value function: combined Stephenson rank test of the sharp null
pStephensonQuad.RdTests the sharp null of no effect with several Stephenson rank statistics
at once. For each tuning parameter in zeta the function scores every
unit by stephenson_scores within its block, forms the
treated sum of scores summed over blocks, and combines the resulting
statistics by the quadratic form of Strasser and Weber (1999) in
coin::independence_test(), referred to a chi-square distribution
with one degree of freedom per tuning parameter. This is the test the
block_test_power paper calls the combined Stephenson test, and it lets an
analyst use several values of \(\zeta\) without choosing among them.
Usage
pStephensonQuad(
dat,
fmla = Y ~ trtF | blockF,
zeta = c(2, 6, 10),
simthresh = 20,
sims = 1000,
parallel = "no",
ncpu = NULL
)Arguments
- dat
A data.table with the outcome, treatment, and block columns.
- fmla
A formula,
outcome ~ treatment | blockoroutcome ~ treatmentwhen the scores are to be computed over the whole sample.- zeta
Integer tuning parameters, one statistic each. The paper uses
c(2, 6, 10).- simthresh
The number of rows at or below which the permutation reference replaces the chi-square reference.
- sims
The number of resampled assignments for the permutation reference.
- parallel
Passed to
coin::approximate():"no","multicore", or"snow".- ncpu
Number of cpus for the permutation reference when
parallelis not"no".
Details
The scores are signed, so block-level contributions of opposite sign
cancel in the sum: the test has power when effects push the same way in
every block and little when they reverse sign across blocks. The
distance-based tests pIndepDist and
pCombCauchyDist are the ones for that case.
This is not pCombStephenson, which wraps the CMRSS
quantile-of-effects procedure with polynomial scores and an optimizer.
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.
Strasser, H. and Weber, C. (1999). On the asymptotic theory of permutation statistics. Mathematical Methods of Statistics 8(2), 220–250.
Examples
data(example_dat, package = "manytestsr")
library(data.table)
idat <- as.data.table(example_dat)
pStephensonQuad(idat, Y1 ~ trtF | blockF)
#> [1] 0.1059222
pStephensonQuad(idat, Y1 ~ trtF | blockF, zeta = 2)
#> [1] 0.03662658