When do you use paired t-test and how to apply the same in a practical situation?
In this article, we will talk about paired t-test analysis calculation based on a mathematical formula and using R software.
Let us consider two-variable x1 and x2 which are normally distributed. In a practical situation, observations are taken from the same item considered for paired t-test analysis. ie item have pre and post-values.
x1-x2 is the difference denoted as d with mean u and variance sigma1+sigma2-2sigma1sigma2.
In this case, the null hypothesis is
Ho µd=0 and H1 is µd≠0
the paired t-test statistic
t statistic should be
Let consider x1 values are 2.265, 2.267, 2.264, 2.267, 2.268, 2.263, 2.264, 2.258 and x2 values are 2.270, 2.268, 2.269, 2.273, 2.270, 2.270, 2.268, 2.268
Test pre and post values are significantly different or not.
mean of difference=0.005, sd=0.0028 and t=5.05. According tabled value n-1=7 and confidence level =0.95, Given tabled value t=2.2365.
The calculated value greater than the tabled value, which means rejecting Ho and accepting H1.
In other words, a significant difference was observed between Pre and Post values at a 95% significance level.
Let see how to calculate paired t-test analysis in R software.
The advantage here is with a single line of R script we can execute the analysis.
Let store values of x1 in
X1<-c( 2.265, 2.267, 2.264, 2.267, 2.268, 2.263, 2.264, 2.258)
and values of x2 in
X2<-c(2.270, 2.268, 2.269, 2.273, 2.270, 2.270, 2.268, 2.268)
Ho=No difference was observed between Pre and post values
H1=Difference was observed between Pre and Post values
The R function is mentioned below
t.test(X1, X2, paired = TRUE, alternative = "two.sided")
data: X1 and X2 t = -5, df = 7, p-value = 0.001565 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: -0.007364624 -0.002635376 sample estimates: mean of the differences -0.005
the p-value is less than 0.05 which means a significant difference was observed between pre and post-values. Using R with a single line of the script can easily execute the analysis.
Enjoyed this tutorial? Don’t forget to show your love, Please Subscribe the Newsletter and COMMENT below!