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:

Two sample t test with equal variance

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

Pooled Variance

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.

Machine AMachine B
140146
142145
144148
142145
141144

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.

MetricsMachine AMachine B
Observations55
Mean141.8145.6
Variance2.22.3
Pooled variance2.25
degree of freedom8
t critical for two tail test(95% confidence)-2.3 and +2.3

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:

Two sample t test with unequal variance

And degree of freedom can be calculated as:

degree of freedom

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.

Machine AMachine B
140134
142152
144167
142140
141130

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.

MetricsMachine AMachine B
Observations55
Mean141.8144.6
Variance2.2225.8
t critical for two tail test-2.77 and +2.77

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.


0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Insert math as
Block
Inline
Additional settings
Formula color
Text color
#333333
Type math using LaTeX
Preview
\({}\)
Nothing to preview
Insert