Calculates the randomization test. Further discussion can be found in chapter 15 of Lehmann and Romano (2005, p 633). Consider data \(X\) taking values in a sample space \(\Omega\). Let \(\mathbf{G}\) be a finite group of transformations from \(\Omega\) onto itself, with \(M=\vert \mathbf{G}\vert\). Let \(T(X)\) be a real-valued test statistic such that large values provide evidence against the null hypothesis. Denote by $$T^{(1)}(X)\le T^{(2)}(X)\le\dots\le T^{(M)}(X)$$ the ordered values of \(\{T(gX)\,:\,g\in\mathbf{G}\}\). Let \(k=M-\lfloor M\alpha\rfloor\) and define \(M^{+}(x)\) and \(M^{0}(x)\) be the number of values \(T^{(j)}(X)\), \(j=1,\dots,M\), which are greater than \(T^{(k)}(X)\) and equal to \(T^{(k)}(X)\) respectively. Set $$a(X)=\frac{\alpha M-M^{+}(X)}{M^{0}(X)}~.$$ The randomization test is given by $$\phi(X)=1\{T(x)> T^{(k)}(X)\}+a(X)\times 1\{T(X)= T^{(k)}(X)\}~.$$
randomization.test(Tn, Tng, alpha = 0.05)
Numeric. A vector containing \(\phi(X)\in\{0,1\}\) and \(T^{(k)}(X)\). The test rejects the null hypothesis if \(\phi(X)=1\), and does not reject otherwise.
Numeric. A scalar representing the observed test statistic \(T(X)\).
Numeric. A vector containing \(\{T(gX)\,:\,g\in\mathbf{G}\}\).
Numeric. Nominal level for the test. The default is 0.05.
Maurcio Olivares
Ignacio Sarmiento Barbieri
Lehmann, Erich L. and Romano, Joseph P (2005) Testing statistical hypotheses.Springer Science & Business Media.