Drawn from the same population (two samples)  and sample size  < 30 and sigma not known

Sample size ≤ 30: Population Standard Deviation is not known. Testing with degrees of freedom n1+n2-2

You find combined  standard deviation of samples  using the above-said formula and then find t.

Problem:

A group of 5 patients were treated with medicine A. Their weights are given below. A group of 7 patients were treated with medicine B. Their weights are also given the following table. Will you agree that medicine B increases the weight of patients? The value of t at 5% level of significance for 10 degrees of freedom is given as 2.2281. Let the weights of patients treated with medicine A be denoted by x Let the weights of patients treated with medicine A be denoted by y

Find combined Variance                                                                 Find    t – calculated value

Abs(t) =  1.70

Using Excel:

Rejection Rule

Conclusion: The calculated value (abs(t) = 1.70) is less than tabulated value (t = 2.23) and it falls outside the rejection region. We accept the Null Hypothesis. That test reveals that the means of samples are not significantly different. Both are likely to be same.

Using Python:

Load libraries and read data

Calculate mean of x1 ,x2, (x1i-meanx1)^2, (x1i-meanx1)^2,variancesample, t and p-value

 

Calculate t-critical value with alpha =0.05 (one tail test)

Display results:

Calculate t-value using function

Recommendation: