Fixed Top Ad (Local Preview)800x50 • Slot 6608427872
Probability Distributions
1. Probability Distributions
- A probability distribution is a mathematical description of the possible values of a random variable and how likely those values are. Examples: ➜ Result of a coin toss ➜ Number of customers arriving in one hour ➜ Number of successful purchases ➜ Height of a person ➜ Daily sales amount A probability distribution helps us understand which outcomes are possible and how likely each outcome is.
- A random variable is a variable whose value depends on the outcome of a random process.
Examples:
X = 1 if the coin shows heads, else 0X = Number of customers arriving in one hourX = Height of a randomly selected student📌 A random variable may be discrete or continuous. - A discrete random variable takes separate, countable values like
0, 1, 2, 3, ...Common discrete distributions include: ➜ Bernoulli distribution ➜ Binomial distribution ➜ Poisson distribution Examples of discrete data: ➜ Number of purchases ➜ Number of emails ➜ Number of defective products ➜ Success or failure. - A continuous random variable can take any value within an interval. Examples:
165.4 cm,72.8 kg,12.45 minutesCommon continuous distributions include: ➜ Normal distribution ➜ Exponential distribution. Examples of continuous data:height,weight,temperature,time,sales amount. - Understanding distributions helps us: ✅ Calculate probabilities ✅ Understand patterns in data ✅ Model random processes ✅ Identify unusual outcomes ✅ Construct confidence intervals ✅ Make predictions 📌 The appropriate distribution depends on the type of outcome and the process that generates it.
1.1 🎲 What is a Probability Distribution?
1.2 What is a Random Variable?
1.3 Discrete Distributions
1.4 Continuous Distributions
1.5 Why Learn Probability Distributions?
2. Overview of Common Distributions
- An overview of the most common probability distributions:
2.1 Common Distributions
Common Distributions
| Distribution | Type | Main Purpose |
|---|---|---|
| Normal | Continuous | Models symmetric continuous measurements |
| Bernoulli | Discrete | Models one trial with two outcomes |
| Binomial | Discrete | Models successes across a fixed number of trials |
| Poisson | Discrete | Models event counts within a fixed interval |
- Suppose we run a cake shop:
➜ Daily sales amount may be modeled using a
Normaldistribution. ➜ Whether one visitor buys a cake is aBernoullioutcome. ➜ Number of buyers among 100 visitors may follow aBinomial. ➜ Number of customer arrivals per hour may followPoisson. 📌 The business event determines which distribution may be appropriate.
2.2 Quick Example
3. Normal Distribution
- The Normal distribution is a continuous probability distribution with a symmetric, bell-shaped curve. It is described by two parameters: mean (
μ), standard deviation (σ). - The mean determines the center of the distribution. - The standard deviation determines how widely values are spread around the mean. - A Normal distribution is:
✅ Bell-shaped
✅ Symmetric around the mean
✅ Centered at μ
✅ Controlled in spread by σ
✅ Continuous.
In a perfectly Normal distribution:
Mean = Median = Mode - ➜ Changing the mean moves the curve to the left or right. ➜ Changing the standard deviation changes the spread: - Smaller standard deviation produces a narrower curve - Larger standard deviation produces a wider curve. 📌 The mean controls location. The standard deviation controls spread.
- For a Normal distribution, approximately:
- 68% of values lie within 1 standard deviation of the mean
- 95% lie within 2 standard deviations
- 99.7% lie within 3 standard deviations.
We can write this as:
μ ± 1σ → Approximately 68%μ ± 2σ → Approximately 95%μ ± 3σ → Approximately 99.7% - Suppose student heights have:
Mean = 165 cmStandard deviation = 5 cmApproximately 68% of heights would lie between:165 - 5 = 160 cm165 + 5 = 170 cmTherefore: Approximately 68% lie between 160 cm and 170 cm. 📌 The 68–95–99.7 rule applies when the distribution is approximately Normal. - Download
heart_df_cleandata. Load it as pandas dataframe. If a person is selected on random then using the dataset answer the questions below: What is probability that he has cholestrol below 250?import pandas as pdimport scipy.stats as statsheart_df_clean = pd.read_csv("heart_df_clean.csv")mean = heart_df_clean["totChol"].mean()std_dev = heart_df_clean["totChol"].std()p_lt_250 = stats.norm.cdf(250, loc=mean, scale=std_dev)print(f"P(X <= 250): {round(p_lt_250 * 100, 2)}%")What is probability that he has cholestrol above 280?p_gt_280 = 1 - stats.norm.cdf(280, loc=mean, scale=std_dev)print(f"P(X > 280): {round(p_gt_280 * 100, 2)}%")What is probability that he has cholestrol between 230 and 250?p_le_250 = stats.norm.cdf(250, loc=mean, scale=std_dev)p_le_230 = stats.norm.cdf(230, loc=mean, scale=std_dev)p_btn_230_250 = p_le_250 - p_le_230print(f"P(230 <= X <= 250): {round(p_btn_230_250 * 100, 2)}%")
3.1 🔔 What is a Normal Distribution?
3.2 Main Characteristics
3.3 Effect of Mean and Standard Deviation
3.4 The 68–95–99.7 Rule
3.5 Example
3.6 Python Codes
4. Bernoulli Distribution
- A Bernoulli distribution models one trial with two possible outcomes:
Success = 1Failure = 0It has one main parameter:p = Probability of successThe probability of failure is:1 − p - Coin Toss:
Success: Head
Failure: Tail
p = 0.5Customer Purchase: Success: Customer purchases Failure: Customer does not purchasep = 0.2Email Open: Success: Email is opened Failure: Email is not openedp = 0.3📌 A Bernoulli distribution describes one yes/no or success/failure trial. - A Bernoulli random variable can take only two values:
X = 1 with probability pX = 0 with probability 1 - pExample:P(X = 1) = 0.3P(X = 0) = 0.7 - Download
heart_df_cleandata. Load it as pandas dataframe. If a person is selected on random then using the dataset answer the questions below: What is probability that he has heart disease?import pandas as pdheart_df_clean = pd.read_csv("heart_df_clean.csv")p = heart_df_clean["target"].mean()print(f"P(X = 1): {round(p * 100, 2)}%")What is probability that he does not have heart disease?probability_no_disease = 1 - pprint(f"P(X = 0): {round(probability_no_disease * 100, 2)}%")
4.1 🪙 What is a Bernoulli Distribution?
4.2 Bernoulli Examples
4.3 Possible Values
4.4 Python Code
5. Binomial Distribution
- A Binomial distribution models the number of successes in a fixed number of independent Bernoulli trials.
Its two main parameters are:
n = Number of trialsp = Probability of success in each trialA Binomial random variable may take values from:0 to n - A Binomial model generally requires: ✅ A fixed number of trials ✅ Two possible outcomes per trial ✅ The same success probability in every trial ✅ Independent trials.
- Suppose we toss a fair coin 10 times.
n = 10p = 0.5The random variable may be:X = Number of heads in 10 tossesPossible values are:0, 1, 2, ..., 10 - Suppose 100 people visit a website, and each visitor has a 20% probability of purchasing.
n = 100p = 0.2The random variable is:X = Number of visitors who purchase📌 Bernoulli models one purchase decision. 📌 Binomial models the total number of purchases across multiple trials. - The mean or expected value of a Binomial distribution is:
Mean = n × p. For,n = 100p = 0.2The expected number of purchases is:100 × 0.2 = 20This does not mean exactly 20 customers will always purchase. It is the long-run average expected under the model. - Download
heart_df_cleandata. Load it as pandas dataframe. If a person is selected on random then using the dataset answer the questions below: What is probability that exactly 3 people have heart disease in a sample of 10?import pandas as pdfrom scipy.stats import binomheart_df_clean = pd.read_csv("heart_df_clean.csv")p = heart_df_clean["target"].mean()n = 10p_eq_3 = binom.pmf(3, n, p)print(f"P(X = 3): {round(p_eq_3 * 100, 2)}%")What is probability that at most 2 people have heart disease in a sample of 10?p_at_most_2 = binom.cdf(2, n, p)print(f"P(X <= 2): {round(p_at_most_2 * 100, 2)}%")What is probability that at least 4 people have heart disease in a sample of 10?p_at_least_4 = 1 - binom.cdf(3, n, p)print(f"P(X >= 4): {round(p_at_least_4 * 100, 2)}%")What is probability that 3 to 5 people have heart disease in a sample of 10?p_3_to_5 = binom.cdf(5, n, p) - binom.cdf(2, n, p)print(f"P(3 <= X <= 5): {round(p_3_to_5 * 100, 2)}%")📌 cdf of 3 includes probability for 3 which we don't want to delete. Thus, we subtracted cdf of 2 instead.
5.1 🎯 What is a Binomial Distribution?
5.2 Conditions for a Binomial Distribution
5.3 Example: Coin Tosses
5.4 Business Example
5.5 Expected Number of Successes
5.6 Python Code
6. Poisson Distribution
- A Poisson distribution models the number of events occurring within a fixed interval of: time, space, area, distance.
Its main parameter is:
λ = Average number of events per intervalA Poisson model generally assumes: ✅ Events occur independently ✅ The average rate (λ) is constant ✅ Events are counted within a fixed interval - Examples include: ➜ Number of customers arriving per hour ➜ Number of emails received per day ➜ Number of calls received per minute ➜ Number of defects per meter of material ➜ Number of accidents at a location per month
- Suppose a cake shop receives an average of 12 customers per hour.
λ = 12 customers per hourA Poisson model could be used to calculate the probability of receiving: ➜ Exactly 10 customers ➜ Fewer than 8 customers ➜ More than 15 customers. 📌 The value of λ must use the same interval as the question. - For a Poisson distribution:
Mean = λIfλ = 12, then the expected number of events in that interval is:12 - Suppose 20 people visit a website per hour on average. Calculate probabilities:
What is probability that exactly 15 people visit in an hour?
import pandas as pdfrom scipy.stats import poissonlambda_value = 20p_eq_15 = poisson.pmf(15, lambda_value)print(f"P(X = 15): {round(p_eq_15 * 100, 2)}%")What is probability that at most 18 people visit in an hour?p_le_18 = poisson.cdf(18, lambda_value)print(f"P(X <= 18): {round(p_le_18 * 100, 2)}%")What is probability that at least 25 people visit in an hour?p_ge_25 = 1 - poisson.cdf(24, lambda_value)print(f"P(X >= 25): {round(p_ge_25 * 100, 2)}%")What is probability that between 15 and 25 people visit in an hour?p_le_14 = poisson.cdf(14, lambda_value)p_le_25 = poisson.cdf(25, lambda_value)p_btn_15_25 = p_le_25 - p_le_14print(f"P(15 <= X <= 25): {round(p_btn_15_25 * 100, 2)}%")
6.1 📞 What is a Poisson Distribution?
6.2 Poisson Examples
6.3 Example
6.4 Expected Number of Events
6.5 Python Code
7. Estimating Distribution Parameters
- Some parameters are estimated from historical or observed data, while others are fixed by the experiment.
Common parameters include:
➜
pis estimated for Bernoulli and Binomial distributions ➜nis the fixed or known number of Binomial trials ➜λis estimated for the Poisson distribution ➜μandσare estimated for the Normal distribution - We estimate the probability of success using:
p = Number of successes / Total number of trialsExample:Purchases = 40Visitors = 200Therefore:p = 40 / 200p = 0.2The estimated purchase probability is:20% - We estimate λ using the average number of events per interval.
Example customer arrivals:
Hour 1: 10Hour 2: 14Hour 3: 12Hour 4: 8Hour 5: 16Here,λ = (10 + 14 + 12 + 8 + 16) / 5λ = 12The estimated average arrival rate is:12 customers per hour - For a Normal model: - Estimate μ using the sample mean - Estimate σ using the sample standard deviation. 📌 Parameters summarize important features of a probability distribution.
7.1 📏 Where Do Parameters Come From?
7.2 Estimating p
7.3 Estimating λ
7.4 Estimating μ and σ
8. Choosing the Appropriate Distribution
- A distribution selection guide for a cake shop:
8.1 🍰 Cake Shop Example
Cake Shop Example
| Distribution | Use Case | Cake Shop Example |
|---|---|---|
| Normal | Continuous, approximately symmetric data | Daily sales amount |
| Bernoulli | One binary outcome | Whether one visitor buys a cake |
| Binomial | Successes in a fixed number of trials | Buyers among 100 visitors |
| Poisson | Number of events in a fixed interval | Customer arrivals per hour |
- Ask the following questions:
Q: Is the variable continuous and approximately symmetric?
A: Consider:
Normal distributionQ: Is there one trial with two outcomes? A: Consider:Bernoulli distributionQ: Are we counting successes across a fixed number of trials? A: Consider:Binomial distributionQ: Are we counting independent events occurring at an approximately constant rate within a fixed interval? A: Consider:Poisson distribution📌 Start by identifying the type of outcome and how the data is generated.
8.2 Distribution Selection Questions
9. PMF, PDF, and CDF
- Probability distributions use different functions to describe probabilities. The main functions are: - Probability Mass Function (PMF) - Probability Density Function (PDF) - Cumulative Distribution Function (CDF).
- The Probability Mass Function, or PMF, gives the probability of each possible value of a discrete random variable. Applicable to: ✅ Bernoulli distribution ✅ Binomial distribution ✅ Poisson distribution 📌 For discrete distributions, an individual value can have a nonzero probability.
- The Probability Density Function, or PDF, describes probability density for a continuous random variable.
Applicable to:
✅ Normal distribution
✅ Exponential distribution
For a continuous variable:
P(X = exactly one value) = 0Probability is calculated over an interval:P(a ≤ X ≤ b)This probability corresponds to the area under the density curve between a and b. 📌 PDF height represents density. Probability comes from an area under the curve. - The Cumulative Distribution Function, or CDF, gives:
P(X ≤ x)It is the probability that a random variable is less than or equal to a specified value. The CDF applies to both: ✅ Discrete distributions ✅ Continuous distributions.
9.1 📊 Why Do We Need These Functions?
9.2 Probability Mass Function
9.3 Probability Density Function
9.4 Cumulative Distribution Function
9.5 Quick Comparison
| Function | Meaning | Applicable To |
|---|---|---|
| PMF | Probability of an exact discrete value | Discrete distributions |
| Density of a continuous variable | Continuous distributions | |
| CDF | Probability of a value less than or equal to x | All distributions |
10. Confidence Intervals
- A confidence interval is a range calculated from sample data and used to estimate an unknown population parameter. Examples of population parameters include: ➜ Population mean ➜ Population proportion ➜ Difference between two population means A point estimate gives one estimated value. A confidence interval provides a range together with an indication of uncertainty.
- Suppose we want to estimate the average number of fish in a lake.
Point Estimate:
A point estimate provides one value:
Estimated average = 500 fishConfidence Interval: A confidence interval provides a range:Estimated range = 450 to 550 fish📌 A point estimate gives one best estimate. 📌 A confidence interval shows the uncertainty around that estimate. - Imagine the unknown population mean is a fish in a lake. - A point estimate is like throwing one spear toward the fish. - A confidence interval is like casting a net around the estimated location. A method that produces wider intervals generally has greater coverage but gives less precise estimates. A method that produces narrower intervals gives more precise estimates but may have lower coverage.
- The general structure is:
Confidence Interval = Point Estimate ± Margin of ErrorThe margin of error is:Margin of Error = Critical Value × Standard ErrorTherefore:CI = Point Estimate ± Critical Value × Standard Error - When using a Normal critical value and a known population standard deviation:
CI = X̄ ± Z × SEwhere:X̄ = Sample meanZ = Critical valueSE = Standard errorThe standard error is:SE = σ / √nwhere:σ = Population standard deviationn = Sample sizeFor a 95% confidence level:Z ≈ 1.96A Normal-based confidence interval for a population mean with known population standard deviation uses this structure. - Download
heart_df_cleandata. Load it as pandas dataframe and answer the questions below: Calculate 95% confidence interval for mean BMIimport pandas as pdimport scipy.stats as statsheart_df_clean = pd.read_csv("heart_df_clean.csv")mean_bmi = heart_df_clean["BMI"].mean()std_dev_bmi = heart_df_clean["BMI"].std()n = len(heart_df_clean)std_error = stats.sem(heart_df_clean["BMI"])ci = stats.norm.interval(0.95, loc=mean_bmi, scale=std_error)lower_bound = ci[0]upper_bound = ci[1]print(f"95% Confidence Interval for Mean BMI: ({lower_bound:.2f}, {upper_bound:.2f})") - A 95% confidence level describes the long-run performance of the method. If we repeatedly collected samples and constructed intervals using the same method, approximately 95% of those intervals would contain the true population parameter. It does not mean that a particular calculated interval has a 95% probability of containing the fixed parameter. 📌 Confidence refers to the interval-building process, not to changing probability for a fixed population parameter.
- The formula using Z = 1.96 is appropriate for a Normal-based confidence interval when the population standard deviation is known.
In many real situations, the population standard deviation is unknown. A Student's t-distribution may then be used, especially for smaller samples.
For this introductory lesson:
Known population standard deviation → Z-based intervalUnknown population standard deviation → Often t-based interval
10.1 🎯 What is a Confidence Interval?
10.2 Point Estimate vs. Interval Estimate
10.3 Net Analogy
10.4 General Confidence Interval Formula
10.5 Confidence Interval for a Mean
10.6 Python Code
10.7 Interpreting a 95% Confidence Level
10.8 Important Note about Z and t
11. Summary
Final Distribution Summary
| Distribution | Variable Type | Parameters | Example |
|---|---|---|---|
| Normal | Continuous | μ, σ | Height or sales amount |
| Bernoulli | Discrete binary | p | One customer purchases or not |
| Binomial | Discrete count | n, p | Buyers among 100 visitors |
| Poisson | Discrete count | λ | Arrivals per hour |