My college principal doesn't know that his daughter is my girlfriend, but today he and his wife suddenly came to the same ice cream parlor where we were eating ice cream.
Me standing there like, "Bro, this is how my college journey ends."
The principal starts interrogating me:
- Why are you here?
- Give your father's phone number
- When will you pay the college fee?
But then his wife saved us โ she's my math professor! The principal and his wife have totally different personalities.
The principal is totally orthodox and his wife is totally modern. I mean, how did they even get married?
I guess they didn't do a T-Test before marrying each other.
T-Test is nothing but a statistical way to determine if there's a real difference between two groups or if it's just due to random chance.
If t is small โ The difference could easily be random
If t is big โ The difference is too big to be just random
Formula:
t = (xฬโ - xฬโ) / (spโ(1/nโ + 1/nโ))
Where:
- xฬโ, xฬโ: Sample means
- nโ, nโ: Sample sizes
- t: T-statistic
- sp: Pooled standard deviation
Pooled standard deviation is a way to say "If I mixed these two groups together, how much would the individual values typically differ from their average?"
Formula of sp:
โ(((nโ-1)sโยฒ + (nโ-1)sโยฒ) / (nโ+nโ-2))
Where:
- nโ, nโ: Sample sizes
- sโ, sโ: Standard deviations
Let's take an example:
A coffee shop claims their new brewing method makes coffee taste better. They test 30 customer with old method (avg. rating: 7.2) and 30 customer with new method (avg. rating 8.1). Standard deviations are 1.5 and 1.3 respectively.
Sample sizes
- nโ = 30
- nโ = 30
Sample means
- xฬโ = 7.2
- xฬโ = 8.1
xฬโ - xฬโ = 8.1 - 7.2 = 0.9
Standard deviations
- sโ = 1.5
- sโ = 1.3
We see a difference of 0.9 points
(8.1 - 7.2 = 0.9). But is this difference real, or could it just be because we happened to pick 30 lucky customers for the new method?
Let's solve step by step:
Step 1: Set up Hypotheses
Hโ: No difference between methods
Hโ: New method is better
Step 2: Pooled Standard Deviation
โ(((nโ-1)sโยฒ + (nโ-1)sโยฒ) / (nโ+nโ-2))
- sp = โ(((29)(1.5)ยฒ + (29)(1.3)ยฒ) / 58)
- sp = โ((65.25 + 49.01) / 58) = 1.4
Step 3: Calculate T-statistic
t = (xฬโ - xฬโ) / (spโ(1/nโ + 1/nโ))
- t = (8.1 - 7.2) / (1.4โ(1/30 + 1/30))
- t = (0.9) / (1.4 ร 0.258)
- t = 2.49
What does t = 2.49 mean?
The difference we observed (0.9) is 2.49 times bigger than what we'd typically expect from random chance alone.
Step 4: Calculate Degrees of freedom
- df = nโ + nโ - 2 = 58
Step 5: Determine Critical Value
- Search T-Table on Google
- and check critical value for
- ฮฑ = 0.05 and df = 58
According to the t-table, critical value is ยฑ2.00
Why ฮฑ = 0.05?
Alpha is your "tolerance for being wrong." It's just a convention! Scientists agreed: Let's not accept results unless we're 95% sure.
You can change value of 'ฮฑ' according to your tolerance level.
Step 5: Make Decision
- Our calculated t = 2.49
- Critical value = ยฑ2.00
- |t| = 2.49 > 2.00
The difference is too big to be just random chance. We reject Hโ!
Final Answer:
Yes! The new brewing method significantly improves coffee taste ratings.
Congratulations ๐, you've just learned T-Test!
Bonus: Applications of T-Test in Real Life & AI/ML
1. A/B Testing: Every time you see "Version A vs Version B" on websites, apps, or marketing campaigns โ that's T-Test in action!
2. Medical Research:
- New drug vs old drug effectiveness
- Recovery time comparison
- Side effects analysis
3. Data scientists use T-Tests to compare machine learning models:
- Model A vs Model B accuracy
- Training time differences
- Performance across datasets
4. Before feeding features to ML models, T-Tests help determine:
- Which features actually matter
- Should we keep certain variables?