Sidebar Menu

In one sample t-test we only compare a population with a certain value, but in reality cases using this type of test are very rare. Researchers, particularly in agriculture, are more concerned with cases that require comparisons between two conditions or two population averages.

Before we do the analysis, we must first consider whether the two populations come from a normal distribution, are the variance of two populations equal? This will guide us in choosing the right method and formula for conducting a t-test analysis to compare the two population mean values.

A full discussion of the t-student test can be read in the following document.

Hypothesis

 

Test Type:

 

Two-Tailed

Right Tailed

Left Tailed

 

H0 : μ1 = μ2

H0 : μ1 = μ2

H0 : μ1 = μ2

 

HA : μ1 ≠ μ2

HA : μ1 > μ2

HA : μ1 < μ2

Decision:

     

Reject H0 if:

|t| > tα/2,df

t > t α,df

|t| > |-t α,df |

Description: |t| = absolute value of t

When the variance of the two populations is equal (σ1 = σ2 = σ) and the value of the σ is not known, the value is approached with its approximate value, that is, the average deviation of the example, s. Since both populations have an s value, the s used is a combined s (sp) of the two populations:

Standard deviation of the population:

 $$\sigma_{{\bar{y}}_1-{\bar{y}}_2}=\sigma_p\sqrt{\frac{1}{n_1}+\frac{1}{n_2}}$$

Standard deviation of sample population (Approximate):

 $$s_{{\bar{y}}_1-{\bar{y}}_2}=s_p\sqrt{\frac{1}{n_1}+\frac{1}{n_2}}$$

Where is the combined standard deviation:

 $$s_p=\sqrt{\frac{(n_1-1)s_1^2+(n_2-1)s_2^2}{n_1+n_2-2}}$$

Statistical Test

 $$ t=\frac{{\bar{y}}_1-{\bar{y}}_2}{s_{{\bar{y}}_1-{\bar{y}}_2}}$$

 $$ t=\frac{{\bar{y}}_1-{\bar{y}}_2}{s_p\sqrt{\frac{1}{n_1}+\frac{1}{n_2}}}$$

with $ df=n_1+n_2-2$

Example 1: One Tailed test

Computer Programming courses are given to two different classes of students. Class A, which consists of 12 students, is taught by the usual method. Meanwhile, class B consisting of 10 students is taught with a new teaching method. At the end of the semester, classes A and B are given the same exam materials. In class A, the average score of students is 85 with a standard deviation of 4, and in class B the average score is 81 with a standard deviation of 5. Are you sure that the usual teaching method remains better than the new teaching method with a significant degree of 0.01? It is assumed that two populations are close to the normal distribution with the equal variance.

Answer

Sample A: n1 = 12; ${\bar{y}}_1$= 85; s1 = 4; and Sample B: n2 = 10; ${\bar{y}}_2$ = 81; s2 = 5.

  1. Step 1: Claim: The old teaching method remains better, symbolically it can be expressed by μ1 > μ2 vs μ1 = μ2
  2. Step 2: From the two equations above, the μ1 = μ2 contains an element of equality, thus becoming the hypothesis of null and alternative hypothesis (H1) μ1 > μ2.
  3. H0: μ1 = μ2
  4. H1: μ1 > μ2
  5. Significant level : α = 0.01
  6. Determine the statistical test: the sample is taken randomly; n < 30 (but assumed to be normally distributed) and σ1 = σ2 = σ. From these conditions, the appropriate statistical test is an independent t-test with a homogeneous variance.
  7. Calculate tstat and determine tcritical:
  8. The combined standard deviation:

 $$s_p=\sqrt{\frac{\left(n_1-1\right){s_1}^2+\left(n_2-1\right){s_2}^2}{n_1+n_2-2}}=\sqrt{\frac{\left(11\right)4^2+\left(9\right)5^2}{20}}=\sqrt{20,05}=4.478$$

 $$ t=\frac{{\bar{y}}_1-{\bar{y}}_2}{s_p\sqrt{\frac{1}{n_1}+\frac{1}{n_2}}}=\frac{85-80}{4.478\sqrt{\frac{1}{12}+\frac{1}{10}}}=2.09$$

  1. df = n1 + n2 -2 = 12+10-2 = 20; α = 0.01
  2. tcritica = t(0.01.20) = 2.528
  3. Since t stats < tcritical then H0 is accepted
  4. From the results of the t-test, it was concluded that at a significant level of 1%, the ordinary teaching method is no different from the new teaching method. If the cost of the teaching method ischeaper, we can choose this method, because the quality is no different compared to ordinary teaching methods.

Example 2: Two Tailed Test [Weight gain of Holstein calves (Torrie, 1980)]

A total of 28 Holstein cows, grouped into two, the first group of 14 cows were given vitamin A, while the second group was not given vitamin A as a control. To find out the difference in the weight of the two groups of cows, a statistical test t with 2 free (independent) samples was used. Data on the weight gain of cows treated with vitamin A are presented in Table 1:

Table 1.1. Weight gain of Holstein cows due to the administration of vitamin A

Number

Cow weight(lb)

Control

Vitamin A

1

175

142

2

132

311

3

218

337

4

151

262

5

200

302

6

219

195

7

234

253

8

149

199

9

187

236

10

123

216

11

248

211

12

206

176

13

179

249

14

206

214

Manual Calculation (Classical/Traditional Method)

Sample A: n1 = 14; ${\bar{y}}_1$ =187.6429; s1 = 38.09827; and

Sample B: n2 = 14; ${\bar{y}}_2$ =235.928685; s2 = 54.28623.

  1. Step 1: Claim: There is a difference between the two treats, symbolically it can be expressed by μ1 ≠ μ2 vs μ1 = μ2
  2. Step 2: From the two equations above, the μ1 = μ2 contains an element of equality, thus becoming the null hypothesis and alternative hypothesis (H1) μ1 ≠ μ2.
  3. H0: μ1 = μ2
  4. H1: μ1 ≠ μ2
  5. Significant level : α = 0.05
  6. Determine the statistical test: the sample is taken randomly; n < 30; normally distributed (Kolmogorov-Smirnov/Shapiro-Wilk Test) and σ1 = σ2 = σ (Levene Test). From these conditions, the appropriate statistical test is an independent t-test with a homogeneous variance.
  7. Calculate tstat and determine tcritical:
  8. The combined standard deviation:

 $$\begin{matrix}s_p=\sqrt{\frac{\left(n_1-1\right){s_1}^2+\left(n_2-1\right){s_2}^2}{n_1+n_2-2}}=\sqrt{\frac{\left(13\right)38.10^2+\left(13\right)54.29^2}{26}}\\=\sqrt{2199.2365}=46.896\\\end{matrix}$$ $$\begin{matrix}t=\frac{{\bar{y}}_1-{\bar{y}}_2}{s_p\sqrt{\frac{1}{n_1}+\frac{1}{n_2}}}=\frac{187.6429-235.9286}{46.896\sqrt{\frac{1}{14}+\frac{1}{14}}}\\=\frac{-48.2857}{17.725}=-2.724153\\\end{matrix}$$

  1. df = n1 + n2 -2 = 14+14-2 = 26; α = 0.05
  2. tcritica = t(α/2; df) = t(0.025.26) = 2.056
  3. Because |tstat| >|tcritica|= |-2.73| > 2.056, then H0 is rejected!
  4. From the results of the t-test, it was concluded that at a significant level of 5%, the weight between the group of cows that were not given vitamin A (control) and those given Vitamin A was different.

Modern Methods:

The above method is a statistical test by traditional methods. Tests with modern methods use p-value in determining whether or not a statistical test is significant.

If: P-Value < Significant Level then the significant test or H0 is rejected

If: P-Value > Significant Level then the non-significant test or H0 is accepted

If the P-Value value < 0.01, then the test is very significant!

Calculations by using the SmartstatXL Add-In:

Graphical user interface, application Description automatically generated

Descriptive Statistics and Test for Homogeneity Variance

Table Description automatically generated

Normality Test

Table Description automatically generated

T-test

Graphical user interface, text, email Description automatically generated

Calculation using SPSS software v.16:

Group Statistics

 

Group

N

Mean

Std. Deviation

Std. Error Mean

Treatment

Control

14

187.6429

38.09827

10.18219

Vitamin A

14

235.9286

54.28623

14.50860

Tests of Normality

 

Group

Kolmogorov-Smirnova

Shapiro-Wilk

 

Statistics

Df

Sig.

Statistics

Df

Sig.

Treatment

Control

.127

14

.200*

.964

14

.793

Vitamin A

.143

14

.200*

.973

14

.915

a. Lilliefors Significance Correction

       

*. This is a lower bound of the true significance.

     

Independent Samples Test

   

Levene's Test for Equality of Variances

t-test for Equality of Means

   

F

Sig.

t

Df

Sig. (2-tailed)

Mean Difference

Std. Error Difference

95% Confidence Interval of the Difference

   

Lower

Upper

Treatment

Equal variances assumed

1.339

.258

-2.724

26

.011

-48.28571

17.72503

-84.72003

-11.85140

Equal variances not assumed

   

-2.724

23.306

.012

-48.28571

17.72503

-84.92613

-11.64530

Normality Test

Kolmogorov-Smirnova or Shapiro-Wilk is used to test the assumption of whether the sample taken is normally distributed or not. This assumption is necessary before performing the t-test. The t-test can only be performed if the sample is normally distributed.

H0 = normally distributed sample;

H1 = non-normally distributed sample.

Conclusion:

  • H0 rejected: significant (usually p < 0.20) = non-normally distributed sample
  • H0 accepted: not significant (usually p > 0.20) = normally distributed sample

The normality test (Kolmogorov-Smirnova/ Shapiro-Wilk) for both groups was not significant. Kolmogorov-Smirnov test for the Control group = p > 0.2, and Vitamin A = p > 0.2. This shows that the two samples are normally distributed.

Homogeneity test:

The Levene test was used to test the homogeneity of the variance between the two populations (groups).

  • H0 = homogeneous variance.
  • HA = not all flavors are the same.

Levene Test Conclusion:

  • H0 is rejected which means the Levene Test is significant (usually p < 0.10) = unequal variance (σ1 ≠ σ2)
  • H0 is accepted which means the Levene Test is not significant (usually p > 0.10) = homogeneous variance (σ1 = σ2)

 

Pay attention to the calculation results using the SPSS software above. There are two variance assumptions in the output of the Independent Samples Test, namely Equal variance assumsed, and not assumses. The results of the Levene Test showed that the two populations had a homogeneous variance (p = 0.258 > 0.10), so the t test used was a test assuming a homogeneous variance (Equal variance assumed). This Hal suggests that both cow samples are from the same population.

Conclusion:

Hypothesis:

  1. H0: μ1 = μ2
  2. H1: μ1 ≠ μ2

Classic Method

tstat = tstat = T-Value = -2.724

tcritica = ttable = t(0.05.9) = 2,056 (obtained from the table value t-student)

Since |tstat| > |tcritical| = 2,724 > 2,056 then H0 is rejected!

Modern Methods:

Tests with modern methods use p-value in determining whether or not a statistical test is significant.

If: P-Value < Significant Level then the significant test or H0 is rejected

If: P-Value > Significant Level then the non-significant test or H0 is accepted

Since its signification value (p-value or Sig. = 0.011) < 0.05, then H0 is rejected and HA is accepted. This states that there are differences between the group of cows given vitamin A and the control group.

In the output the Table also includes the value of the confidence interval.

P(-84.72 < μ1 - μ2 < -11.85) = 95%,

That is to say: 95% we are sure that the average difference between the two lies in the range between -84.72 and -11.85.