MSK Institute LogoMSK.Institute
HomeCourses
Book Free Demo➔Sign In
Free Demo➔
MSK Institute LogoMSK.Institute

Leading computer training academy in Shikohabad for software engineering, Python, web development, and digital literacy.

ISO 9001:2015 Certified Center
Follow & Connect
4.9

Programs & Admissions

  • All CoursesCatalog
  • Learning PathsRoadmaps
  • Student ProjectsShowcase
  • Live Classes & ScheduleLive
  • Upcoming Batches
  • Campuses & LocationsHub
  • Verify Certificates
  • Book Free Demo Class

Resources & Tools

  • Free Online Mock TestsAll Tests
  • NIELIT CCC Mock TestFree
  • Course & Career FinderQuiz
  • Study Material Hub
  • All MSK ToolsHub
  • Keyboard ShortcutsNew
  • TypeQuest Speed LabTyping
  • MSK Code PlaygroundCode
  • Interactive Tutorials
  • Quick Cheatsheets

Institute & Contact

  • About MSK Institute
  • Careers & InternshipsHiring
  • Publications & Blogs
  • Gali No. 3, Near Gyan Jyoti Public School,
    Adarsh Nagar, Shikohabad, Uttar Pradesh 283135
  • +91 83930 42166
  • mskshikohabad@gmail.com
  • Hours:Mon – Sat: 8:00 AM – 7:00 PM | Sun: 10:00 AM – 2:00 PM
  • 4.9 ★(38 Google Reviews)
© 2026 MSK Institute. All rights reserved.•Privacy Policy•Terms of Service•Disclaimer•Contact Us

Shikohabad's Leading Computer & Coding Academy

Home
Courses
Live
Material
T-Tests (One-sample, Two-sample independent & Paired)0%
Study MaterialsCheatsheet
Data Visualization & Applied StatisticsProgress 0%
1.1Why Data Visualization Matters in Decision Making1.2Python Visualization Landscape: Matplotlib vs Seaborn vs Plotly1.3Setting Up Jupyter, Inline Plotting & Figure Sizing
5.1Formulating Null & Alternative Hypotheses & p-values5.2T-Tests (One-sample, Two-sample independent & Paired)5.3Chi-Square Test of Independence & ANOVA Basics5.4A/B Testing Framework for Business & Product Decisions
HomeTutorialsData Visualization & Applied StatisticsT-Tests (One-sample, Two-sample independent & Paired)
Chi-Square Test of Independence & ANOVA Basics

T-Tests (One-sample, Two-sample independent & Paired)

Intermediate6 min read•Updated: 2026-11-18•By Er. Sumit Kumar (MSK Institute)
Study MaterialsCheatsheet

1. When to Use a T-Test?

A Student's t-test determines whether the means of two groups are statistically different from each other.

The 3 Variations of T-Tests:

  1. 1
    One-Sample T-Test: Compares the mean of a single group against a known population benchmark $\mu_0$.
  2. 2
    Two-Sample Independent T-Test: Compares the means of two distinct, unrelated groups (e.g. Website Variant A vs Variant B).
  3. 3
    Paired T-Test: Compares measurements taken on the same subjects before and after an intervention (e.g. Employee skills test Before vs After training).

2. Python Implementation with scipy.stats

1import numpy as np
2from scipy import stats
3 
4# Variant A (Control group conversions)
5group_A = np.array([45, 52, 48, 55, 49, 53, 50, 47, 51, 54])
6# Variant B (New feature group conversions)
7group_B = np.array([58, 62, 59, 65, 57, 63, 61, 60, 64, 59])
8 
9# Perform Two-Sample Independent T-Test
10# equal_var=False performs Welch's t-test (best practice!)
11t_stat, p_val = stats.ttest_ind(group_A, group_B, equal_var=False)
12 
13print(f"T-Statistic: {t_stat:.4f}")
14print(f"P-Value: {p_val:.6f}")
15 
16if p_val < 0.05:
17 print("Conclusion: Reject H0! Variant B produces statistically significantly higher conversions.")
18else:
19 print("Conclusion: Fail to reject H0.")

Output:

1T-Statistic: -8.8415
2P-Value: 0.000000
3Conclusion: Reject H0! Variant B produces statistically significantly higher conversions.

Interactive Quiz• Knowledge Check

Practice Quiz

Question 1
Which function in scipy.stats conducts an independent two-sample t-test between two groups?
Question 2
Why is setting equal_var=False recommended when running stats.ttest_ind()?
Question 3
Which t-test is appropriate when testing the test scores of the same 30 students before and after a training workshop?
Question 4
What test statistic is evaluated against Student's t-distribution in a t-test?
Question 5
If the p-value returned by stats.ttest_1samp() is 0.42, what is the proper conclusion at $alpha = 0.05$?

Next Lesson

Chi-Square Test of Independence & ANOVA Basics

Continue learning with hands-on practice, examples, and exercises in the upcoming topic.

Related Lessons

Previous LessonNext Lesson
Formulating Null & Alternative Hypotheses & p-valuesChi-Square Test of Independence & ANOVA Basics

Practice Quiz

Test your understanding of this lesson with 5 questions. Each question has one correct answer.

12-Month Data Analysis Mastery Program

Master Full-Stack Data Analytics (Excel, SQL, Python, Power BI & Tableau)

Combine 15 complete courses, 150 chapters, 541 topics, live SQL/Power BI/Tableau dashboards, and Scikit-Learn capstones at MSK Institute Shikohabad or Live Online.

View Full CourseBook Free Demo
PreviousNext
PreviousPrevNext