Hypothesis testing is an integral part of statistics, providing a methodical way to make decisions based on data analysis. This segment focuses on binomial and Poisson distributions, covering everything from formulating hypotheses to conducting tests with direct probability calculations and using normal approximation.

**Formulating Hypotheses for Binomial and Poisson Distributions**

In hypothesis testing, we begin by establishing two opposing hypotheses: the null hypothesis ($H_0$) and the alternative hypothesis ($H_1$).

**Null Hypothesis (**$H_0$**)**: This is a statement of no effect or no difference. It's what we assume to be true until we have evidence to suggest otherwise.**Alternative Hypothesis (**$H_1$**)**: This is what we want to test for. It's a statement that indicates some effect or difference.

**Binomial Distribution Example**

Consider a dice thought to be biased. We want to test if the probability of rolling a six is higher than the usual $\frac{1}{6}$.

- $H_0$: The probability of rolling a six is $\frac{1}{6}$(p = $\frac{1}{6}$).
- $H_1$: The probability of rolling a six is greater than 1/6 (p > $\frac{1}{6}$).

**Poisson Distribution Example**

Imagine a bus station where the average number of buses arriving per hour is thought to have decreased. Historically, the rate was 4 buses per hour.

- $H_0$: The average number of buses arriving per hour is 4 ($λ = 4$).
- $H_1$: The average number of buses arriving per hour is less than 4 (λ < 4).

## Hypothesis Testing Procedure:

1. Define $H_0$ and $H_1$.

2. Choose Significance Level (α), usually 0.05.

3. Calculate Test Statistic using distribution's probability formula.

4. Determine Rejection Region based on α.

5. Decision: Reject $H_0$ if test statistic in rejection region.

## Normal Approximation:

- For large samples, binomial and Poisson distributions can approximate to normal.
**Binomial:**Use when np and n(1-p) > 5.**Poisson:**Use when λ > 5.

## Examples

### Problem 1: Product Defect Rate

A manufacturer claims that only 5% of their products are defective. In a sample of 200 products, 18 were found defective. Test at the 5% level of significance if the claim is true.

**Solution**:

**1. Hypotheses**:

- $H_0$: p = 0.05 (5% are defective)
- $H_1$: p > 0.05 (more than 5% are defective)

**2. Test Statistic**:

- The expected number of defective products under $H_0$ is $200 \times 0.05 = 10$.
- The standard deviation is $\sqrt{200 \times 0.05 \times 0.95} \approx 4.37$.

**3. Z-Score Calculation**:

- The z-score is calculated as $\frac{18 - 10}{4.37} \approx 2.60$.

**4. Decision**:

- With a p-value of approximately 0.0047, which is less than 0.05, $H_0$ is rejected.

**Conclusion**: The evidence suggests the actual defect rate may be higher than 5%, challenging the manufacturer's claim.

### Problem 2: Bakery Flour Dispensing

A bakery claims its machines dispense 500 grams of flour into each bag, with a standard deviation of 50 grams. A sample of 36 bags had an average weight of 520 grams. Test at the 1% level if the machines are dispensing correctly.

**Solution**:

**1. Hypotheses**:

- $H_0$: μ = 500 grams (correct dispensing)
- $H_1$: μ ≠ 500 grams (incorrect dispensing)

**2. Z-Score Calculation**:

- The standard error (SE) is $\frac{50}{\sqrt{36}} = 8.33$.
- The z-score is calculated as $\frac{520 - 500}{8.33} \approx 2.40$.

**3. Decision**: With a p-value of approximately 0.0164, which is greater than 0.01, $H_0$ is not rejected.

**Conclusion**: The evidence does not strongly contradict the claim that the machines dispense 500 grams of flour per bag.

Rahil spent ten years working as private tutor, teaching students for GCSEs, A-Levels, and university admissions. During his PhD he published papers on modelling infectious disease epidemics and was a tutor to undergraduate and masters students for mathematics courses.