Skip to content
Learn Netverks

Lesson

Step 8/36 22% through track

hypothesis-testing-preview

Hypothesis testing preview

Last reviewed May 28, 2026 Content v20260528
Track mode
server_script
Means
Server runner
Reading
~2 min
Level
beginner

This lesson

This lesson teaches Hypothesis testing preview: SciPy scientific routines on NumPy arrays—statistics, optimization, linear algebra, and numerical methods.

p-values without assumptions mislead stakeholders—know your test and sample design first.

You will apply Hypothesis testing preview in contexts like: A/B tests, experiment analysis, and quality-control sampling.

Read the narrative, run NumPy + SciPy snippets in the playground (install scipy and numpy with pip if needed), inspect outputs and convergence, and complete MCQs.

When you can explain the previous lesson's ideas in your own words.

Hypothesis tests answer: is this pattern likely under a null model? SciPy returns a test statistic and p-value. Always pair with effect size and domain context from Data Science ethics.

Null and alternative

  • Null (H₀) — default claim (e.g. two groups have equal means)
  • Alternative (H₁) — what you seek evidence for
  • α — significance threshold (often 0.05)—not a magic line
  • p-value — evidence against H₀ given the data and model assumptions

Common tests

  • ttest_ind — two independent samples (Welch variant for unequal variance)
  • ttest_rel — paired measurements
  • mannwhitneyu — nonparametric two-sample
  • chi2_contingency — categorical association

Two-sample example

import numpy as np
from scipy import stats

a = np.array([1.2, 1.5, 1.1, 1.4])
b = np.array([1.8, 1.9, 2.0, 1.7])
t = stats.ttest_ind(a, b, equal_var=False)
print(t)

Important interview questions and answers

  1. Q: p-value = 0.03 means?
    A: If H₀ were true, ~3% of repeats would show a statistic at least this extreme—not 3% chance H₀ is false.
  2. Q: When nonparametric?
    A: Skewed data, outliers, or ordinal scales—Mann-Whitney instead of t-test.

Self-check

  1. Define null hypothesis in one sentence.
  2. When use Welch's t-test (equal_var=False)?

Tip: Always report effect size and sample n—not only p-values from ttest_ind.

Interview prep

Welch t-test?

ttest_ind with equal_var=False for unequal variances.

Paired data?

ttest_rel when same subject measured twice.

Interview tip Lesson completion confidence

Can you explain this lesson in 30 seconds without reading notes?

Not saved yet.

Playground

Runs on the configured server runner (dev: npm run runner with LEARNING_RUNNER_ENABLED=true). Output appears below the editor.

Check yourself

Multiple choice — immediate feedback.

Discussion

Past discussion is visible to everyone. Only logged-in users can post comments and replies.

Starter discussion topics

  • p-value meaning?
  • Assumptions?

Sign up or log in to post comments and sync lesson progress across devices.

No discussion yet. Be the first to ask a question.

Jump