Comparison of MLE and MAP Estimation using Sample Data
Experiment
Comparison of MLE and MAP Estimation using Sample Data
🎯 Aim
To estimate parameters using MLE and MAP and compare their behavior.
Objective
- Generate sample data
- Estimate mean using MLE
- Estimate mean using MAP (with prior)
- Compare results visually
📖 Theory
What are MLE and MAP?
🔹 1. Maximum Likelihood Estimation (MLE)
📌 Idea:
Find parameters that maximize the likelihood of observed data
👉 “Choose parameters that make the data most likely”
🔹 2. Maximum A Posteriori (MAP)
📌 Idea:
Includes prior knowledge about parameters
👉 “Choose parameters that fit data + prior belief”
🔑 Key Difference
| Method | Uses Data | Uses Prior |
|---|---|---|
| MLE | ✅ | ❌ |
| MAP | ✅ | ✅ |
🧠Intuition
- MLE → trusts only data
- MAP → balances data + prior belief
Assume:
- Data follows Normal Distribution
- Known variance
🔹 MLE Estimate of Mean
MLE only uses the observed data.
Formula:
This is simply:
👉 sample mean
🔹 MAP ( Maximum Aposteriori ) Estimate of Mean
💻 Program
📊 Output
📈 Interpretation
🔹 MLE
- Close to sample data
- Ignores prior
🔹 MAP
- Pulled toward prior (5)
- Balances data + belief
Key Observation
| Scenario | Behavior |
|---|---|
| Large data | MLE ≈ MAP |
| Small data | MAP influenced by prior |
📉 Graph Explanation
- Histogram → data distribution
- Black line → true mean
- Blue line → MLE
- Red line → MAP
👉 MAP shifts toward prior
Result
MLE and MAP estimation were implemented and compared. MAP incorporates prior knowledge, whereas MLE relies solely on observed data.
- MLE is purely data-driven
- MAP incorporates prior belief
-
MAP is useful when:
- Data is limited
- Prior knowledge exists

Comments
Post a Comment