One-Tailed And Two-Tailed Test
When the null hypothesis is true, the t statistic follows the t-distribution.
![](https://codefinity-content-media.s3.eu-west-1.amazonaws.com/a849660e-ddfa-4033-80a6-94a1b7772e23/Testing2.0/TDistribution.png)
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
![](https://codefinity-content-media.s3.eu-west-1.amazonaws.com/a849660e-ddfa-4033-80a6-94a1b7772e23/Testing2.0/TwoTailedExample.png)
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."
![](https://codefinity-content-media.s3.eu-west-1.amazonaws.com/a849660e-ddfa-4033-80a6-94a1b7772e23/Testing2.0/CriticalRegion.png)
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.
![](https://codefinity-content-media.s3.eu-west-1.amazonaws.com/a849660e-ddfa-4033-80a6-94a1b7772e23/Testing2.0/TExample.png)
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.
Tudo estava claro?
Conteúdo do Curso
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.
![](https://codefinity-content-media.s3.eu-west-1.amazonaws.com/a849660e-ddfa-4033-80a6-94a1b7772e23/Testing2.0/TDistribution.png)
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
![](https://codefinity-content-media.s3.eu-west-1.amazonaws.com/a849660e-ddfa-4033-80a6-94a1b7772e23/Testing2.0/TwoTailedExample.png)
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."
![](https://codefinity-content-media.s3.eu-west-1.amazonaws.com/a849660e-ddfa-4033-80a6-94a1b7772e23/Testing2.0/CriticalRegion.png)
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.
![](https://codefinity-content-media.s3.eu-west-1.amazonaws.com/a849660e-ddfa-4033-80a6-94a1b7772e23/Testing2.0/TExample.png)
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.
Tudo estava claro?