0% found this document useful (0 votes)
10 views134 pages

Inferential Statistics

Inferential statistics is a branch of statistics that uses sample data to make generalizations about a larger population, employing probability theory to test hypotheses and estimate parameters. It includes methods like hypothesis testing, estimation, and confidence intervals, and recognizes the uncertainty inherent in conclusions drawn from sample data. Key concepts include the distinction between sample and population, statistical significance, and various sampling techniques.

Uploaded by

deepudagar03
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views134 pages

Inferential Statistics

Inferential statistics is a branch of statistics that uses sample data to make generalizations about a larger population, employing probability theory to test hypotheses and estimate parameters. It includes methods like hypothesis testing, estimation, and confidence intervals, and recognizes the uncertainty inherent in conclusions drawn from sample data. Key concepts include the distinction between sample and population, statistical significance, and various sampling techniques.

Uploaded by

deepudagar03
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Inferential Statistics

Inferential Statistics
• Inferential statistics is a branch of statistics that uses data analyzed from a small sample to
draw conclusions, make predictions, or generalize about a larger population.

• It employs probability theory to test hypotheses and estimate parameters, helping


researchers determine if results are statistically significant or merely due to chance.

• Purpose: To make inferences (generalizations) about a population based on sample data,


which is crucial when studying the entire population is impossible, costly, or time-
consuming.
Inferential Statistics
• Sample vs. Population: Inferential statistics uses a representative sample to represent the
whole population.

• Statistical Significance (p-values): Determines if an observed effect is likely real rather


than due to chance.

• Sampling Error: Recognizing that sample results will differ from the true population due to
chance.
Descriptive Vs Inferential Statistics
Feature Descriptive Statistics Inferential Statistics

Purpose Summarize and describe data Make conclusions about a population

Data Used Only the given dataset Sample data from a population

Focus What the data shows What we can conclude beyond data

Methods Mean, median, mode, graphs Hypothesis testing, confidence intervals

Output Tables, charts, summary values Decisions, predictions, generalizations

Uncertainty No uncertainty involved Includes probability & uncertainty

Scope Limited to dataset Extends to population


Main Tasks in Inferential Statistics
1. Estimation 3. Prediction
• Estimate population parameters (mean, • Predict future outcomes
variance) • Example:
• Example: • Predict exam scores based on study time
• Sample mean → estimate of population mean

2. Hypothesis Testing 4. Confidence Intervals


• Provide a range where the true value lies
• Test assumptions about data
• Example:
• Example: • “Average score is between 70 and 75 with 95%
• “Is a new teaching method better than the old confidence”
one?”
Inferential Statistics – Uncertainty
Inferential statistics always involves:

• Probability

• Chance of error

Conclusions are not 100% certain, but probabilistic.

Inferential statistics uses sample data to make informed conclusions about a


larger population with quantified uncertainty.
Inferential Statistics – Examples
1. Testing a New Medicine 5. Product Defects
• Test drug on a small group of patients • Inspect 100 items from a factory
• Decide if it is effective for the whole population • Estimate defect rate of entire production
• Concept: Hypothesis Testing • Concept: Proportion Estimation
2. Study Hours vs Marks 6. Pass Percentage
• Collect data from 30 students • Check results of one class section
• Predict marks for all students based on study time • Infer pass percentage of the whole school
• Concept: Regression / Prediction • Concept: Inference from sample
3. Quality of Fruits 7. Teaching Method Comparison
• Check sample fruits from a batch • Test two teaching methods on small groups
• Decide if the whole batch is good • Decide which is better for all students
• Concept: Hypothesis Testing
• Concept: Sampling + Decision Making
8. Election Poll
4. Average Waiting Time • Survey 200 people about voting preference
• Record waiting time of 20 customers • Predict who will win the election
• Estimate waiting time for all customers • Concept: Prediction + Sampling
• Concept: Confidence Interval
Types of Sampling
Sampling

Probability Sampling (Random Sampling)


Probability / Non Non-Probability Sampling
Random Probability
• Every member of the population has a • Selection is not random
known, non-zero chance of being
Simple
selected. Convenience
Random
• More accurate and unbiased
• Preferred for statistical analysis Judgement /
Systematic
Purposive

Stratified Snowball

Cluster Quota
Probability Sampling
Simple Random Sampling Stratified Sampling
• Every individual has equal chance • Divide population into groups (strata)
• Example: Picking names randomly from a list • Sample from each group
Systematic Sampling • Example
• Select every k-th element • Separate students into CSE, ECE, MECH
• Example: Every 10th student in a list • Take samples from each branch
Cluster Sampling
• Divide population into clusters
• Randomly select entire clusters
• Example: Select 2 colleges and survey all students in
them
Convenience Sampling
Non Probability Sampling
• Choose samples that are easy to access
• Example: Survey students in your classroom
Judgment (Purposive) Sampling
• Researcher selects samples based on their expertise, knowledge, or judgment about which subjects are most useful or
representative
• Instead of selecting randomly, you deliberately choose the “right” samples that best serve the purpose of the study.
• Example: Choosing experienced doctors to evaluate a treatment
Snowball Sampling
• Existing participants refer others
• Example: Start with a few patients. Ask them to refer others with the same condition
Quota Sampling
• Fixed number from each group (non-random)
• Example: College Survey: 50 students from CSE, 50 from ECE, 50 from MECH
Students are selected conveniently until each quota is filled.
Probability Vs Non Probability Sampling

Feature Probability Sampling Non-Probability Sampling


Selection Random Non-random
Bias Low Higher
Accuracy High Lower
Use Research, analysis Quick surveys
Estimation
• Estimation is a technique for calculating information about a bigger group from a smaller sample, and statistics are
crucial for analyzing data.
• It enables researchers to make inferences about large populations without testing every individual.
Estimation
Population Parameter vs. Sample Statistic:
• A parameter is a numerical characteristic of the entire population (e.g., population mean), while a statistic is a
numerical characteristic of a sample (e.g., sample mean).
Estimator:
• A sample statistic (formula) used to calculate an estimate of a parameter.
• A good estimator should be unbiased (expected value equals the parameter), consistent (approaches the true value
as sample size increases), and efficient (lowest variance).
• It is a function of sample data (e.g., formula for sample variance).
• A good estimator is usually unbiased (averages to the true parameter), efficient (has low variance), and consistent
(accuracy increases with sample size).
• Common Examples:
• Sample Mean (ഥ
𝒙): Estimator for the population mean (𝜇).
• Sample Variance (𝒔𝟐 ): Estimator for the population variance (𝜎 2 ).
• Sample Proportion (𝒑): Estimator for the population proportion (𝑃).
Estimation – Types
Point Estimation:
• Provides a single value (statistic) as the "best guess" for a population parameter.
• Examples: The sample mean (𝑥)ҧ is a point estimate for the population mean (𝜇); the sample proportion (𝑝) is a
point estimate for the population proportion (𝑃).
Properties:
• A good estimator should be unbiased (average of sample estimates equals the true parameter) and have low
variance (high precision).
Interval Estimation:
• Provides a range of values within which the true parameter likely falls, accompanied by a confidence level (e.g., 95%
or 99%).
• This range accounts for the uncertainty or error associated with sampling.
Confidence Interval (CI): Defines the uncertainty surrounding point estimates, such as "95% certain that the true
population mean lies between 𝑥ҧ − 𝐸 and 𝑥ҧ + 𝐸".
Estimator Vs Estimate
1. Estimator (Rule / Formula)
• An estimator is a mathematical rule or function used to estimate an unknown population parameter.
• It is a random variable because it depends on sample data.
• Example:

𝑛
1
𝜇ො = ෍ 𝑋𝑖
𝑛
𝑖=1
• This formula is the estimator of the population mean 𝜇
• Estimator → method or formula
Estimator Vs Estimate
2. Estimate (Numerical Value)
An estimate is the actual numerical value obtained when you apply the estimator to a dataset.
Example:
If your sample is:
246
Then:

2+4+6
𝜇ො = =4
3
Here, 4 is the estimate
Estimate = result or number
Estimator Vs Estimate
Properties of Estimators

• Bias
• Variance
• Consistency
Bias

• Measures systematic deviation from the true parameter


• Based on the average over repeated samples
Intuition
• If estimates are consistently shifted → biased
• If centered correctly → unbiased
Interpretation
• Zero bias → centered correctly
• Non-zero bias → systematically shifted
• Bias is about accuracy of the center, not spread
Variance

• Measures spread of estimates around their mean


• High variance → estimates fluctuate a lot
• Low variance → estimates are stable
• Variance reflects reliability / stability
Consistency
An estimator 𝜃෠𝑛 is consistent if:
𝑃
𝜃෠𝑛 ՜ 𝜃 as 𝑛 ՜ ∞
Meaning:
• As sample size increases, the estimator converges to the true value.
• An estimator is consistent if:
Properties of Good Estimators

• Unbiasedness: The estimator's average value is equal to the parameter.


• Consistency: The estimate approaches the true population parameter as the sample size increases.
• Efficiency: The estimator has the minimum variance, making it more reliable.
• Sufficiency: The estimator utilizes all available information in the data regarding the parameter.
Methods of Estimation
Estimation methods are techniques used to estimate unknown population parameters 𝜃using sample data.
Main Methods:
• Method of Moments (MoM)
• Maximum Likelihood Estimation (MLE)
• Bayesian Estimation (MAP included)
Method of Moments
• The Method of Moments (MoM) is a technique in statistics for estimating population parameters by
equating sample moments (e.g., mean, variance) to theoretical population moments.
• It provides simple, computationally efficient, and often consistent estimators by solving equations that
match sample data properties with distribution characteristics.
• Moments describe the shape and characteristics of a probability distribution. For a random variable X, the
r-th moment about the origin is defined as:

E(Xr) is the expected value of Xr.


r is the order of the moment.
Method of Moments
Types of Moments:
1 𝑛
1. First Moment: Mean (μ) 𝜇 = 𝐸 𝑋 = σ𝑖=1 𝑋𝑖
𝑛
1 𝑛
2. Second Moment: Variance (σ2) 𝜎2 =𝐸 𝑋−𝜇 2 = ෌𝑖=1( 𝑋𝑖 − 𝜇)2
𝑛
𝐸 𝑋−𝜇 3
3. Third Moment: Skewness (measures asymmetry) Skewness =
𝜎3
𝐸 𝑋−𝜇 4
4. Fourth Moment: Kurtosis (measures tail heaviness) Kurtosis =
𝜎4
Method of Moments
1. Estimating Parameters of a Normal Distribution
Method of Moments
2. Estimating Parameters of an Exponential Distribution
Applications of Method of Moments
1. Parameter Estimation: Estimating the parameters of probability distributions, such as normal, exponential,
Poisson, and binomial distributions.

2. Risk Modeling: Used in actuarial science and finance to estimate risk parameters.

3. Machine Learning and AI: Applied in generative models and Bayesian networks for parameter learning.

4. Economics and Econometrics: Estimation of economic models where moment conditions are specified.
Advantages of Method of Moments
1. Simplicity: Easy to implement and does not require complex optimization techniques.

2. Computational Efficiency: Faster than maximum likelihood estimation (MLE) for large datasets.

3. Flexibility: Can be applied to various distributions and models.


Maximum Likelihood Estimation
• Maximum Likelihood Estimation (MLE) is a statistical method for estimating the parameters of a probability
distribution by maximizing a likelihood function, making the observed data most probable.

• It finds parameter values 𝜃መ that maximize 𝐿 𝜃; 𝑥 = 𝑃 𝑋 = 𝑥; 𝜃 , commonly using log-likelihood for


easier calculation, and is favored for its flexibility and asymptotic efficiency.

• Basic Idea: Choose parameter 𝜃 that maximizes probability of observed data


Maximum Likelihood Estimation
• MLE answers the question:
“Given observed data, which parameter value makes this data most likely?”
• We do not change the data
• We adjust the parameter to maximize probability
• Likelihood Function:
Maximum Likelihood Estimation
• Log Likelihood Function:
Maximum Likelihood Estimation
MLE – Worked Out Examples
Bernoulli Distribution

Result: Sample mean


MLE – Worked Out Examples
Gaussian Distribution
MLE – Worked Out Examples
Exponential Distribution
Exponential distribution models:
• Time between events
• Failure rates
• Waiting times (queues, reliability systems)
1) Model Assumption
3. Log-Likelihood Function
Let:
Take logarithm:
𝑋1 , 𝑋2 , … , 𝑋𝑛 ∼ Exponential 𝜆 𝑛
The PDF is: ℓ 𝜆 = 𝑛 log 𝜆 − 𝜆 ෍ 𝑥𝑖
𝑖=1
𝑓 𝑥 ∣ 𝜆 = 𝜆𝑒 −𝜆𝑥 , 𝑥 ≥ 0
2) Likelihood Function
For independent samples:
𝑛 4. Differentiate
𝐿 𝜆 =ෑ 𝜆 𝑒 −𝜆𝑥𝑖 Differentiate w.r.t. 𝜆:
𝑖=1
𝑑ℓ 𝑛
Simplify: = − ෍ 𝑥𝑖
𝑑𝜆 𝜆
𝐿 𝜆 = 𝜆𝑛 𝑒 −𝜆 ෌𝑥𝑖
MLE – Worked Out Examples
Exponential Distribution
7. Verify Maximum (Second Derivative)
5. Find Critical Point 𝑑2ℓ 𝑛
Set derivative = 0: = − <0
𝑑𝜆2 𝜆2
𝑛 Negative ⇒ Maximum confirmed
− ෍ 𝑥𝑖 = 0
𝜆
Solve:
𝑛
𝜆=
σ 𝑥𝑖

6. Final Result
1
𝜆መ = ˉ
𝑥
where:
ˉ 1
𝑥= ෍ 𝑥𝑖
𝑛
Interpretation of MLE
•The MLE of 𝜆depends only on the sample mean
•Larger average → smaller 𝜆
•Smaller average → larger 𝜆
Intuition:
•If events take longer time, rate 𝜆is low
•If events happen quickly, rate 𝜆is high
Maximum Likelihood Estimation
• Bayesian estimation is a statistical method that updates the probability of a parameter (unknown quantity) by
combining prior knowledge (prior distribution) with observed evidence (likelihood) using Bayes' theorem to
form a posterior distribution.

• Unlike frequentist methods, it treats the parameter as a random variable, making it useful for small datasets
and sequential learning.
Bayesian Estimation
• Bayesian estimation is a statistical method that updates the probability of a parameter (unknown quantity) by
combining prior knowledge (prior distribution) with observed evidence (likelihood) using Bayes' theorem to
form a posterior distribution.

• Bayesian approach treats parameters as random variables

• We combine:

• Prior belief about parameter

• Evidence from data


Bayesian Estimation
Bayes’ Theorem (Foundation)
𝑝 𝑋∣𝜃 𝑝 𝜃
𝑝 𝜃∣𝑋 =
𝑝 𝑋
Where:
X → observed data (fixed)
θ → model parameter (unknown)
𝑝 𝜃 :Prior
𝑝 𝑋 ∣ 𝜃 :Likelihood
𝑝 𝜃 ∣ 𝑋 :Posterior
𝑝 𝑋 :Evidence (normalization constant)
𝑝 𝑋 ∣ 𝜃 → Probability (or likelihood) of observing data 𝑋, given parameter 𝜃
𝑝 𝜃 ∣ 𝑋 → Probability distribution of parameter 𝜃, given observed data 𝑋
Bayesian Estimation
Bayes’ Theorem (Foundation)
𝑝 𝑋∣𝜃 𝑝 𝜃
𝑝 𝜃∣𝑋 =
𝑝 𝑋
𝒑 𝑿 ∣ 𝜽 → Likelihood
• Measures how compatible a parameter is with observed data
• How well does this hypothesis explain the observed data?

𝒑 𝜽 ∣ 𝑿 → Posterior (parameter given data)

• Represents updated knowledge about parameters after observing data


• It answers:
• “After seeing the data, what do we now believe about the parameter?”
• Before data → we had a prior belief

• After data → we update it to posterior belief


Confidence Interval
Interval estimate
• Range of plausible values
• Captures uncertainty
• More informative than a single number

Confidence interval

• A range of values within which the true population parameter lies with a
specified probability (confidence level).
CI = Estimator ± Critical Value × Standard Error
Confidence Interval
Mathematical Foundation

Step 2: Construct a Standard Normal Variable


Confidence Interval
Confidence Interval
Confidence Interval – Problems
ˉ
A sample of size 𝒏 = 𝟑𝟔has mean 𝑿 = 𝟓𝟎.Population standard deviation 𝝈 = 𝟏𝟐.

Construct a 95% confidence interval for the population mean.

1 − 𝛼 = 0.95
𝛼
α = 0.05 → = 0.025
2

Confidence Interval:
Confidence Interval – Problems
ˉ
A sample of size 𝒏 = 𝟑𝟔has mean 𝑿 = 𝟓𝟎.Population standard deviation 𝝈 = 𝟏𝟐.

Construct a 95% confidence interval for the population mean.

1 − 𝛼 = 0.95
𝛼
α = 0.05 → = 0.025
2

Confidence Interval:
Confidence Interval – Problems
ഥ = 𝟏𝟎𝟎 ,𝝈 = 𝟐𝟎 ,𝒏 = 𝟔𝟒
Given: 𝑿
Find 99% confidence interval.
Confidence Interval – Problems
ഥ = 𝟏𝟎𝟎 ,𝝈 = 𝟐𝟎 ,𝒏 = 𝟔𝟒
Given: 𝑿
Find 99% confidence interval.

1 − 𝛼 = 0.99
𝛼
α = 0.01 → = 0.005
2

Confidence Interval:
Confidence Interval – Problems
For a fixed 𝝈, what happens to CI width if:
• Sample size increases?
• Confidence level increases?

• Larger 𝑛 → narrower CI
• Higher confidence → wider CI
Confidence Interval – Problems
Two samples:
Sample A: 𝒏 = 𝟐𝟓
Sample B: 𝒏 = 𝟏𝟎𝟎
Which has a narrower CI (same 𝝈)?

• Sample B (larger 𝒏)
• Because 𝒏is larger → smaller standard error
A/B Testing
A/B testing (also called split testing / significance tests) is a statistical method used to compare two versions
of something to determine which performs better.
Version A → Control group
Version B → Treatment group
Goal: Determine whether the observed difference is statistically significant or just due to random variation.

A control group is the group that:


• Receives the standard, existing, or no treatment
• Serves as a reference point to evaluate the effect of a new intervention (treatment)
A/B Testing – Examples
• Testing two soil treatments to determine which produces better seed germination
• Testing two therapies to determine which suppresses cancer more effectively
• Testing two prices to determine which yields more net profit
• Testing two web headlines to determine which produces more clicks
• Testing two web ads to determine which generates more conversions
A/B Testing – Connection to Inferential Statistics
A/B testing is essentially hypothesis testing applied to real-world experiments.
Hypotheses:
• Null Hypothesis (H₀): No difference between A and B
• Alternative Hypothesis (H₁): There is a difference
Example:
• H₀: Conversion rate(A) = Conversion rate(B)
• H₁: Conversion rate(A) ≠ Conversion rate(B)
Hypothesis Tests
• Hypothesis testing is a statistical method used to make decisions about a population based on sample data.
• Also called as Significance Tests
It answers:
“Is the observed effect real, or just due to random chance?”
Hypothesis Tests – Steps
Step 1: State Hypotheses
• Define H₀ and H₁
Step 2: Choose Significance Level (α)
• Common choice: α = 0.05
Step 3: Select Test Statistic
• Depends on problem type:
Step 4: Compute Test Statistic
Step 5: Compute p-value
• Probability of observing data assuming H₀ is true
Step 6: Decision Rule
• If p ≤ α → Reject H₀
• If p > α → Fail to reject H₀
Hypothesis Tests – Steps
Step 1: State Hypotheses
• Define H₀ and H₁
Step 2: Choose Significance Level (α)
• Common choice: α = 0.05
Step 3: Select Test Statistic
• Depends on problem type:
Step 4: Compute Test Statistic
Step 5: Compute p-value
• Probability of observing data assuming H₀ is true
Step 6: Decision Rule
• If p ≤ α → Reject H₀
• If p > α → Fail to reject H₀
Hypothesis Tests – Types
Category

• One Tailed Test


Based on Direction of Hypothesis
• Two Tailed Test
• Z Test
• t Test
Based on Type of Data / Parameter
• Chi Square Test
• ANOVA
• Parametric Test
Based on Assumptions
• Non Parametric Test
• Independent Sample Test
Based on Sample Relationship
• Paired Sample Test
• Univariate
Based on Number of Variables
• Multivariate
Direction of Hypothesis
A directional hypothesis provides a perspective of the expected relationship between variables, predicting
the direction of that relationship (either positive, negative, or a specific difference).

Examples:
• This hypothesis predicts that as screen time before bed increases, sleep quality decreases

• As consumption of healthy foods increases, an individual’s body weight decreases

• The association between sun exposure (independent variable) and skin health (dependent variable)
allows for a definitive hypothesis declaring that as sun exposure increases, the risk of skin damage or
skin cancer increases.
One Tailed Tests
• One-tailed tests in statistics focus on one direction in the distribution to determine if a sample mean is significantly
greater or less than a population mean.
• This approach is especially useful in finance when testing hypotheses, such as an investment outperforming the
market.
• If the data falls in the critical region, statisticians reject the null hypothesis in favor of the alternative.
• A one-tailed test in statistics is used to determine if a sample mean is significantly higher or lower than a population
mean.
• This test focuses on the possibility of a relationship in only one direction, either greater than or less than, but not
both.
• Analysts utilize the one-tailed test to validate investment hypotheses by establishing null and alternative hypotheses.
• The significance level in a one-tailed test is often set at 1%, 5%, or 10% to measure the probability of rejecting a true
null hypothesis.
• A one-tailed test is chosen when it is unnecessary to consider outcomes in the opposite direction of interest.
One Tailed Tests
Key Components:
• Null Hypothesis (H₀): Default assumption (no effect / no difference)
• Alternative Hypothesis (H₁ / Hₐ): What we want to test
• Significance Level (α): Probability of rejecting a true H₀ (commonly 0.05)
• Test Statistic: Standardized value (Z, t, etc.)
• p-value: Probability of observing the result under H₀
One Tailed Tests
Types:
• Right Tailed Test
• Left Tailed Test
One Tailed Tests – Right Tailed Test
• Right Tailed Test
Hypotheses:
•H₀: μ ≤ μ₀
•H₁: μ > μ₀
We test if the parameter is greater than a certain value.
Example:
•Testing if a new algorithm improves accuracy:
• H₀: Accuracy ≤ 85%
• H₁: Accuracy > 85%
Decision Rule:
Reject H₀ if:
𝑍 > 𝑍𝛼
One Tailed Tests – Left Tailed Test

Hypotheses:
•H₀: μ ≥ μ₀
•H₁: μ < μ₀
We test if the parameter is less than a certain value.
Example:
•Testing if processing time is reduced:
• H₀: Time ≥ 2 sec
• H₁: Time < 2 sec
Decision Rule:
Reject H₀ if:
𝑍 < −𝑍𝛼
One Tailed Tests
A company claims that their new ML model has an accuracy greater than 90%.
Formulate the null and alternative hypotheses.

Claim: Accuracy > 90%


•H₀: μ ≤ 90%
•H₁: μ > 90%
Type: Right-tailed test
A dataset has: One Tailed Tests
Population mean μ₀ = 100
Solved as Right Tailed Test
Population standard deviation σ = 15
Hypotheses
Sample size n = 36
H₀: μ ≤ 100
Sample mean = 105
H₁: μ > 100
• Test at α = 0.05 whether the mean is greater
Test Statistic
than 100.
• State hypotheses
Critical Value
• Compute Z-statistic
Convert to cumulative probability:
• Find critical value 𝑃 𝑍 < 𝑧 = 1 − 0.05 = 0.95
• Make decision Look inside the Z-table for a value close to 0.9500

Decision
2.0 > 1.645 → Reject H₀
0.9500 lies between them → interpolate, 𝑍𝛼 ≈ 1.645
Conclusion: Mean is significantly greater
•For α = 0.05 → Zₐ = 1.645
than 100
One Tailed Tests
A dataset has: Solved as Left Tailed Test
Population mean μ₀ = 100
Hypotheses
Population standard deviation σ = 15
H₀: μ ≥ 100
Sample size n = 36
H₁: μ < 100
Sample mean = 105
Test Statistic
• Test at α = 0.05 whether the mean is greater
than 100.
• State hypotheses
Critical Value
• Compute Z-statistic •Computed Z = +2.0
•α = 0.05 (left-tailed)
•Critical region = Z < -1.645
• Find critical value •Critical Z = -1.645 2.0 is NOT in rejection region
• Make decision
Decision
Fail to reject H₀
One Tailed Tests
Interpretation on whether to choose Right Tailed or Left Tailed Test
• Data suggests the mean is higher than 100
• But left tailed test is checking if mean is less than 100
• So the test cannot detect the actual effect
Choosing wrong hypothesis direction leads to:
• Incorrect conclusion
• Loss of statistical power
• Missing real effect (Type II error)
Hypothesis must be:
• Based on research question
• Not chosen arbitrarily
When to Use Left-Tailed vs Right-Tailed Test

Situation Type of Test


Looking for increase / greater than Right-tailed
Looking for decrease / less than Left-tailed

Left-Tailed Test (Lower Tail)


Right-Tailed Test (Upper Tail)
Use when:
Use when:
You want to test if something is less than a benchmark.
You want to test if something is greater than a benchmark.
Hypothesis Form:
Hypothesis Form:
𝐻0 : 𝜇 ≥ 𝜇0
𝐻0 : 𝜇 ≤ 𝜇0
𝐻1 : 𝜇 < 𝜇0
𝐻1 : 𝜇 > 𝜇0

Always decide the test type before looking at data


When to Use Left-Tailed vs Right-Tailed Test

Situation Type of Test


Looking for increase / greater than Right-tailed
Looking for decrease / less than Left-tailed

Left-Tailed Test (Lower Tail)


Right-Tailed Test (Upper Tail)
Use when:
Use when:
You want to test if something is less than a benchmark.
You want to test if something is greater than a benchmark.
Hypothesis Form:
Hypothesis Form:
𝐻0 : 𝜇 ≥ 𝜇0
𝐻0 : 𝜇 ≤ 𝜇0
𝐻1 : 𝜇 < 𝜇0
𝐻1 : 𝜇 > 𝜇0

Always decide the test type before looking at data


One Tailed Tests – Problem
An image processing algorithm claims to reduce
noise level below 20 dB.
From sample data:
Sample mean = 18 dB
σ=4
n = 25
α = 0.01
Test the claim.
One Tailed Tests – Problem
An image processing algorithm claims to reduce Step 3: Critical Value
noise level below 20 dB.
Convert to cumulative probability:
From sample data:
Sample mean = 18 dB 𝑃 𝑍 < 𝑧 = 1 − 0.01 = 0.99
σ=4 α = 0.01 → Zₐ = -2.33
n = 25
α = 0.01
Test the claim.
Step 4: Decision
Left Tailed Test
Step 1: Hypotheses •-2.5 < -2.33 → Reject H₀
•H₀: μ ≥ 20 Noise is significantly reduced below 20 dB
•H₁: μ < 20

Step 2: Z (Test Statistic)


18 − 20 −2
𝑍= = = −2.5
4/ 25 0.8
One Tailed Tests – Problem
A speech enhancement system is said to increase
intelligibility score above 0.75.
Sample results:
•Mean = 0.78
•σ = 0.06
•n = 49
•α = 0.05
Test the hypothesis.

Significant improvement in intelligibility


p - Value
p-value is the probability of obtaining results at least as extreme as the observed data, assuming the null
hypothesis (H₀) is true.

“If H₀ is true, how likely is this result?”


• Small p-value → Result is unlikely under H₀ → Evidence against H₀
• Large p-value → Result is likely under H₀ → Not enough evidence to reject H₀

The p-value is found by converting the Z-score into a probability using the Z-table and selecting the appropriate tail.
p - Value

p-value = area under the curve in the extreme region(s)


•Right-tailed → area to the right
•Left-tailed → area to the left
p - Value

Example
Suppose:
• p-value = 0.03
• α = 0.05
Since: 0.03 < 0.05
Reject H₀
Problems based on p - Value
A test statistic yields: Step 2: Convert to Z-table format Step 5: Compare with α
•𝑝 = 0.036
•Z = 1.8 Z-table gives: •𝛼 = 0.05
•α = 0.05 𝑃 𝑍≤𝑧 Since:
𝑝<𝛼
For a right-tailed test, determine: So:
•Approximate p-value 𝑃 𝑍 > 1.8 = 1 − 𝑃 𝑍 ≤ 1.8 Final Decision
•Decision Reject 𝑯𝟎
Step 3: Find value from Z-table

Step 1: What is p-value?


p-value = probability of getting a value as
extreme as the observed one, assuming 𝐻0 is
true
For a right-tailed test:
𝑝−value = 𝑃 𝑍 > 1.8 Step 4: Compute p-value
𝑝 = 1 − 0.9641 = 0.0359
p-value ≈ 0.036
Problems based on p - Value
Given:
•Z = -2.1
•α = 0.05
For a left-tailed test, decide whether to reject H₀.
Problems based on p - Value
Given: Step 3: Look up Z = 2.10 in table
•Z = -2.1 From Z-table:
•α = 0.05 𝑃 𝑍 ≤ 2.10 = 0.9821
For a left-tailed test, decide whether to reject H₀.
Step 4: Convert to right-tail
Step 1: 𝑃 𝑍 > 2.1 = 1 − 0.9821
For a left-tailed test: = 0.0179
𝑝−value = 𝑃 𝑍 < −2.1
Step 5: Final p-value
We need the probability to the left of -2.1
𝑝 ≈ 0.018
Step 2: Use Z-table
Most Z-tables give: Step 6: Compare with α
𝑃 𝑍 ≤ 𝑧 for positive 𝑧 •𝑝 = 0.018
•𝛼 = 0.05 Final Decision
So use symmetry of normal distribution: 0.018 < 0.05 Reject 𝐻0
𝑃 𝑍 < −2.1 = 𝑃 𝑍 > 2.1
Two Tailed Tests
A two-tailed test checks for deviations in both directions (greater than or less than a hypothesized value). It’s used
when you want to detect any significant difference, not just an increase or decrease.

Hypotheses:
•H₀: μ = μ₀
•H₁: μ ≠ μ₀
We test for any difference, not direction-specific.
Two Tailed Tests
1. Quality Control in Manufacturing
A company produces resistors with a specified resistance of 100 ohms.
•Null hypothesis (H₀): Mean resistance = 100
•Alternative (H₁): Mean resistance ≠ 100
If the resistance is too high or too low, both are defects.
So, a two-tailed test is appropriate.
Real-world meaning: Both overperformance and underperformance are problematic.

2. Drug Effectiveness in Healthcare


A new drug is expected to maintain blood pressure at a standard level.
•H₀: Drug has no effect (mean BP = baseline)
•H₁: Drug changes BP (either increases or decreases)
Here, both increase or decrease in blood pressure are important medically.
So, we test for any change, not just improvement → two-tailed.
Two Tailed Tests
Educational Testing
A new teaching method is tested against a standard method.
•H₀: No difference in scores
•H₁: Scores are different (higher or lower)
The method could be better or worse, so both outcomes are important.
One Tailed Vs Two Tailed Tests
Choosing Between One-Tailed and Two-Tailed Tests
Use One-Tailed Test when:
•Direction is clearly defined beforehand
•Example:
• Improvement in ML accuracy
• Reduction in error rate
•Must decide before seeing data

Use Two-Tailed Test when:


•Any change matters
•No strong directional assumption
Steps in Two-Tailed Tests
1. State the Hypotheses 4. Determine Critical Values
Null hypothesis 𝐻0 : 𝜇 = 𝜇0 •Find critical values from Z or t tables using α/2
Alternative hypothesis (H₁) 𝐻1 : 𝜇 ≠ 𝜇0 •For example:
• α = 0.05 → α/2 = 0.025 → critical values = ±1.96 (Z-test)
2. Choose the Significance Level (α)
Common choices: 0.05, 0.01 5. Compute the Test Statistic
In a two-tailed test, divide α into two equal parts: •Substitute sample values into the formula
𝛼 •Obtain calculated Z or t value
in each tail
2 6. Make the Decision
Compare:
3. Select the Appropriate Test Statistic
•If
Depending on the situation:
∣ 𝑍𝑐𝑎𝑙𝑐𝑢𝑙𝑎𝑡𝑒𝑑 ∣> 𝑍𝑐𝑟𝑖𝑡𝑖𝑐𝑎𝑙
Z-test → large sample (n ≥ 30) or known population
• →Reject H₀
variance
•Otherwise
t-test → small sample & unknown population variance
→ Fail to reject H₀
Example (Z-test):
ˉ
𝑋 − 𝜇0 7. State the Conclusion
𝑍= •Interpret in context (not just mathematical terms)
𝜎/ 𝑛 •Example:
“There is sufficient evidence to conclude that the population
mean is significantly different from the hypothesized value.”
Choosing Between One-Tailed and Two-Tailed Tests
Use One-Tailed Test when:
•Direction is clearly defined beforehand
•Example:
• Improvement in ML accuracy
• Reduction in error rate
•Must decide before seeing data

Use Two-Tailed Test when:


•Any change matters
•No strong directional assumption
Two-Tailed Tests
When to use Z-test (Two-tailed)
Use a Z-test when:
• Population standard deviation (σ) is known, OR
• Sample size is large (n ≥ 30) → Central Limit Theorem applies
• Data is approximately normal (or large sample compensates)
Typical scenarios
• Testing population mean with known σ
• Testing proportions
• Comparing two large samples
When to use t-test (Two-tailed)
Use a t-test when:
• Population standard deviation (σ) is unknown
• Sample size is small (n < 30)
• Data is approximately normally distributed
Two-Tailed Tests
A manufacturer claims that the average lifetime of a bulb is 1000 hours. A sample of 36 bulbs has a mean
lifetime of 960 hours. The population standard deviation is known to be 120 hours. Test the claim at 5%
significance level.
Two-Tailed Tests
A manufacturer claims that the average lifetime of a bulb is 1000 hours. A sample of 36 bulbs has a mean
lifetime of 960 hours. The population standard deviation is known to be 120 hours. Test the claim at 5%
significance level.
Known Variance, Z-test

Step 1: Hypotheses Step 3: Critical values


•𝐻0 : 𝜇 = 1000 At 𝛼 = 0.05, two-tailed → 𝑍 = ±1.96
•𝐻1 : 𝜇 ≠ 1000(two-tailed) Step 4: Decision
Step 2: Test statistic Since −2 < −1.96, reject 𝐻0
Conclusion: The mean lifetime is significantly different from
Substitute values: 1000 hours.

960 − 1000
−40
𝑍= = = −2
120/ 36 20
Two-Tailed Tests
A sample of 16 students has an average score of 52 marks with a sample standard deviation of 8. Test
whether the population mean differs from 50 at 5% significance.
Unknown Variance, t-test Step 3: Critical values
Since it is a two-tailed test at 5% significance level:
Step 1: Hypotheses 𝛼 = 0.05
This gets split equally into both tails: 𝛼/2 = 0.025 in each tail
•𝐻0 : 𝜇 = 50
•𝐻1 : 𝜇 ≠ 50 For a one-sample t-test:
𝑑𝑓 = 𝑛 − 1 = 16 − 1 = 15
Step 2: Test statistic
52 − 50 2 Now we find the value 𝑡𝛼/2,𝑑𝑓 ,i.e.:
𝑡= = =1 𝑡0.025,15
8/ 16 2
This is obtained from the t-table: Look for column labeled: 0.05
(Because 0.05 = 2 × 0.025)
𝑡0.025,15 ≈ 2.131

Step 4: Decision
1 < 2.131, fail to reject 𝐻0
Conclusion: There is NO enough statistical evidence It does NOT mean H0 is true.
to conclude that the population mean is different It does NOT prove the mean is exactly 50
from 50.
Two-Tailed Tests
A coin is tossed 200 times and comes up heads 120 times. Test whether the coin is fair at 5% significance.
Step 1: Hypotheses
Proportion Test
•𝐻0 : 𝑝 = 0.5
•𝐻1 : 𝑝 ≠ 0.5 Step 4: Critical values

Step 2: Sample proportion Significance level: 𝛼 = 0.05 → α/2=0.025 in each tail


Cumulative area from the left (i.e., 𝑃 𝑍 ≤ 𝑧 = 0.975
120
𝑝Ƹ = = 0.6 𝑍 = ±1.96
200
Step 3: Test statistic Step 5: Decision
2.82 > 1.96, reject 𝐻0
Conclusion: The coin is biased.

0.6 − 0.5 0.1


𝑍= = ≈ 2.82
0.5 × 0.5 /200 0.0354
Chi Square (χ²) Test
• The Chi-square (χ²) test is a statistical method used to check whether the observed data differs
significantly from what we expect under a given assumption.
• It measures how far the observed values are from the expected values.
• If the difference is too large, we conclude something is not as assumed.

The Chi-square test answers:


“Are the differences between observed and expected values due to chance, or are they statistically
significant?
Chi Square (χ²) Test – Types

Situation Test Type

One variable vs expected distribution Goodness of Fit

Two variables relationship Independence

Compare multiple groups Homogeneity


Chi Square (χ²) Test – Types
1. Goodness of Fit Test
• Checks if data follows a specific distribution.
• Example:
Is a coin fair?
• Expected: 50 heads, 50 tails
• Observed: 60 heads, 40 tails

2. Test of Independence
• Checks whether two variables are related.
• Example:
Is gender related to product preference?

3. Test of Homogeneity
• Checks if different groups have the same distribution.
• Example:
Do different cities have the same voting pattern?
Chi Square (χ²) Test
Example 1: Fair Dice Test Goodness of Fit Test (Single categorical variable)
A die is rolled 60 times with the following outcomes:

Face 1 2 3 4 5 6
Observed (O) 8 10 9 11 12 10

Test whether the die is fair.

Example 2: Color Preference Test of Independence (Two categorical variables)


A company expects equal preference for 4 colors. Survey results:

Color Red Blue Green Yellow


Observed 30 25 20 25

Check if preferences are equally distributed.


Chi Square (χ²) Test
Example 3: Smoking vs Disease Test of Independence (Two categorical variables)
Disease No Disease Total
Smoker 50 30 80
Non-smoker 20 40 60

Test whether smoking is associated with disease.

Example 4: Voting Pattern in Different Cities Test of Homogeneity (Comparing distributions across groups)
Party City A City B City C
X 40 30 50
Y 30 40 20
Z 30 30 30

Do all cities have the same voting distribution?


Chi Square (χ²) Test
When to use Chi-square test
Use it when:
•Data is categorical (counts, frequencies)
•You compare observed vs expected frequencies
•Sample size is reasonably large

Hypotheses
𝐻0 :No difference / No association
𝐻1 :Significant difference / Association exists

Decision Rule
[Link] χ²
[Link] critical value from χ² table (based on df and α)
[Link]:
2 2
• If 𝜒𝑐𝑎𝑙𝑐𝑢𝑙𝑎𝑡𝑒𝑑 > 𝜒𝑐𝑟𝑖𝑡𝑖𝑐𝑎𝑙 →Reject 𝐻0
• Otherwise → Fail to reject 𝐻0
Chi Square (χ²) Test – Goodness of Fit
A die is rolled 120 times. The observed frequencies are:

Face 1 2 3 4 5 6
Obs 15 25 20 18 22 20

Test whether the die is fair at 5% significance level.


Chi Square (χ²) Test – Goodness of Fit
A die is rolled 120 times. The observed frequencies are:

Face 1 2 3 4 5 6
Obs 15 25 20 18 22 20

Test whether the die is fair at 5% significance level.

Step 3: Chi-square statistic


Step 1: Hypotheses
2
•H₀: Die is fair 𝑂−𝐸
𝜒2 =෎
•H₁: Die is not fair 𝐸
Step 2: Expected Frequencies
2 2
Each face expected: 15 − 20 25 − 20
𝜒2 = + +⋯
120 20 20
𝐸= = 20 25 25 0 4 4 0
6 = + + + + + = 2.9
20 20 20 20 20 20
Chi Square (χ²) Test – Goodness of Fit
A die is rolled 120 times. The observed frequencies are:

Face 1 2 3 4 5 6
Obs 15 25 20 18 22 20

Test whether the die is fair at 5% significance level.

Step 4: Degrees of freedom Step 6: Decision


𝑑𝑓 = 6 − 1 = 5 2.9 < 11.07 ⇒ Fail to reject H₀
Conclusion: There are no enough evidences for the die to be
Step 5: Find 𝝌𝟐critical biased and hence the die can be considered fair.
We are finding a value such that:
2
𝑃 𝜒 2 > 𝜒critical = 0.05
2
𝑃 𝜒 2 > 𝜒𝑐𝑟𝑖𝑡𝑖𝑐𝑎𝑙 = 0.05
This means:
•Only 5% of the distribution lies to the right
•It’s a right-tailed test
2
•𝜒0.05,5 ​=11.07
Chi Square (χ²) Test – Goodness of Fit
A die is rolled 120 times. The observed frequencies are:

Face 1 2 3 4 5 6
Obs 15 25 20 18 22 20

Test whether the die is fair at 5% significance level.

Step 4: Degrees of freedom Step 6: Decision


𝑑𝑓 = 6 − 1 = 5 2.9 < 11.07 ⇒ Fail to reject H₀
Conclusion: There are no enough evidences for the die to be
Step 5: Find 𝝌𝟐critical biased and hence the die can be considered fair.
We are finding a value such that:
2
𝑃 𝜒 2 > 𝜒critical = 0.05
2
𝑃 𝜒 2 > 𝜒𝑐𝑟𝑖𝑡𝑖𝑐𝑎𝑙 = 0.05
This means:
•Only 5% of the distribution lies to the right
•It’s a right-tailed test
2
•𝜒0.05,5 ​=11.07
Chi Square (χ²) Test – Test of Independence
A study examines whether gender and preference for a product are independent.
Like Dislike Total
Male 40 20 60
Female 30 30 60
Total 70 50 120
Test independence at 5% level.
Chi Square (χ²) Test – Test of Independence
A study examines whether gender and preference for a product are independent.
Like Dislike Total
Male 40 20 60
Female 30 30 60
Total 70 50 120
Test independence at 5% level.

Step 1: Hypotheses Step 2: Expected Frequencies


• H₀: Variables are independent row total column total
• H₁: Variables are dependent 𝐸=
grand total
Example:
60 × 70
𝐸𝑀𝑎𝑙𝑒,𝐿𝑖𝑘𝑒 = = 35
120
Similarly:
•Male Dislike =
•Female Like =
•Female Dislike =
Chi Square (χ²) Test – Test of Independence
A study examines whether gender and preference for a product are independent.
Like Dislike Total
Male 40 20 60
Female 30 30 60
Total 70 50 120
Test independence at 5% level.

Step 1: Hypotheses
• H₀: Variables are independent
• H₁: Variables are dependent
Chi Square (χ²) Test – Test of Independence
A study examines whether gender and preference for a product are independent.
Like Dislike Total
Male 40 20 60
Female 30 30 60
Total 70 50 120
Test independence at 5% level.

Step 1: Hypotheses Step 2: Expected Frequencies


• H₀: Variables are independent row total column total
• H₁: Variables are dependent 𝐸=
grand total
Example:
60 × 70
𝐸𝑀𝑎𝑙𝑒,𝐿𝑖𝑘𝑒 = = 35
120
Similarly:
•Male Dislike = 25
•Female Like = 35
•Female Dislike = 25
Chi Square (χ²) Test – Test of Independence
A study examines whether gender and preference for a product are independent.
Like Dislike Total
Male 40 20 60
Female 30 30 60
Total 70 50 120
Test independence at 5% level.

Step 3: Compute χ²
2
40 − 35 2 20 − 25 2 30 − 35 2 30 − 25 2
𝜒 = + + +
35 25 35 25
= 0.714 + 1 + 0.714 + 1 = 3.428
Step 5: Decision
Step 4: Degrees of freedom 3.428 < 3.84 ⇒ Fail to reject H₀
For a Chi-square test of independence (contingency tables), Conclusion: There are no evidences that Gender and
df=(r−1)(c−1) preference are dependent. Gender and Preference are
𝑑𝑓 = 2 − 1 2 − 1 = 1 independent.
Critical value at 5% significance with df=1 : 3.84
Chi Square (χ²) Test – Goodness of Fit
A classification model predicts categories A, B, C. Actual vs predicted counts:
Category Actual / Observed Predicted / Expected
A 50 45
B 30 35
C 20 20
Test model fit at 5% significance.
Chi Square (χ²) Test – Test of Independence
A classification model predicts categories A, B, C. Actual vs predicted counts:
Category Actual / Observed Predicted / Expected
A 50 45
B 30 35
C 20 20
Test model fit at 5% significance.
Step 1: Hypotheses Step 3: Degrees of freedom
• H₀: The model fits the data well
𝑑𝑓 = 3 − 1 = 2
• H₁: The model does not fit the data well
Critical value at 5% significance with df=1 : 5.9915
Step 2: Compute χ²
Decision:
1.27 < 5.99 ⇒ Good fit
Conclusion: Model predictions align well with actual
distribution.
Chi Square (χ²) Test – Test of Independence
Check whether two features (e.g., clicked ad and purchased product) are independent:
Purchased Not Purchased Total
Clicked 80 20 100
Not Clicked 40 60 100
Total 120 80 200
Chi Square (χ²) Test – Test of Independence
Check whether two features (e.g., clicked ad and purchased product) are independent:
Purchased Not Purchased Total
Clicked 80 20 100
Not Clicked 40 60 100
Total 120 80 200

Step 1: Hypotheses •Clicked & Purchased:


• H₀: Click and Purchase are independent 100 × 120
𝐸= =
• H₁: Click and Purchase are dependent 200
•Clicked & Not Purchased:
100 × 80
𝐸= =
Step 2: Expected Frequencies 200
Formula: •Not Clicked & Purchased:
100 × 120
row total column total 𝐸= =
𝐸= 200
grand total •Not Clicked & Not Purchased:
100 × 80
𝐸= =
200
Chi Square (χ²) Test – Test of Independence
Check whether two features (e.g., clicked ad and purchased product) are independent:
Purchased Not Purchased Total
Clicked 80 20 100
Not Clicked 40 60 100
Total 120 80 200
Step 3: Compute Chi-square Statistic
1.(Clicked, Purchased)
Formula:
80 − 60 2 400
2 = = 6.67
𝑂−𝐸
𝜒2 = ෎ 60 60
𝐸 2.(Clicked, Not Purchased)
20 − 40 2 400
Now compute each term: = = 10
40 40
3.(Not Clicked, Purchased)
χ2=6.67+10+6.67+10=33.34 40 − 60 2 400
= = 6.67
60 60
4.(Not Clicked, Not Purchased)
60 − 40 2 400
= = 10
40 40
Chi Square (χ²) Test – Test of Independence
Check whether two features (e.g., clicked ad and purchased product) are independent:
Purchased Not Purchased Total
Clicked 80 20 100
Not Clicked 40 60 100
Total 120 80 200

Step 4: Degrees of Freedom


𝑑𝑓 = 𝑟 − 1 𝑐 − 1 = 2 − 1 2 − 1 = 1
Step 7: Final Conclusion
Step 5: Critical Value These variables are not independent
At α = 0.05 and df = 1: Inference:
2 • There is a strong relationship between:
𝜒𝑐𝑟𝑖𝑡𝑖𝑐𝑎𝑙 = 3.84
• Clicking the ad
• Purchasing the product
Step 6: Decision
33.34 > 3.84 ⇒ Reject H₀
Why H₀ cannot be “dependent” in Chi Square (χ²) Test
In a Chi-square test of independence, the hypotheses are
always structured as:
• H₀: Variables are independent
• H₁: Variables are dependent
This is not arbitrary—it’s because:
The expected frequencies formula you used:

row total column total


𝐸=
grand total
is derived under the assumption of independence.
Why H₀ cannot be “dependent” in Chi Square (χ²) Test

If HO is assumed to be dependent,
•Expected frequencies cannot be computed, because:
• There is no standard formula for expected counts under dependence
•The Chi-square test breaks down mathematically So the test becomes invalid.
ANOVA – Analysis of Variance
• ANOVA (Analysis of Variance) is a statistical technique used to test whether the means of three or more
groups are significantly different from each other.
• Instead of comparing means pairwise (which increases error), ANOVA checks all groups simultaneously by
analyzing variance.

• Example:
Suppose test scores from 3 classes:
Class A: 70, 75, 80
Class B: 60, 65, 70
Class C: 85, 90, 95
ANOVA checks if these differences are statistically significant.
ANOVA – Analysis of Variance
ANOVA splits total variation into:
• Between-group variation
• Within-group variation
If between-group variation is much larger → significant difference exists.

ANOVA uses the F-statistic, defined as:

Variance between groups


𝐹=
Variance within groups
Large F → strong evidence against null hypothesis
Small F → groups are similar
ANOVA – Analysis of Variance
• Null hypothesis (H₀): All group means are equal
• Alternative hypothesis (H₁): At least one mean is different
ANOVA – Types
• One-Way ANOVA
• One independent variable (factor)
• Example: Compare student scores across 3 teaching methods
• Two-Way ANOVA
• Two factors (can test interaction effects)
• Example: Effect of teaching method and gender on scores
• Repeated Measures ANOVA
• Same subjects measured multiple times
ANOVA – Types
• State hypotheses
• Choose significance level (α, e.g., 0.05)
• Compute:
• Sum of Squares (SS)
• Mean Squares (MS)
• F-statistic
• Compare F with critical value (or use p-value)
• Draw conclusion

Decision Rule
• If p-value < α (e.g., 0.05) → Reject H₀
• Otherwise → Fail to reject H₀
ANOVA – Table Structure

Source SS df MS F
Between Groups SSB k−1 MSB F
Within Groups SSW N−k MSW
Total SST N−1
ANOVA – Steps
• State hypotheses
• Choose significance level (α, e.g., 0.05)
• Compute:
• Sum of Squares (SS)
• Mean Squares (MS)
• F-statistic
• Compare F with critical value (or use p-value)
• Draw conclusion

Decision Rule
• If p-value < α (e.g., 0.05) → Reject H₀
• Otherwise → Fail to reject H₀
One Way ANOVA – Problem
A data scientist is comparing the performance of three machine learning models based on accuracy (%):
Model A: 82, 85, 88
Model B: 78, 80, 79
Model C: 90, 92, 91
At α = 0.05, test if there is a significant difference. Interpret the result.

Step 1: Hypotheses Step 3: Overall Mean


ˉ 255 + 237 + 273 765
•H₀: μ₁ = μ₂ = μ₃ 𝑋= = = 85
9 9
•H₁: At least one mean differs
Step 4: Between-Group Sum of Squares (SSB)
Step 2: Group Means ˉ ˉ 2
𝑆𝑆𝐵 = ෍ 𝑛𝑖 𝑋𝑖 − 𝑋
•Mean A = (82+85+88)/3 = 85
2
•A: 3 85 − 85 =0
•Mean B = (78+80+79)/3 = 79 •B: 3 79 − 85 2
= 108
•C: 3 91 − 85 2 = 108
•Mean C = (90+92+91)/3 = 91
SSB = 216
One Way ANOVA – Problem
A data scientist is comparing the performance of three machine learning models based on accuracy (%):
Model A: 82, 85, 88
Model B: 78, 80, 79
Model C: 90, 92, 91
At α = 0.05, test if there is a significant difference. Interpret the result.

Step 5: Within-Group Sum of Squares (SSW) Step 6: Degrees of Freedom


A: (82−85)²+(85−85)²+(88−85)² = 9+0+9 = 18 • dfbetween = 3−1 = 2
B: (78−79)²+(80−79)²+(79−79)² = 1+1+0 = 2 • dfwithin = 9−3 = 6
C: (90−91)²+(92−91)²+(91−91)² = 1+1+0 = 2
SSW = 22
One Way ANOVA – Problem
A data scientist is comparing the performance of three machine learning models based on accuracy (%):
Model A: 82, 85, 88
Model B: 78, 80, 79
Model C: 90, 92, 91
At α = 0.05, test if there is a significant difference. Interpret the result.

Step 7: Mean Squares


MSB (Mean Square Between) → average variation between groups
MSW (Mean Square Within) → average variation within groups

216
𝑀𝑆𝐵 = = 108
2
This represents average variation between group means
• SSB = 216
• SSW = 22 22
𝑀𝑆𝑊 = ≈ 3.67
• 𝑑𝑓𝑏𝑒𝑡𝑤𝑒𝑒𝑛 = 𝑘 − 1 = 3 − 1 = 2 6
• 𝑑𝑓𝑤𝑖𝑡ℎ𝑖𝑛 = 𝑁 − 𝑘 = 9 − 3 = 6 This represents average variation within groups
One Way ANOVA – Problem
A data scientist is comparing the performance of three machine learning models based on accuracy (%):
Model A: 82, 85, 88
Model B: 78, 80, 79
Model C: 90, 92, 91
At α = 0.05, test if there is a significant difference. Interpret the result.

Step 8: F Statistic Decision Rule

𝑀𝑆𝐵 • If p-value < α (e.g., 0.05) → Reject H₀


𝐹=
𝑀𝑆𝑊 • Otherwise → Fail to reject H₀
Step 9: Decision
108 From F Distribution Table,
𝐹=
3.67
•FCritical(dfbetween , dfwithin, α) = FCritical (2,6,0.05) ≈ 5.14
•Since 5.14 < 29.4 → Reject H₀
𝐹 ≈ 29.4
Conclusion
There is a significant difference between model performances.
One Way ANOVA – Problem
EMG signal amplitudes (μV) under 3 conditions
Rest Moderate Activity Intense Activity
10 25 50
12 28 55
11 27 53
13 26 52

Perform ANOVA and interpret physiological significance


One Way ANOVA – Problem
EMG signal amplitudes (μV) under 3 conditions
Rest Moderate Activity Intense Activity
10 25 50
12 28 55
11 27 53
13 26 52

Perform ANOVA and interpret physiological significance


Step 3: Overall Mean
Step 1: State Hypotheses ˉ 46 + 106 + 210 362
•H₀: μ₁ = μ₂ = μ₃ (all means equal) 𝑋= = = 30.16
12 12
•H₁: At least one mean is different
Step 4: Between-Group Sum of Squares (SSB)
ˉ ˉ 2
Step 2: Compute Means 𝑆𝑆𝐵 = ෍ 𝑛𝑖 𝑋𝑖 − 𝑋
•Rest mean = (10 + 12 + 11 + 13) / 4 = 11.5 2
•Moderate mean = (25 + 28 + 27 + 26) / 4 = 26.5 •A: 4 30.6 − 11.5 = 1459.24
•B: 4 30.6 − 26.5 2 = 67.24
•Intense mean = (50 + 55 + 53 + 52) / 4 = 52.5 2
•C: 4 30.6 − 52.5 = 1918.44
SSB = 3442.64
One Way ANOVA – Problem
EMG signal amplitudes (μV) under 3 conditions
Rest Moderate Activity Intense Activity
10 25 50
12 28 55
11 27 53
13 26 52

Perform ANOVA and interpret physiological significance


Step 5: Within-Group Sum of Squares (SSW)
ˉ Step 6: Degrees of Freedom
2
𝑆𝑆𝑊 = ෍( 𝑋𝑖𝑗 − 𝑋𝑖 ) •dfbetween k − 1 = 3 − 1 = 2
•dfwithin : N − k = 12 − 3 = 9
Rest: (10−11.5)²+(12−11.5)²+(11−11.5)² +(13−11.5)² = 5.0
Moderate: (25−26.5)²+(28−26.5)²+(27−26.5)² +(26−26.5)² = 5.0
Intense: (50−52.5)²+(55−52.5)²+(53−52.5)² +(52−52.5)² = 13
SSW = 23
One Way ANOVA – Problem
EMG signal amplitudes (μV) under 3 conditions
Rest Moderate Activity Intense Activity
10 25 50
12 28 55
11 27 53
13 26 52

Perform ANOVA and interpret physiological significance

Step 8: F-Statistic Step 9: Decision


Step 7: Mean Squares
1461.34 •At α = 0.05
•MSB = 2922.67 / 2 = 1461.34 𝐹=
2.56 •F-critical (2, 9) ≈ 4.26
•MSW = 23 / 9 = 2.56
F ≈ 571.6 Since F >> F-critical, we reject H₀
Conclusion
There is a statistically significant difference in EMG amplitudes
across:
•Rest
•Moderate activity
•Intense activity
Two Way ANOVA – Problem
A researcher studies the effect of Teaching Method (A) and Study Environment (B) on student scores.

Env1 Env2 Env3


Method 1 78 85 88
Method 2 82 90 92
Method 3 75 80 84

Construct ANOVA Table and check for the significance of teaching method and study environment at 5%
significance.
Step 2: Compute Means
•Row means:
Step 1: Hypotheses
• M1 = (78+85+88)/3 = 83.67
•For Factor A (Method):
• M2 = 88
H₀: Means are equal
• M3 = 79.67
•For Factor B (Environment):
•Column means:
H₀: Means are equal
• Env1 = (78+82+75)/3 = 78.33
• Env2 = 85
• Env3 = 88
•Grand Mean (GM):
= Total / 9 = 754 / 9 = 83.78
Two Way ANOVA – Problem
A researcher studies the effect of Teaching Method (A) and Study Environment (B) on student scores.

Env1 Env2 Env3


Method 1 78 85 88
Method 2 82 90 92
Method 3 75 80 84

Construct ANOVA Table and check for the significance of teaching method and study environment at 5%
significance.
Step 4: Error Degrees of Freedom
Step 3: Degrees of Freedom for Each Factor dfE​=(r−1)(c−1)
•Rows (Factor A): = 3−1 3−1 =2×2=4
𝑑𝑓𝐴 = 𝑟 − 1 = 3 − 1 = 2 Step 5: Total Degrees of Freedom
•Columns (Factor B):
𝑑𝑓𝐵 = 𝑐 − 1 = 3 − 1 = 2 Total number of observations: 𝑁 = 𝑟 × 𝑐 = 3 × 3 = 9
dfTotal​=N−1
𝑑𝑓𝑇 = 9 − 1 = 8
Two Way ANOVA – Problem
Step 6: Sum of Squares
Two Way ANOVA – Problem

Mean square is just the sum of squares divided by its corresponding degrees of freedom.

Step 5: Conclusion
Compare with F-table (α = 0.05):
•F_A = 13.63 → Significant Fcritical​(2,4,0.05)≈6.94
•F_B = 19.25 → Significant
•Both teaching method and environment affect performance.

You might also like