## One-Tailed And Two-Tailed Test

**When the null hypothesis is true**, the t statistic follows the **t-distribution**.

The **t-distribution** is similar to a Normal distribution. The probability of getting a value close to zero is very high, while the probability of getting a value far from zero is low. So if the null hypothesis is true, it is very unlikely to get the value of **t** far from zero. If this happens, we can reject the null hypothesis and accept the alternative one.

#### Critical region

Highlighted in red is the **critical region** (or **rejection region**). When the **t-statistic's** value falls within this critical region, we reject the null hypothesis and accept the alternative hypothesis.

We choose the critical region in such a way that the probability of landing inside it is equivalent to the significance level, typically set at **α** (usually 0.05).

#### One-Tailed vs Two-Tailed

Depending on the alternative hypothesis, there are two methods to construct a critical region.

- A
**two-tailed test**is used when the alternative hypothesis is "Means are not equal." - A
**one-tailed test**is used when the alternative hypothesis is "One mean is greater (lower) than the other."

#### Example

If we compute the **t** statistic for our example comparing male and female heights, we obtain a value of 19.1. Since it falls within a critical region, we can conclude that males are statistically significantly taller than females.

In this example, any value greater than 1.65 falls within the critical region. This is known as a **critical value**. The critical value is influenced by the sample sizes, but there's no need to concern yourself with it; Python will calculate both the critical value and the **t** statistic for you.

Everything was clear?

Course Content

# Learning Statistics with Python

2. Mean, Median and Mode with Python

4. Covariance vs Correlation

Learning Statistics with Python

## One-Tailed And Two-Tailed Test

**When the null hypothesis is true**, the t statistic follows the **t-distribution**.

The **t-distribution** is similar to a Normal distribution. The probability of getting a value close to zero is very high, while the probability of getting a value far from zero is low. So if the null hypothesis is true, it is very unlikely to get the value of **t** far from zero. If this happens, we can reject the null hypothesis and accept the alternative one.

#### Critical region

Highlighted in red is the **critical region** (or **rejection region**). When the **t-statistic's** value falls within this critical region, we reject the null hypothesis and accept the alternative hypothesis.

We choose the critical region in such a way that the probability of landing inside it is equivalent to the significance level, typically set at **α** (usually 0.05).

#### One-Tailed vs Two-Tailed

Depending on the alternative hypothesis, there are two methods to construct a critical region.

- A
**two-tailed test**is used when the alternative hypothesis is "Means are not equal." - A
**one-tailed test**is used when the alternative hypothesis is "One mean is greater (lower) than the other."

#### Example

If we compute the **t** statistic for our example comparing male and female heights, we obtain a value of 19.1. Since it falls within a critical region, we can conclude that males are statistically significantly taller than females.

In this example, any value greater than 1.65 falls within the critical region. This is known as a **critical value**. The critical value is influenced by the sample sizes, but there's no need to concern yourself with it; Python will calculate both the critical value and the **t** statistic for you.

Everything was clear?