## Definition of Hypothesis Testing

Hypothesis Testing is an inferential statistical method using sample data to solve assumptions about population parameters.

For instance, you want to test if people in New York City’s attitudes toward the new iPhone (e.g., iPhone 14) on a 7-point scale (1 = not at all, 7 = like it a lot) is equal to 4.5. You can write the following hypothesis.

- Null Hypothesis:
*H*_{0}: μ = 4.5 - Alternative hypothesis
*H*_{a}: μ ≠ 4.5

Since you do not have enough money or time to survey all the people in NYC, you just randomly choose 100 New Yorkers and ask about their attitudes.

Then, these 100 New Yorkers are the sample. You calculate the mean of the attitudes of these 100 NYKers, such mean is the sample mean.

If these 100 participants are representative of the whole population, you can use a sample mean to infer the population mean.

Thus, the fact that we use a sample to infer the population is the reason why we say hypothesis testing is an inferential statistical method.

## Non-Directional versus Directional Hypotheses

**A non-directional hypothesis** states the relation between two variables without specifying the direction.

For instance, as stated above, we can say the average attitude of New York City people toward the new Phone is equal to 4.5 or not equal to 4.5.

- Null Hypothesis:
*H*_{0}: μ = 4.5 - Alternative hypothesis
*H*_{a}: μ ≠ 4.5

**A directional hypothesis**, on the other hand, asserts the direction (either greater or smaller) in the hypothesis statement regarding the relationship between two variables.

For instance, you can hypothesize the same question mentioned above in the following format.

- Null Hypothesis:
*H*_{0}: μ < 4.5 - Alternative hypothesis
*H*_{a}: μ ≥ 4.5

## Hypothesis Testing: one-tailed versus two-tailed

### Two-tailed test

**A two-tailed test **allots half of the alpha (typically 0.05) to test the statistical significance in one direction and half of your alpha to test statistical significance in the other direction (i.e., 0.025). When using a two-tailed test, regardless of the direction of the relationship you hypothesize, you are testing for the possibility of the relationship in both directions.

For instance, the hypothesis above tests if the mean is equal to 4.5. A two-tailed test will test both if the mean is significantly greater than 4.5 and if the mean is significantly less than 4.5.

Thus, the mean is considered significantly different from 4.5 if the test statistic is in the top 2.5% or bottom 2.5% of its probability distribution, resulting in a p-value less than 0.05.

### One-tailed test

**A one-tailed test **allots all of the alpha (typically 0.05) in one direction when testing the statistical significance. Thus, you are testing the possibility of the relationship in one direction and completely disregarding the possibility of the relationship in the opposite direction.

For instance, the hypothesis above tests if the mean is equal to 4.5. A one-tailed test will test either if the mean is significantly greater than 4.5 or if the mean is significantly less than 4.5, but not both.