TECHNOLOGIESTieInn Technologies

Hypothesis tests and p-values

Statistics · 13 questions

Short notes

Key idea

A hypothesis test asks: if nothing real were going on (the null hypothesis), how surprising would this data be? The p-value is that probability. A small p-value means the data would be unusual under the null, so we reject it.

Syntax

from scipy import stats
stats.ttest_ind(a, b)            # two group means
stats.ttest_1samp(x, 500)        # one mean vs a value
stats.chi2_contingency(table)    # two categories related?
  • Choose α (usually 0.05) before looking. Reject the null if p < α.

Example

New checkout page: average order ₹910 vs ₹880 on the old one, p = 0.03. At α = 0.05 we reject "no difference". Whether ₹30 is worth the change is a business call, not a statistical one.

Traps

  • p is not the probability the null is true.
  • Not significant doesn't prove "no effect"; the sample may be too small.
  • Statistically significant isn't the same as important: with huge samples tiny differences pass.
  • Testing many things at once produces false positives (1 in 20 at α = 0.05).
  • Type I error: a false alarm. Type II: a missed real effect.

Want the full lesson with step-by-step examples, a project and a certificate? Statistics course, ₹120 →

Questions

Open in Code Lab5 free questions
5 questions

    Hypothesis tests and p-values

  1. Question 1easy

    A test gives p = 0.02. Which statement is correct?

  2. Hypothesis tests and p-values

  3. Question 2easy

    With α = 0.05, which result lets you reject the null hypothesis?

  4. Hypothesis tests and p-values

  5. Question 3medium

    A test on 15 customers gives p = 0.30. What can you conclude?

  6. Hypothesis tests and p-values

  7. Question 4medium

    You want to know if cancellation rates differ between UPI, Card, and COD orders. Which test fits?

  8. Hypothesis tests and p-values

  9. Question 5hard

    You test 20 different website changes at α = 0.05, and none truly has an effect. How many would you expect to look significant by chance?

8 more questions on this topic, with hints, and tests

Sign up free for 21 days of every question and test.