2025-10-15

Introduction

What is a statistical hypothesis? - A statement about the parameters of one or more populations. Let

\[ \begin{aligned} H_0 &: \mu = 50 \text{ centimeters per second} \\[6pt] H_1 &: \mu \neq 50 \text{ centimeters per second} \end{aligned} \]

The statement \(H_0 : \mu = 50\) is called the null hypothesis.
The statement \(H_1 : \mu \neq 50\) is called the alternative hypothesis.

The hypothesis test

The hypothesis being tested is (H_0). We assume the null hypothesis is true unless there is strong evidence to the contrary.

Consider the two-sided hypothesis test:

\[ H_0: \mu = \mu_0 \quad \text{vs.} \quad H_1: \mu \neq \mu_0 \] The p-value is the smallest level of significance that would lead to rejection of null hypothesis, or in other words the (H_0) would be unlikely.

Example

To better our understanding of hypothesis testing. We test whether the mean CO₂ uptake differs between chilled and non-chilled plants.

Hypotheses:

\[ \begin{aligned} H_0 &: \mu_{\text{chilled}} = \mu_{\text{non-chilled}} \\[6pt] H_a &: \mu_{\text{chilled}} \neq \mu_{\text{non-chilled}} \end{aligned} \]

Test Statistics (t-test)

\[ T_0 = \frac{\bar{X}_1 - \bar{X}_2}{\sqrt{\dfrac{s_1^2}{n_1} + \dfrac{s_2^2}{n_2}}} \]

Degrees of freedom (Welch–Satterthwaite approximation): \[ \nu \approx \frac{\left(\dfrac{s_1^2}{n_1} + \dfrac{s_2^2}{n_2}\right)^2} {\dfrac{(s_1^2/n_1)^2}{n_1-1} + \dfrac{(s_2^2/n_2)^2}{n_2-1}} \]

p-value (two-sided):

\[ p = 2\bigl(1 - F_{t,\nu}(|T_0|)\bigr) \]

Reject \(H_0\) if \(p < \alpha\) (use \(\alpha = 0.05\)).

Let’s calculate using R

# Perform Welch t-test
tt <- t.test(uptake ~ Treatment, data = CO2)

# Extract values
t_stat <- tt$statistic
df <- tt$parameter
pval <- tt$p.value
means <- tapply(CO2$uptake, CO2$Treatment, mean)
sds <- tapply(CO2$uptake, CO2$Treatment, sd)

# Display key results
t_stat; df; pval
##        t 
## 3.048461
##       df 
## 80.94468
## [1] 0.003106937
means; sds
## nonchilled    chilled 
##   30.64286   23.78333
## nonchilled    chilled 
##   9.704994  10.884312

CO2 Uptake by Treatment (ggplot)

3D Visualization: Mean Uptake vs Concentration and Type

What it means

  • The test statistic (Z_0) and the p-value above tell us whether mean uptake differs between non-chilled and chilled plants (using pooled-sd z-approximation).

  • The box plot visually compares distributions by treatment.

  • The 3D surface shows how mean uptake varies across Type and concentration (helpful context for the test).