Statistical Inference 2 — Hypothesis Testing

Sandeep Sharma
5 min readJul 13, 2022

--

Hypothesis : The purpose of hypothesis testing is to determine whether there is enough statistical evidence in favor of a certain belief about a parameter.

Hypothesis testing is the way of trying to make sense of assumptions by looking at the sample data.

The goal of a hypothesis test is decide , based on sample from a population which two complementary hypothesis is true.

Hypothesis Testing steps

•Two Complementary Hypothesis
•Test statistic
•P-value and Interpretation

Two Complementary hypothesis in a hypothesis testing problem are called Null Hypothesis and Alternative Hypothesis and they are denoted by H0 and H1 respectively.

The word “null” in this context means that it’s a commonly accepted fact that researchers work to nullify. It doesn’t mean that the statement is null itself.

Null Hypothesis : A conjecture or an assertion which is been tentatively setup for plausible rejection

Alternative Hypothesis : The alternative hypothesis is a direct contradiction of the null hypothesis

Hypothesis Testing : Example

EG 1 :

A researcher thinks that if knee surgery patients go to physical therapy twice a week (instead of 3 times), their recovery period will be longer. Average recovery times for knee surgery patients is 8.2 weeks.

Null and Alternative Hypothesis should be formed as below:

************ H0: μ = 8.2 vs H1: μ > 8.2 ************

EG 2 :

A researcher is studying the effects of radical exercise program on knee surgery patients. There is a good chance the therapy will improve recovery time, but there’s also the possibility it will make it worse. Average recovery times for knee surgery patients is 8.2 weeks.

Null and Alternative Hypothesis should be formed as below:

*********** H0: μ = 8.2 vs H1: μ ≠ 8.2 ************

One Sided & Two Sided Tail Test

One Sided (Tailed) Test :

A one-tailed test is a statistical test in which the critical area of a distribution is one-sided so that it is either greater than or less than a certain value, but not both. If the sample being tested falls into the one-sided critical area, the alternative hypothesis will be accepted instead of the null hypothesis

H0 : μ = 8.2 vs H1: μ > 8.2

Two Sided (Tailed) Test :

In statistics, a two-tailed test is a method in which the critical area of a distribution is two — sided and tests whether a sample is greater or less than a range of values.

H0: μ = 8.2 vs H1: μ ≠ 8.2

Critical Region : A critical region, also known as the rejection region, is a set of values for the test statistic for which the null hypothesis is rejected. i.e. if the observed test statistic is in the critical region then we reject the null hypothesis and accept the alternative hypothesis.

When to use which test

When to use which test

Example —20–29 year old men in the India had a mean μ body weight of 170 pounds. Standard deviation σ was 40 pounds. We need to test whether mean body weight in the population now differs.

•Null hypothesis: —
•H0: μ = 170 (“no difference”)

  • Alternative hypothesis: —
    •Ha: μ > 170 (one-sided test) or
    •Ha: μ ≠ 170 (two-sided test)

This is an example of a one-sample test of a mean when σ is known. Use this statistic to test the problem:

Details we know : — μ0 = 170 and σ = 40

Take an SRS of n = 64
If we found a sample mean of 173, then
If we found a sample mean of 185, then

One-sided P-value for Zstat of 0.6

One-sided P-value for Zstat of 0.6

One-sided P-value for Zstat of 3.0

One-sided P-value for Zstat of 3.0

Hypothesis Testing : P — Value

P — Value : Probability Value. Proof against null hypothesis.

It’s the measure of the inconsistency between the hypothesized value for a population parameter and the observed sample statistic. How likely is this sample if the Ho is really true?

Reject if P-Value ≤ Alpha

Fail to reject if P-Value > Alpha

Hypothesis Testing : Type of Error

We have already covered Confusion matrix and Types of error extensively in below mentioned blogs:

  1. Confusion Matrix
  2. Recall vs Precision in Confusion Matrix

Error & Power:

  1. Type I error rate (or significance level) (α): The probability of finding an effect that isn’t real (false positive).
  2. Type II error rate (β) : The probability of missing an effect (false negative).
  3. Statistical Power (1-β) : The probability of finding an effect if it is there (the probability of not making a type II error).

Hypothesis Testing vs Estimation

Thank you for reading. Links to other blogs: —

Confusion Matrix
Statistical Inference — Estimation
Recall vs Precision in Confusion Matrix
Bayesian Generalized Linear Model (Bayesian GLM) — 2
Central Limit Theorem — Statistics
General Linear Model — 2
General and Generalized Linear Models
10 alternatives for Cloud based Jupyter notebook!!

--

--

Sandeep Sharma
Sandeep Sharma

Written by Sandeep Sharma

Manager Data Science — Coffee Lover — Machine Learning — Statistics — Management Consultant — Product Management — Business Analyst

No responses yet