2  Hypothesis testing example

2.1 Question

Cola manufacturers want to test how much the sweetness of a new cola drink is affected by storage. The sweetness loss due to storage was evaluated by 10 professional tasters (by comparing the sweetness before and after storage):

Taster          Sweetness loss

 1         2.0
 2         0.4
 3         0.7  
 4         2.0  
 5       −0.4   
 6         2.2  
 7       −1.3   
 8         1.2  
 9         1.1
10         2.3

Obviously, we want to test if storage results in a loss of sweetness

Let \(\mu\) denote the sweetness loss, thus:

Null hypothesis: \(H_0: \mu = 0\)

Alternate hypothesis: \(H_a: \mu > 0\)

2.2 Solution

Sample mean (\(\bar{x}\)):

data <- c(2, 0.4, 0.7, 2, -0.4, 2.2, -1.3, 1.2, 1.1, 2.3)

xbar <- mean(data)
xbar
[1] 1.02

T-statistic:

t = xbar/(sd(data)/sqrt(10))
t
[1] 2.696689

p-value:

1-pt(t, df = 9)
[1] 0.01226316

If the probability of Type I error considered is 5%, then we reject the null hypothesis, and conclude that the sweetness loss is indeed greater than 0.

If the probability of Type I error considered is 1%, then we fail to reject the null hypothesis, and conclude that the sweetness loss is indeed 0.