#Paired t-test: x<-read.csv(file="C:/Rdata/co2.csv") x attach(x) X1=January X2=December d=X1-X2 n=length(d) n #n=39 dbar=mean(d) dbar #dbar=-0.2638462 sd=sqrt(var(d)) sd #sd=0.500482 #Performing the Paired t-test: t.test(X1,X2,alternative="two.sided",paired=T,conf.level=0.95) #Critical Value: n=39 a=0.05 C1=qt(a/2,n-1) C1 <- Two-sided lower critical value C2=qt(1-a/2,n-1) C2 <- Two-sided upper critical value OR C1=qt(a/2,n-1) C2=abs(C1) <- C2 is the absolute value of C1 #Probability Value #t < 0 t=-3.2923 P=2*pt(t,n-1) P Wilcoxon Signed-Rank Test: x<-read.csv(file="C:/Rdata/co2(d).csv") x attach(x) #Performing the Wilcoxon Signed-Rank Test: wilcox.test(January,December,alternative="two.sided",paired=T) #Critical Value of the Test a=0.05 C=qnorm(1-a/2,0,1) C Sign Test: x<-read.csv(file="C:/Rdata/co2(s).csv") x attach(x) n=length(January) n #n=39 p=0.5 PLUS=length(January[d=="plus"]) PLUS #PLUS=12 MINUS=length(January[d=="minus"]) MINUS #MINUS=27 #Performing the Sign Test: binom.test(PLUS,n,p, alternative="two.sided",conf.level=0.95) #Alternative calculation using the Binomial function pbinom(): Since C=12 and n/2=19.5, C < n/2 C=12 p=0.5 P=2*pbinom(C,n,p)