Different Tails in Hypothesis Testing

, محدث •0•0Comment iconComment iconComment iconComment icon

Left- and right-tailed tests and two-tailed tests: how to choose the tail, build the critical region and decide, with worked examples and exercises.

Writer image

تمت الترجمة بواسطةEditorial

Writer image

تمت المراجعة بواسطةEditorial

تحرير المادة

Building a hypothesis test for a population parameter can be described as follows. There is a variable X associated with a population, and we have a hypothesis about a parameter θ of that population; for example, we claim that the true value of θ is 20. We draw a random sample from this population and, with it, we want to check whether the data contradict that hypothesis or not.

As we have seen before, we start by stating clearly which hypothesis we are putting to the test. It is called the null hypothesis and is written like this:

H0: θ = 20

Next, it is useful to also state which hypothesis will be considered acceptable if H0 is rejected. It is called the alternative hypothesis, and its form depends on what is known about the problem. The most general alternative is:

H1: θ ≠ 20

But we can also have alternatives of the form

H1: θ < 20 or H1: θ > 20

depending on the information the problem provides.

Whatever decision is made, we are subject to making errors. To simplify the language, we use the definitions:

Type I error: rejecting the null hypothesis when it is true. P(type I error) = P(reject H0 | H0 true) = α.

Type II error: not rejecting H0 when H0 is false. P(type II error) = P(do not reject H0 | H0 false) = β.

The goal of the test is to say whether hypothesis H0 is acceptable or not. In practice, this decision is made with a critical region (CR), also called the rejection region: if the observed value of the test statistic falls in this region, we reject H0; otherwise, we do not reject H0. The region is built so that the probability of rejecting H0 when it is true (the type I error) equals a value defined before looking at the data. An important fact: the critical region is always built assuming H0 is true. The type II error, in turn, is harder to calculate, because we generally do not fix a value for the parameter under the alternative hypothesis.

The probability of making a type I error (or error of the first kind) is chosen by whoever runs the test and is called the significance level, α. The smaller α is, the stronger the sample's evidence must be to reject H0: a result that rejects H0 at 1% is more significant than one that only rejects at 5%. The most common values are 5%, 1% and 0.1%.

What does it mean to run a test at a 5% significance level?

Loading icon

Answer: That, if H0 is true, there is a 5% chance of rejecting it by mistake — α is the probability of a type I error, calculated assuming H0 is true. It is not the probability that H0 is true, which the classical test does not calculate.

Steps for building a hypothesis test

The sequence below can be used systematically in any hypothesis test.

  1. Set the hypothesis H0 to be tested and the alternative hypothesis H1.
  2. Use statistical theory and the available information to decide which statistic (estimator) will be used to test H0, and obtain its properties (distribution, mean, standard deviation).
  3. Set the probability α of making a type I error and use this value to build the critical region (decision rule). This region is built for the statistic from step 2, using the parameter value given by H0.
  4. Use the sample observations to calculate the value of the test statistic.
  5. If the calculated value does not belong to the critical region, do not reject H0; otherwise, reject H0.

Whenever we run a hypothesis test, we will clearly distinguish these five steps. Finally, a comment about H0 and the type I error: we should take as H0 the hypothesis whose wrongful rejection leads to the type I error that is most important to avoid.

Let's look at an example due to Neyman (1978). Suppose an experiment to determine whether a product A is carcinogenic or not. After the test, we can conclude: (i) A is carcinogenic or (ii) A is not carcinogenic. Each conclusion may be wrong, and we have the two types of error already mentioned, depending on which hypothesis is H0. From the product user's point of view, the hypothesis to be tested should be:

H0: A is carcinogenic

because the probability of rejecting this hypothesis when it is true, that is, of releasing a carcinogenic product, must be very small.

Number of tails

There are 3 types of tests, depending on the alternative hypothesis. In tests for the mean with known variance, the statistic is z = (x̄ − μ0)/(σ/√n), and the critical value zα is the point of the standard normal that leaves α above it (z5% = 1.645, z2.5% = 1.96, z1% = 2.326, z0.5% = 2.576).

One-sided (one-tailed) to the left

H0: μ = μ0
H1: μ < μ0

H0 is rejected if zcalc < −zα. All of α is in the left tail.

One-sided (one-tailed) to the right

H0: μ = μ0
H1: μ > μ0

H0 is rejected if zcalc > zα. All of α is in the right tail.

Two-sided (two-tailed)

H0: μ = μ0
H1: μ ≠ μ0

H0 is rejected if |zcalc| > zα/2, that is, if zcalc < −zα/2 or zcalc > zα/2. α is split into two halves, one in each tail.

The choice of tail must be made before seeing the data, based on the question being asked. Choosing it after seeing which way the sample fell in practice doubles the type I error.

A company guarantees that its repellent lasts at least 400 hours, and you suspect it lasts less. Which test should you run?

Loading icon

Answer: Left-tailed, H1: μ less than 400 — the suspicion has a definite direction, lasting less than promised. A mean above 400 does not contradict the company, so all of α goes to the left tail.

In a test with α = 5%, the calculated value was z = 1.80. What is the decision in the right-tailed test and in the two-tailed test?

Loading icon

Answer: Reject H0 in the one-tailed test and do not reject in the two-tailed test — in the one-tailed test the critical value is 1.645 and 1.80 exceeds it; in the two-tailed test it is 1.96 and 1.80 does not reach it. With all of α in a single tail, the one-tailed test rejects more easily in that direction.

Tests on the mean of a population with known variance

Let's now apply the five steps to test the hypothesis that the mean μ of a population equals a fixed number μ0, assuming the population variance σ² is known.

Example 1: the coffee machine

An automatic machine fills coffee packets according to a normal distribution, with mean μ and variance always equal to 400 g². The machine was set to μ = 500 g. Periodically, we take a sample of 16 packets to check whether production is under control, that is, whether μ = 500 g or not. If one of these samples had a mean of 492 g, would you stop production to adjust the machine, at a 1% significance level?

Step 1. The hypotheses of interest are H0: μ = 500 g and H1: μ ≠ 500 g, because the machine can go out of adjustment upwards or downwards.

Step 2. Under H0, the sample mean x̄ is normal with mean 500 g and standard deviation √(400/16) = √25 = 5 g.

Step 3. From the alternative hypothesis, H0 should be rejected when x̄ is very small or very large: it is a two-tailed test, with 0.5% probability in each tail (z0.5% = 2.576).

First point of the CR: x̄1 = 500 − 2.576 × 5 = 487.1

Second point: x̄2 = 500 + 2.576 × 5 = 512.9

The critical region is therefore: CR = {x̄ < 487.1 or x̄ > 512.9}.

Step 4. The relevant information from the sample is its mean, which in this case is x̄ = 492 (equivalent to z = (492 − 500)/5 = −1.6).

Step 5. Since x̄ does not belong to the critical region, we do not reject H0 and do not stop production. The difference between the sample mean and the mean under H0 can be attributed simply to the random selection of the packets.

Example 2: the ceramic mass

In the ceramics industry, the strength of ceramic mass samples is routinely assessed after firing. A certain type of mass is known to have approximately normal mechanical strength, with mean 53 MPa and variance 16 MPa². After some raw material suppliers were changed, the company wants to check whether quality has changed. A sample of 15 test specimens showed a mean of 50 MPa. What is the conclusion at the 5% significance level?

Step 1. We run a two-tailed test, because before observing the sample we did not know whether the strength would be higher or lower than 53: H0: μ = 53 and H1: μ ≠ 53.

Step 2. Under H0, x̄ is normal with mean 53 and standard deviation 4/√15 = 1.033 (the population standard deviation is √16 = 4).

Step 3. Since the test is two-tailed, there is 2.5% in each tail, and the critical region is |z| > 1.96.

Step 4. z = (50 − 53)/(4/√15) = −2.90.

Step 5. Since −2.90 < −1.96, the value is in the critical region and we reject H0. Another way to see it: the probability of a sample having a mean of 50 or less, if μ were 53, is P(Z < −2.90) = 0.18%, much smaller than the 2.5% of the tail; the two-tailed p-value is 2 × 0.18% = 0.37%, much smaller than 5%. We conclude that changing suppliers altered (reduced) the mass's mean strength.

The image below plays with the same reasoning. If the survival rate of surgery with this doctor really were 50%, the chance of the last 20 patients all surviving would be 0.5^20, about 1 in 1 million. The scientist rejects this null hypothesis: everything suggests this doctor has a much higher rate than average.

Would you have surgery with this doctor?
Would you have surgery with this doctor?

For the coffee machine (standard deviation of the mean = 5 g, two-tailed test at 1%, critical region below 487.1 or above 512.9), a new sample has a mean of 486 g. What should you do?

Loading icon

Answer: Stop and adjust the machine, because z = −2.8 is in the critical region — z = (486 − 500)/5 = −2.8, which is below −2.576. Being close to 500 in percentage terms does not matter: what decides is the distance in standard deviations of the sample mean.

Exercises

1) A cigarette company advertises that the average nicotine content of its cigarettes is at the recommended level of 23 mg per cigarette. A laboratory performs six analyses of this content and obtains: 27, 24, 21, 25, 26, 22. Nicotine content is known to be normally distributed with variance equal to 4 mg². Can the manufacturer's claim be accepted at the 10% level?

2) A consumer of a certain product accused the manufacturer, saying that more than 20% of the units produced are defective. To confirm the accusation, he used a sample of size 50, in which 27% of the parts were defective. Show how the manufacturer could refute the accusation. Use a 10% significance level. (Standard deviation = √(p · (1 − p)).)

3) A manufacturer guarantees that 90% of the equipment it supplies to a factory meets the specifications. Examination of a sample of 200 parts revealed 25 defective ones. Test the manufacturer's claim at the 5% and 1% levels. (Standard deviation = √(p · (1 − p)).)

4) The tensile strength of stainless steel produced at a certain mill remained stable, with a mean of 72 kg/mm² and a standard deviation of 2.0 kg/mm², normally distributed. Recently the machine was adjusted. To determine the effect of the adjustment, 10 samples were tested, with a mean strength of 75 kg/mm². Assume the standard deviation has not changed. At a 5% significance level, can we state that the mean value has not changed?

5) The DeBug Company sells an insect repellent that it claims is effective for at least 400 hours. An analysis of nine randomly chosen items gave a mean of 380 hours. Test the company's claim against the alternative that the duration is less than 400 hours, at the 1% significance level, given that the population standard deviation is 60 hours (assume a normal distribution).

6) A buyer, on receiving a large lot of parts from a supplier, decided to inspect 200 of them. He also decided that the lot will be rejected if he is convinced, at the 5% significance level, that the proportion of defective parts in the lot is greater than 4%. What will his decision be (accept or reject the lot) if eleven defective parts are found in the sample? (Standard deviation = √(p · (1 − p)).)

7) Same situation as exercise 6, but now 14 defective parts were found in the sample of 200. What is the decision? (Standard deviation = √(p · (1 − p)).)

Answer key

1) Sample mean = 24.17; z = (24.17 − 23)/(2/√6) = 1.43. Two-tailed test at 10%: critical value 1.645. Since 1.43 < 1.645, the null hypothesis is not rejected: the manufacturer's claim can be accepted.

2) H0: p = 0.20 versus H1: p > 0.20 (right-tailed). Standard deviation of p̂ = √(0.2 × 0.8/50) = 0.0566. The accusation would only be accepted (H0 rejected) if the sample proportion exceeded 0.20 + 1.28 × 0.0566 = 27.24%. Since 27% is below that (z = 1.24 < 1.28), the manufacturer can refute the accusation: at the 10% level, there is no evidence that more than 20% are defective.

3) H0: p = 0.90 versus H1: p < 0.90. Conforming proportion in the sample = 175/200 = 0.875; z = (0.875 − 0.90)/√(0.9 × 0.1/200) = −1.18. It does not go beyond −1.645 (5%) or −2.326 (1%): at neither level can the null hypothesis be rejected.

4) z = (75 − 72)/(2/√10) = 4.74 > 1.96: H0 is rejected, that is, we cannot state that the mean has not changed.

5) z = (380 − 400)/(60/√9) = −1.0, greater than −2.326: the null hypothesis cannot be rejected.

6) p̂ = 11/200 = 0.055; z = (0.055 − 0.04)/√(0.04 × 0.96/200) = 1.08 < 1.645: the null hypothesis cannot be rejected, and the lot is accepted.

7) p̂ = 14/200 = 0.07; z = 2.17 > 1.645: the null hypothesis is rejected, and the lot is rejected.

ما رأيك في هذا المقال؟

0%
تقييم المستخدمين (0)

شارك هذا المقال!