Inferential Statistics
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.
• Sampling Error: Recognizing that sample results will differ from the true population due to
chance.
Descriptive Vs Inferential Statistics
Feature Descriptive Statistics Inferential Statistics
Data Used Only the given dataset Sample data from a population
Focus What the data shows What we can conclude beyond data
• Probability
• Chance of error
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
𝑛
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
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.
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.
• We combine:
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
1 − 𝛼 = 0.95
𝛼
α = 0.05 → = 0.025
2
Confidence Interval:
Confidence Interval – Problems
ˉ
A sample of size 𝒏 = 𝟑𝟔has mean 𝑿 = 𝟓𝟎.Population standard deviation 𝝈 = 𝟏𝟐.
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.
Examples:
• This hypothesis predicts that as screen time before bed increases, sleep quality 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.
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
The p-value is found by converting the Z-score into a probability using the Z-table and selecting the appropriate tail.
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
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.
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
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
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
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
Face 1 2 3 4 5 6
Obs 15 25 20 18 22 20
Face 1 2 3 4 5 6
Obs 15 25 20 18 22 20
Face 1 2 3 4 5 6
Obs 15 25 20 18 22 20
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 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
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.
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.
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.
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.
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.