2025-03-15

Introduction

Hypothesis testing is a statistical method used to make decisions based on evidence about specific theories relevant to a larger population.

For this method we need to define a null hypothesis(the validity of which we are trying to test) and an alternative hypothesis(a new theory which could potentially replace the null).

Steps in Hypothesis Testing

  1. State the null hypothesis (H0) and the alternative hypothesis (H1).
  2. Choose a significance level (α), often 0.05.
  3. Compute the test statistic.
  4. Determine the p-value.
  5. Compare the p-value with α and make a decision.

Example: Testing the Mean

Let’s say we want to test whether the average height of a child is 100cm.

Hypotheses:

  • H0: μ = 100
  • H1: μ ≠ 100

Plotly Visualization

ggplot Visualizations

Contd.: Boxplot

boxplot(data, main="Boxplot of Sample Data", col="lightblue")

Conclusion

If the p-value is less than 0.05, we reject H0 and conclude there is significant evidence that the mean is not 100cm. Otherwise, we fail to reject H0.