# Worksheet for how to calculate T Test

This worksheet help you to understand how to calculate the significance of observed differences between the means of two samples when there is null hypothesis. The formula used to calculate the T Test is, where
x1 is the mean of first data set
x2 is the mean of first data set
S12 is the standard deviation of first data set
S22 is the standard deviation of first data set
N1 is the number of elements in the first data set
N2 is the number of elements in the first data set

Example:
Calculate the T test value whose inputs are 10, 20,30,40,50 and 1, 29,46,78,99
First calculate standard deviation & mean of the given set,

For the data set 10, 20,30,40,50
Total Inputs(N) =(10,20,30,40,50)
Total Inputs(N)=5
Mean(xm)= (x1+x2+x3...xn)/N
Mean(xm)= 150/5
Means(xm)= 30
SD=sqrt(1/(N-1)*((x1-xm)2+(x2-xm)2+..+(xn-xm)2))
=sqrt(1/(5-1)((10-30)2+(20-30) 2+(30-30) 2+(40-30) 2+(50-30) 2))
=sqrt(1/4((-20) 2+(-10) 2+(0) 2+(10) 2+(20) 2))
=sqrt(1/4((400)+(100)+(0)+(100)+(400)))
=sqrt(250)
=15.8114
Variance=SD2
Variance=15.81142
Variance=250

For the data set 1, 29,46,78,99
Total Inputs(N) =(1,29,46,78,99)
Total Inputs(N)=5
Mean(xm)= (x1+x2+x3...xn)/N
Mean(xm)= 253/5
Means(xm)= 50.6
SD=sqrt(1/(N-1)*((x1-xm)2+(x2-xm)2+..+(xn-xm)2))
=sqrt(1/(5-1)((1-50.6)2+(29-50.6) 2+(46-50.6) 2+(78-50.6) 2+(99-50.6) 2))
=sqrt(1/4((-49.6) 2+(-21.6) 2+(-4.6) 2+(27.4) 2+(48.4) 2))
=sqrt(1/4((2460.16)+(466.56)+(21.16)+(750.76)+(2342.56)))
=sqrt(1510.3)
=38.8626
Variance=SD2
Variance=38.86262
Variance=1510.3

To find T Test:
From above we know that,
x1 = 30
x2 = 50.6
S12 = 250
S22 = 1510.3
N1 = 5
N2 = 5
Substitute these values in the above formula, T = (30 - 50.6)/√((250/5) + (1510.3/5))
= -1.0979

When you try such calculations on your own, this t-test calculator can be used to verify your results of calculations.