Last blog, we discussed about the Two sample z test and found that how we can compare the population mean of two machines or product.

Similar to two sample z test , we also compare the population mean of two machines using two sample t test. Now question arises that what may be the difference of two sample z and t test

When samples size are high then we should go with two sample z test and when sample size are small, choose two sample t test.

Two sample t test can be calculated in two ways, one when both the samples have equal variance and another one with unequal variance.

Two sample t test with equal variance:

Now Sp is the pooled variance that can be calculted as :

Degree of freedom can be calculated-> n1 + n2 – 2

Let us solve one problem to get clear understanding.

Problem: In a factory, samples are extracted from the Machine A and Machine B and we have to figure it out whether Machine A and B are producing of equal mean or mean of both the machine have been changed? (95% confidence) . Sample are given below.

Solution: Null Hypothesis -> Mean of Machine A =Mean of Machine B
Alternate Hypothesis: Mean of Machine A not equal to Mean of Machine B

Here we will see variance of two samples are approximately same so apply the formula of two sample t test wth equal variance. We also require mean of samples, variance of the columns to calculate the two sample t test.

Polled variance can be calulated to put the values of variance and observation in the formula and when we keep pooled variance, mean and number of observation in two sample t test formula, get :

t=-4 and t critical is given 2.3 , meaning we can reject the null hypothesis.

Mean of Machine A and B has been changed.

Two Sample t test with unequal variance:

And degree of freedom can be calculated as:

Let us solve one problem to get clear understanding.

Problem: In a factory, samples are extracted from the Machine A and Machine B and we have to figure it out whether Machine A and B are producing of equal mean or mean of both the machine have been changed? (95% confidence) . Sample are given below.

Solution:

Null Hypothesis -> Mean of Machine A =Mean of Machine B
Alternate Hypothesis: Mean of Machine A not equal to Mean of Machine B

Here we will see variance of two samples are not same so apply the formula of two sample t test wth unequal variance. We also require mean of samples, variance of the columns to calculate the two sample t test.

When we put the mean and variance in the formula defined above :

t calculated=-.41 and it is less than t critical , meaning failed to reject the null hypothesis.

Mean of Machine A and B are not changed.

$${}$$