# One-tailed z-test

In the first article about z-test, we showed how the two-tailed test works. It is also possible to construct an one-tailed test. The one-tailed test differs with a sign of alternative hypothesis. The two-tail test had the inequality sign ($\neq$) in the alternative hypothesis formula. For an one-tailed test, there are two options:

• left-tailed test which has less than ($<$) sign,
• right-tailed test which has greater than ($>$) sign.

The formula for the test statistics stay the same, whereas the critical region is now different. It lays only in one side of the $x$ axis. More specifically, the whole critical region is in the left side for the left-tailed test or in the right side for the right-tailed test (pretty straightforward if you ask me). The computation of the p-value also changes.

## Left-tailed test

Let’s start with the left-tailed test. Our assignment stays with a small modification. We will assume that the machine does not allow to set the length of the component to more than 190 mm, it can be set to shorter length though. So we only need to check if the components are in average shorter, or not. We now have a new set of 20 observations.

As we said, the null hypothesis stays and the alternative has $<$ sign, so:

• $H_0: \mu_0 = 190$ ,
• $H_1: \mu_0 < 190$ .

The critical region consists only of one part now, as you can see at the figure below. Because the area under the probability density function must still equal to the significance level, the border values are closer to zero. You can compare the figure with the figure for two-tailed test.

The formula for the critical region is

$W = ( - \infty, u_{\alpha} \rangle \, .$

Please note that $\alpha$ is not divided by 2. We will keep the level of significance on 5 % so the critical region for our example is

$W = ( - \infty, - 1.6449 \rangle \, .$

We can get the value – 1.6449 from a statistical table. Please note we use the value for 0.95 because the normal distribution is symmetric. We only add the minus sign.

The value of the statistics is:

$Z = \frac{ \bar{x} - \mu_0}{\sigma} \cdot \sqrt{n} = \frac{189.61 - 190}{0.9} \cdot \sqrt{20} = -1.9497$

and it lies in the critical region so we reject the null hypothesis for $\alpha = 5 %$. The conclusion of the test is that the expected value of the length of the component is lower than 190 mm, i.e. the machine was set incorrectly.

## Right-tailed test

Now we will go through the last variant which is called right-tailed test. We will work with the same example with a one modification: We assume the machine could not be set to produce shorter components than 190 mm but it set be by mistake set to produce longer one. We will use a new sample of data.

The new hypotheses are:

• $H_0: \mu_0 = 190$ ,
• $H_1: \mu_0 > 190$ .

It is not surprising that the critical region now lies in the right part of the x axis.

The formula for the critical region is

$W = \langle u_{1 - \alpha}, \infty) \, ,$

and if we stay on $\alpha = 5 %$ we get

$W = \langle 1.6449, \infty) \, .$

The value of the statistics is now

$Z = \frac{ \bar{x} - \mu_0}{\sigma} \cdot \sqrt{n} = \frac{189.95 - 190}{0.9} \cdot \sqrt{20} = -0.2269$

and it does not lies in the critical region so we do not reject the null hypothesis for $\alpha = 5 %$.