# Type 2 Error

Statistical hypothesis testing is a method utilized to verify if a statement made about a data population is true or false, based on a sample of the data. For instance, the fact that a man cannot biologically conceive falls under a proclamation about human pregnancy. This authoritative implication is examined through the 'null hypothesis' in hypothesis testing for its correctness. In most instances, the null hypothesis is discarded by default. Remember, the null hypothesis is crucial as it lays down the foundation for substantiating what we're examining. The 'alternative hypothesis,' a statement that challenges the null hypothesis, is also a part of the hypothesis testing. The process involves both forms of the hypothesis to affirm whether the sample data is accurate or not.

## Type I Error

A Type I error arises when despite being accurate, the null hypothesis is discarded, and the alternative hypothesis is accepted. Using the context of the cover image, the null hypothesis claims that a man cannot conceive, while the alternative hypothesis suggests that a man is pregnant. Nonetheless, if the doctor rejects the declaration, it results in a Type I error. In simpler terms, the man is erroneously considered pregnant.

## Definition of Type II Error

A Type II error is when, despite being false, the null hypothesis is accepted and the alternative hypothesis is rejected. Where the null hypothesis claims that the woman is not expectant, the alternative hypothesis asserts that she is. The example of Type II error is a scenario where a doctor states a pregnant woman is not in the family way. This forms a Type II error; the incorrect null hypothesis is presumed true, and the alternative hypothesis is erroneously deemed false.

A Type II error in the sphere of hypothesis testing transpires when it falls short to discard an incorrect null hypothesis. Plainly put, it misdirects the consumer to erroneously deny the false hypothesis as the test lacks the predictive potency to uncover enough evidence for the alternative hypothesis. Frequent false negative results define a Type II error.

In direct proportion to the Type II error, is the power of a statistical test. This implies that a highly powered statistical test reduces the risk of a Type 2 error. The statistical power is denoted by 1- beta, and the ratio of Type II error is represented by beta.

Type 1 vs Type 2 error can be compared as false positive vs false negative errors, respectively.

## Strategies to Minimize Type II Errors

Complete elimination of Type II error from a hypothesis test is impossible. However, the possibility of making a Type II error can be minimized. As the occurrence of a Type II error is closely linked to the power of a statistical test, increasing the power of the test is one way to reduce the chance of an error.

### Increasing the Sample Size

One of the most straightforward strategies to tackle the risk of a Type II error is to enhance the sample size. In a hypothesis test, the sample size primarily influences the level of the sampling error, which correlates to the ability to discern discrepancies. An expanded sample size escalates the likelihood of catching differences in statistical tests, thereby increasing the power of the test.

### Amplifying the Significance Level

Another possible solution is to choose a higher relevance level. Instead of the standard accepted 0.05 margin, a researcher could opt for a significance limit of 0.15. A higher significance level means a larger likelihood of rejecting a true null hypothesis. Therefore, increasing the chance of rejecting the null hypothesis reduces the type 2 error's risk but elevates the chance of a Type I error.

## Conclusion

A Type 2 error, also known as a false negative, represents the risk of erroneously upholding a null hypothesis when it shouldn't be generalizable. More stringent criteria for rejecting a null hypothesis can lower the incidence of Type II errors but heighten the risk of a false positive. In terms of both likelihood and impact, Type II errors should be considered against Type I errors.

Integrate | Scan | Test | Automate

## Detect hidden vulnerabilities in ML models, from tabular to LLMs, before moving to production.  