This is an excercise from "Testing statistical hypotheses" (Lehmann & Romano).
Let $\mathcal{X}$ be a sample space, $T$ a test statistic and G be a finite group of transformations (with $M$ elements) from $\mathcal{X}$ onto itself. Under the null-hypothesis the distribution of the random variable $X$ is invariant under the transformations in G. Let $$\hat{p}= \frac{1}{M}\sum_{g \in G}I_{\{T(gX) \geq T(X) \} }.$$ Show that $P(\hat{p} \leq u ) \leq u $ for $0 \leq u \leq 1$ under the null hypothesis.
I was thinking that $I_{\{T(gX) \geq T(X) \} }$ all have the same distribution under the null hypothesis and hence $\hat{p}$ should have a binomial distribution (is this correct?). I didn't manage to show the inequalty with this though. Does anybody know how one can prove it?
Kind regards,
Clearly, the distribution of $\hat p$ is supported by $S := \{0,\frac1M, \frac2M,\dots,1\}$. Since $$\mathrm P(\hat p\le u) = \mathrm P\Bigl(\hat p\le \frac{\lfloor M u\rfloor}M\Bigr),$$ it is enough to prove the statement for $u\in S$.
To prove the claim, we will use kind of "double counting" argument.
Let $u= \frac kM\in S$. What does $\hat p(x)\le u$ mean? It means that the value $T(x)$ is among the $k$ largest values in the orbit $O_x := \{hx, h\in G\}$ of $x$. That said, for any $x \in \mathcal X$, $$ \bigl|\{y\in O_x: \hat p(y)\le u \}\bigr|\le k. $$ (In the orbit, there are no more than $k$ values, which are among the $k$ largest. There can be less: e.g. in $\{1,1,1,2,2,2\}$ there are only $3$ values which are among the $4$ largest.) In other words, $$ \sum_{h\in G} \mathbf 1_{\hat p(hx)\le u} \le k. $$ Substitute $x=X$ and take the expectation: $$ k\ge \mathrm E\left[\sum_{h\in G} \mathbf 1_{\hat p(hX)\le u}\right] = \sum_{h\in G}\mathrm E\left[ \mathbf 1_{\hat p(hX)\le u}\right]\\ = \sum_{h\in G}\mathrm P\bigl(\hat p(hX)\le u\bigr) = \sum_{h\in G}\mathrm P\bigl(\hat p(X)\le u\bigr) = M\, \mathrm P\bigl(\hat p(X)\le u\bigr) $$ (in the penultimate equality we have used the invariance of distribution under $G$). Equivalently, $$ \mathrm P(\hat p(X)\le u) \le \frac kM =u, $$ as required.