options(scipen=999)
options(digits=9)

d0=0
alpha=0.05
x=c(2.0,2.0,2.3,2.1,2.4)
y=c(2.2,1.9,2.5,2.3,2.4)
d=x-y;d
n=length(d);n
dbar=mean(d);dbar
s=sd(d);s
standard_error=s/sqrt(n)
t_compute=(dbar-d0)/standard_error;t_compute
v=n-1;v
t_critical=qt(1-alpha/2,v);t_critical
one_tailed_sig=1-pt(abs(t_compute),v);one_tailed_sig
two_tailed_sig=2*one_tailed_sig;two_tailed_sig

library(TeachingDemos)
x=c(2.0,2.0,2.3,2.1,2.4)
y=c(2.2,1.9,2.5,2.3,2.4)
t.test(x,y,pair=TRUE,mu=0)


