x1=c(102,96,98,95,92,114)
x2=c(127,115,91,124,98,107,122)
d0=0
alpha=0.05
n1=length(x1);n1
xbar1=mean(x1);xbar1
s1=sd(x1);s1
n2=length(x2);n2
xbar2=mean(x2);xbar2
s2=sd(x2);s2
mean_difference=xbar1-xbar2;mean_difference
se=sqrt(s1^2/n1+s2^2/n2);se
df=((s1^2/n1+s2^2/n2)^2)/((s1^2/n1)^2/(n1-1)+(s2^2/n2)^2/(n2-1));df
t_compute=((xbar1-xbar2)-d0)/se;t_compute
sig_1_tailed=1-pt(abs(t_compute),df);sig_1_tailed
sig_2_tailed=2*sig_1_tailed;sig_2_tailed
critical_t=qt(1-alpha/2,df);critical_t
