Aim: To test whether there is any significant difference paired observations.
Problem: 1
An IQ test was administrated to five persons before and after they were trained. The results are
given below:
Candidates : I II III IV V
IQ before training 110 120 123 132 125
IQ after training 120 118 125 136 121
Test whether there is any change in IQ after the training programme.
R – Code:-
> Before_Training=c(110,120,123,132,125)
> Before_Training
[1] 110 120 123 132 125
> After_Training=c(120,118,125,136,121)
> After_Training
[1] 120 118 125 136 121
> t.test(Before_Training,After_Training,paired=TRUE)
Paired t-test
data: Before_Training and After_Training
t = -0.8165, df = 4,
p-value = 0.4601
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-8.800874 4.800874
sample estimates:
mean of the differences -2
> qt(0.975,4)
[1] 2.776445
Problem: 2
Consider the paired data below that represents cholesterol levels on 10men before and after a
certain medication
Before(x) 237 289 257 228 303 275 262 304 244 233
After(y) 194 240 230 186 265 222 242 281 240 212
Test the claim that, on average, the drug lowers cholesterol in all men. i.e., test the claim
that
. Test this at the 0.05 significance level.
R - Code:-
> before=c(237,289,257,228,303,275,262,304,244,233)
> before
[1] 237 289 257 228 303 275 262 304 244 233
> after=c(194,240,230,186,265,222,252,281,240,212)
> before
[1] 237 289 257 228 303 275 262 304 244 233
> t.test(before,after, paired=TRUE,alternative="greater",mu=0)
Paired t-test
data: before and after
t = 5.9151,
df = 9,
p-value = 0.0001124
alternative hypothesis: true difference in means is greater than 0
95 percent confidence interval:
21.3929 Inf
sample estimates:
mean of the differences
31
> qt(0.975,9)
[1] 2.262157