### Introduction

Here we consider, in greater detail, the potential perils of defining hypotheses to test after examining and plotting the data. Abstractly, consider the case where an analyst, for an arbitrary multivariate dataset, does the following:

- plots the data
- examines the data to identify interesting features
- manually chooses a statistical procedure to test whether said features are significant

Below we argue that such an approach leads to a situation where we reject an excessive number of tests.

### Testing hand-picked hypotheses

One problem is that the values of the hypotheses must be real numbers and not random variables. To see that, let us consider a procedure to test an hypothesis and let us define:

Let `$\mathbf{X}$`

be the random vector we observe and let `$G(\mathbf{X})$`

be the test statistic. See Upton and Cook (2003, page 165) for vocabulary about hypothesis testing. For a given `$\alpha \in [0,1]$`

, let also `$\Theta_{\alpha}$`

be the rejection region of this test. We then have:

A random variable `$A$`

is a function from a set `$\Omega$`

to `$\mathbb{R}$`

. See for example Ash and Doléans-Dade (2000, page 173). When we observe `$A$`

, we actually observe `$A(\omega)$`

where `$\omega$`

is an unknown element of `$\Omega$`

. That is why we call `$\mathbf{X}(\omega)$`

the observed value of `$\mathbf{X}$`

and `$G(\mathbf{X}(\omega))$`

, the observed test statistic.

If we observed `$G(\mathbf{X}(\omega)) \in \Theta_{\alpha}$`

and if `$\alpha$`

is small enough, then either we are very unlucky (incorrectly reject the null hypothesis), or

### Testing hypotheses after looking at the data

Assume now that we have several available statistical tests and then several null hypotheses `$H^{(1)}_0, \ldots, H^{(n)}_0$`

. We redefine `$\mathcal{H}$`

using the `$i$th`

hypothesis.

The reasoning presented above still holds. But if we choose a statistical test after looking at the data then this is like using `$\mathcal{H}^{\star}(\omega)$`

instead of `$\mathcal{H}$`

with

Since the index `$j(\mathbf{X}(\omega))$`

is a function of `$\omega$`

and after checking some theoretical details, we have that `$j(\mathbf{X})$`

is a random variable and so is `$\mathcal{H}^{\star}$`

. However, to apply the framework of hypothesis testing, we needed `$\mathcal{H}$`

to be a real number. People may argue that real numbers can be seen as random variables but we often can not prove that `$\mathcal{H}^{\star}$`

corresponds to that special case. An example of `$\mathcal{H}^{\star}$`

which is not a real number is presented in the next section.

### Example

Let `$\mathbf{X}$`

be a single random variable generated from a continuous uniform law. We write `$\mathbf{X} \sim \mathcal{U}(a,b)$`

and we want to know if `$a = 0$`

and `$b = 10$`

. We have `$n = 10$`

statistical tests and for all these tests, the null hypothesis is:

For all tests `$i$`

, the test statistic is:

and the rejection region is

For example, for `$\alpha = 0.05$`

and `$i = 1$`

, we have a rejection region of `$[0.25, 0.75)$`

, and our test statistic will (naturally) fall in this range `$5$`

percent of the time under the null hypothesis.
We can verify that for all `$i$`

,

Let us choose `$\alpha = 0.1$`

. If we choose a test after looking at the data, and if we really want to reject the null hypothesis, we will choose the test such that our observation is in the rejection region. We then define

so that for example:

since `$\alpha = 0.1$`

. We then observe that for all `$\omega \in \Omega$`

such that `$\mathbf{X}(\omega) \in [0, 10)$`

, we have

and we reject `$H^{j(\mathbf{X}(\omega))}_0$`

. This means that if `$\mathbf{X} \sim \mathcal{U}(0, 10)$`

, the probability to reject `$H^{j(\mathbf{X})}_0$`

is equal to `$1$`

. As a consequence, if we consider that the reasoning made for `$\mathcal{H}$`

is also true for `$\mathcal{H}^{\star}$`

, then if `$a = 0$`

and `$b=10$`

, the probability to reject the hypothesis that `$a = 0$`

and `$b=10$`

is equal to `$1$`

, and this testing procedure is useless.

### Conclusion

I recommend that statisticians build their procedure to determine if a model is appropriate for a data-set before receiving this data-set. If they already have the data-set, I recommend asking another person to create the testing procedure after telling him or her only what is the model.

**References**

R. B. Ash and C. Doléans-Dade. Probability and Measure Theory. Harcourt/Academic Press, Burlington, United States of America, 2nd edition, 2000.

G. Upton and I. Cook. A dictionary of statistics. Oxford University Press, Oxford, United Kingdom, 2nd edition, 2004.