In: Statistics and Probability
5. Eight students were given a placement test and after a week of classes were given again a placement test at the same level. Here are their scores.
Before 71 78 80 90 55 65 76 77
After 75 71 89 92 61 68 80 81
(a) Test whether the scores improved after 1 week by performing a student test.
(b) Test whether the scores improved after 1 week by performing a sign test.
Here we have to test,
H0: There is no improvement in score after 1 weak.
H1: There is improvement in score after 1 weak.
For given problem I write R-code as:
x=c(71,78,80,90,55,65,76,77)
y=c(75,71,89,92,61,68,80,81)
t.test(x,y,paired=TRUE)
sign.test<-function(x=0,y=NULL,alternative="two.sided"){
n<-sum((x-y)!=0)
T<-sum(x<y)
if (alternative=="less") {
p.value<-pbinom(T,n,0.5)}
if (alternative=="greater"){
p.value<- 1-pbinom(T-1,n,0.5)}
if (alternative=="two.sided"){
p.value<-2*min(1-pbinom(T-1,n,0.5),pbinom(T,n,0.5))}
list(n=n,alternative=alternative,T=T,p.value=p.value)}
sign.test(x,y)
Amd the output is:
Rscript main.r Paired t-test data: x and y t = -1.9166, df = 7, p-value = 0.09681 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: -6.980485 0.730485 sample estimates: mean of the differences -3.125 $n [1] 8 $alternative [1] "two.sided" $T [1] 7 $p.value [1] 0.0703125
Here both p-values are greater than 0.05. Thus there is no
sufficient evidence to claim that there is improvement in score
after 1 weak.