# One tailed or two tailed situation [duplicate]

I understand that there is a lot of similar questions, but I can't grasp on when to use a one tailed or two tailed test when reading a example such as the one below:

We suspect that test driven development is better than writing tests afterwards, i.e. results in fewer faults in the system we are looking at. Is this a one tailed or a two tailed situation? How do these two differ?

I understand that two tailed can test both if the mean is greater or less than X and that one tail only test if its less or greater than X and not both. So is one tail testing the best one?

## marked as duplicate by Carl, kjetil b halvorsen, mdewey, Peter Flom - Reinstate Monica♦Nov 8 '18 at 12:29

There is an important litterature on this point. This paper (When should we use one-tailed hypothesis testing?, http://onlinelibrary.wiley.com/doi/10.1111/j.2041-210X.2010.00014.x/pdf) is simple and basically says that (in agreement with several others):

adoption of one-tailed testing requires an explanation why the authors would treat a large observed difference in the unexpected direction no differently from a difference in the expected direction that was not strong enough to justify rejection of the null hypothesis.

In other words, you cannot use one-tail test if you are only interested in difference in one direction but only if you are convinced that difference in the other direction is "irrelevant" in a certain sense.

For example, if you suspect that a given parameter is superior to 0, you cannot simply use a one-tail test. However if phyisically, this parameter cannot be negative (let's say that you measure a kinetic energy which is by definition positive) then you have the "right" to use one tail tests as measuring a large difference in the negative direction is just irrelevant with the current physics.

Another example : suppose you have some water samples in which some are added a solution that is known to increase the magnetic property of the sample. You want to test for each sample if the magnetic property is increased or not to test the presence of the solution. In such a case, I would say that you can use a one tail test because physically having a descrease of the magnetic propery is irrelevant and can only be interpreted as measurement errors (at the current state of knowledge).

I also suggest this paper (http://www.bio.sdsu.edu/pub/stuart/2009MisprescriptionOneTailed.pdf) that contains tons of reference.

To conclude, I would said that, according to these recommendations, in your case a two tailed test is needed.

Yes, one tail testing is better. The null hypothesis is that test driven development has no effect on the number of faults in your system. Your alternative hypothesis is that it decreases the number of faults in your system. Use a one tailed test. If you cannot reject your null hypothesis, in favor of your alternative hypothesis and you see that the average number of faults in your system appears to actually have increased, you can follow up with a two tailed test, with alpha correction and interpretation (explanation).

The one tail test alternative hypothesis is: the mean of the group A is > (or <) the mean of the group B.

The two tail test alternative hypothesis is different and is: the mean of the group A is different from the mean of the group B. Knowing the mean of the two groups you can say if this is bigger or smaller.

The problem you ask seems related to a one tailed test, but you can also use a two tail test and then compare the means. Do you want to investigate if there are differences between the two groups and eventually see if the mean is bigger or smaller? Use the two tail test. Do you want to investigate if the mean of the A group is > and only > (or < if in the opposite case) to the mean of the group B? Use the one tail test.

• “Do you want to investigate if the mean of the A group is > and only > ... to the mean of B” is insufficient to justify a 1-tailed test to me. In this case it is possible for A or B to be better so I would think a 2-tailed test most appropriate. – waferthin Oct 17 at 2:15