Here is the data on alcohol consumption before and after the breakup. There is an assumption that the drinking habit increases post-breakup. Is that true?
Before | After |
470 | 408 |
354 | 439 |
496 | 321 |
351 | 437 |
349 | 335 |
449 | 344 |
378 | 318 |
359 | 492 |
469 | 531 |
329 | 417 |
389 | 358 |
497 | 391 |
493 | 398 |
268 | 394 |
445 | 508 |
287 | 399 |
338 | 345 |
271 | 341 |
412 | 326 |
335 | 467 |
The null hypothesis, H0: (consumption after – before) = 0.
The alternative hypothesis, HA: (consumption after – before) > 0.
T-Test
D = Mean difference of the parameter after and before
mud = hypothesised mean difference
Sd = Standard deviation of the difference
n = number of samples
We insert the data in the following command and run the function, t.test.
Before <- c(470, 354, 496, 351, 349, 449, 378, 359, 469, 329, 389, 497, 493, 268, 445, 287, 338, 271, 412, 335)
After <- c(408, 439, 321, 437, 335, 344, 318, 492, 531, 417, 358, 391, 398, 394, 508, 399, 345, 341, 326, 467)
t.test(Before, After, paired = TRUE, alternative = "greater")
Paired t-test
data: Before and After
t = -0.53754, df = 19, p-value = 0.7014
alternative hypothesis: true mean difference is greater than 0
95 percent confidence interval:
-48.49262 Inf
sample estimates:
mean difference
-11.5
There was a difference of -11.5, yet the p-value (0.7014) is higher than the critical value we chose (0.05). The test shows no evidence supporting the hypothesis.