3
$\begingroup$

I'm trying to do an exact paired permutation test. What does this "mapping" mean?

> library(exactRankTests)
> perm.test(rnorm(10), rnorm(10), paired=TRUE, exact=TRUE)

    1-sample Permutation Test (scores mapped into 1:m using rounded scores)

data:  rnorm(10) and rnorm(10)
T = 6, p-value = 0.1836
alternative hypothesis: true mu is not equal to 0
$\endgroup$

1 Answer 1

2
$\begingroup$

In R 1:m means $1, \ldots, m$ (the natural numbers between 1 and $m$). Here is what the help page of perm.test says.

If real values x or y are passed to this function the following applies: if exact is true (i.e. the sample size is less than 50 observations) and tol is not given, the scores are mapped into $\{1, . . . , N\}$, see pperm for the details. Otherwise the p-values are computed using tol. If the sample size exceeds $50$ observations, the usual normal approximation is used.

So here, the package is just a little verbose and says that it has used the first option, not the second. What is taking place is explained in the help page of pperm as it says. You can also see it online there (click on dperm in the topics).

Briefly, the package uses the Streitberg-Röhmel shift algorithm to compute the distribution of the sum of the scores. Since the algorithm assumes that scores are positive integers, real numbers need to be transformed. Here, $x_1, \ldots, x_m$ are transformed to

$$\lfloor x_i \frac{m}{M}\rfloor,$$

where $M = \max(x_1, \ldots, x_m)$. The distribution of the sum of these scores is computed and compared to the transformed score of the sample.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.