🔹 Slide 3 — What is Hypothesis Testing?

What is Hypothesis Testing?

Hypothesis testing is a method used to make decisions using data.

We:
- Start with a null hypothesis
- Collect sample data
- Measure how likely the data is under the null hypothesis

This likelihood is measured using a p-value.

Problem Statement

We compare execution times of two algorithms.

Question: Is Algorithm B faster than Algorithm A on average?

We will compare their mean execution times using a two-sample t-test. The null hypothesis assumes there is no difference between the algorithms.

##Hypotheses (LaTeX slide #1)

Let \(\mu_A\) and \(\mu_B\) be the true mean execution times.

\[ H_0: \mu_A = \mu_B \]

\[ H_1: \mu_A \ne \mu_B \]

Execution Time Comparison

Test Statistic & p-Value (LaTeX slide #2)

Test Statistic and p-Value

The two-sample t statistic is:

$$
t = \frac{\bar{X}_A - \bar{X}_B}
{\sqrt{\frac{s_A^2}{n_A} + \frac{s_B^2}{n_B}}}
$$

The p-value is the probability of observing a result this extreme,
assuming the null hypothesis is true.

##Running the Hypothesis Test in R

t.test(algo_A, algo_B)
## 
##  Welch Two Sample t-test
## 
## data:  algo_A and algo_B
## t = 4.8216, df = 56.249, p-value = 1.122e-05
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##   6.736535 16.311390
## sample estimates:
## mean of x mean of y 
##  120.5487  109.0247

Sampling Distributions

p-Value Surface

Conclusion

- Hypothesis testing compares data against a null assumption
- The p-value measures evidence against the null hypothesis
- Smaller p-values indicate stronger evidence
- Both variability and effect size affect significance
- This method is widely used in engineering and computer science