Two Sample T-test

 Two Sample T-test

Introduction

A two sample t hypothesis tests also known as independent t-test is used to analyze the difference between two unknown population means. The Two-sample T-test is used when the two small samples (n< 30) are taken from two different populations and compared. 

Assumption

  1. The data are continuous
  2. The data are normally distributed in each group.
  3. The sample is a simple random sample form its population. Each individual in the population has an equal probability of being selected in the sample.
  4. The variances for the groups are equal.


Hypotheses

The null hypothesis (H0) and alternative hypothesis (H1) of the one sample T test can be expressed as:

H0: µ1 =  µ2 

 H1: µ1 ≠  µ2 

where µi is the population mean of population i.


Test Statistic 



  • Where n1 and n2 are sample sizes
  • x̅1 and x̅2 are means of sample sizes
  • Sp is the pooled standard deviation


P-value

P-value = Pr(|t_n1+n2-2| > |t|) = 2Pr(t_n1+n2-2 > |t|)

If p-value is less than 0.05 significant level, then the null hypothesis is true, there is a significant different between 2 groups.

If p-value is greater than 0.05 significant level, then the null hypothesis should be rejected, there is no significant different between 2 groups.


Relation with Linear Regression

Y = b_0 + b1x + e

Then,

H_0 : µ1 =  µ2  <=> H_0 : b_1 = 0

H_1 : µ1 ≠  µ2 <=> H_1 : b_0 ≠ 0


R code

(from STA305 assignment)

















 

Reference

https://libguides.library.kent.edu/SPSS/OneSampletTest

Comments

  1. I also learned this t-test, your summary is very helpful to understand it.

    ReplyDelete
  2. I just was asking the two sample t-test in the one sample t-test post, yo save my life!!! I was so interesting on the statistic right now!!

    ReplyDelete
  3. I was confused about the two sample t-test definition. Your post helped me so much! Thank you so much!

    ReplyDelete
    Replies
    1. I didn't understand neither before I took STA302 and STA303!

      Delete
  4. Very impressive! This is helpful for me to review the content on two sample t-test.

    ReplyDelete
  5. It's helpful with my assignments and tests! Thank you for sharing!

    ReplyDelete
  6. Nice explanation with examples, make the concept very easy to understand.

    ReplyDelete
  7. I saw many comment asking about the difference between one sample and two sample t-test. Here is what I got:
    The 2-sample t-test takes your sample data from two groups and boils it down to the t-value. The process is very similar to the 1-sample t-test, and you can still use the analogy of the signal-to-noise ratio. Unlike the paired t-test, the 2-sample t-test requires independent groups for each sample.

    ReplyDelete

Post a Comment