Fixed Top Ad (Local Preview)800x50 • Slot 6608427872

Probability Distributions

1. Probability Distributions

    1.1 🎲 What is a Probability Distribution?
    1. 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.
    1.2 What is a Random Variable?
    1. 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.
    1.3 Discrete Distributions
    1. 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.
    1.4 Continuous Distributions
    1. A continuous random variable can take any value within an interval. Examples: 165.4 cm, 72.8 kg, 12.45 minutes Common continuous distributions include: ➜ Normal distribution ➜ Exponential distribution. Examples of continuous data: height, weight, temperature, time, sales amount.
    1.5 Why Learn Probability Distributions?
    1. 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.

2. Overview of Common Distributions

    2.1 Common Distributions
    1. An overview of the most common probability distributions:
Common Distributions
DistributionTypeMain Purpose
NormalContinuousModels symmetric continuous measurements
BernoulliDiscreteModels one trial with two outcomes
BinomialDiscreteModels successes across a fixed number of trials
PoissonDiscreteModels event counts within a fixed interval
    2.2 Quick Example
    1. Suppose we run a cake shop: ➜ Daily sales amount may be modeled using a Normal distribution. ➜ Whether one visitor buys a cake is a Bernoulli outcome. ➜ Number of buyers among 100 visitors may follow a Binomial. ➜ Number of customer arrivals per hour may follow Poisson. 📌 The business event determines which distribution may be appropriate.

3. Normal Distribution

    3.1 🔔 What is a Normal Distribution?
    1. 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.
    3.2 Main Characteristics
    1. 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
    3.3 Effect of Mean and Standard Deviation
    1. ➜ 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.
    3.4 The 68–95–99.7 Rule
    1. 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%
    3.5 Example
    1. Suppose student heights have: Mean = 165 cmStandard deviation = 5 cm Approximately 68% of heights would lie between: 165 - 5 = 160 cm165 + 5 = 170 cm Therefore: Approximately 68% lie between 160 cm and 170 cm. 📌 The 68–95–99.7 rule applies when the distribution is approximately Normal.
    3.6 Python Codes
    1. Download heart_df_clean data. 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)}%")

4. Bernoulli Distribution

    4.1 🪙 What is a Bernoulli Distribution?
    1. A Bernoulli distribution models one trial with two possible outcomes: Success = 1Failure = 0 It has one main parameter: p = Probability of success The probability of failure is: 1 − p
    4.2 Bernoulli Examples
    1. Coin Toss: Success: Head Failure: Tail p = 0.5Customer Purchase: Success: Customer purchases Failure: Customer does not purchase p = 0.2Email Open: Success: Email is opened Failure: Email is not opened p = 0.3 📌 A Bernoulli distribution describes one yes/no or success/failure trial.
    4.3 Possible Values
    1. 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
    4.4 Python Code
    1. Download heart_df_clean data. 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)}%")

5. Binomial Distribution

    5.1 🎯 What is a Binomial Distribution?
    1. 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 trial A Binomial random variable may take values from: 0 to n
    5.2 Conditions for a Binomial Distribution
    1. A Binomial model generally requires: ✅ A fixed number of trials ✅ Two possible outcomes per trial ✅ The same success probability in every trial ✅ Independent trials.
    5.3 Example: Coin Tosses
    1. Suppose we toss a fair coin 10 times. n = 10p = 0.5 The random variable may be: X = Number of heads in 10 tosses Possible values are: 0, 1, 2, ..., 10
    5.4 Business Example
    1. Suppose 100 people visit a website, and each visitor has a 20% probability of purchasing. n = 100p = 0.2 The random variable is: X = Number of visitors who purchase 📌 Bernoulli models one purchase decision. 📌 Binomial models the total number of purchases across multiple trials.
    5.5 Expected Number of Successes
    1. The mean or expected value of a Binomial distribution is: Mean = n × p. For, n = 100p = 0.2 The expected number of purchases is: 100 × 0.2 = 20 This does not mean exactly 20 customers will always purchase. It is the long-run average expected under the model.
    5.6 Python Code
    1. Download heart_df_clean data. 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.

6. Poisson Distribution

    6.1 📞 What is a Poisson Distribution?
    1. 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 interval A Poisson model generally assumes: ✅ Events occur independently ✅ The average rate (λ) is constant ✅ Events are counted within a fixed interval
    6.2 Poisson Examples
    1. 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
    6.3 Example
    1. Suppose a cake shop receives an average of 12 customers per hour. λ = 12 customers per hour A 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.
    6.4 Expected Number of Events
    1. For a Poisson distribution: Mean = λ If λ = 12, then the expected number of events in that interval is: 12
    6.5 Python Code
    1. 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)}%")

7. Estimating Distribution Parameters

    7.1 📏 Where Do Parameters Come From?
    1. Some parameters are estimated from historical or observed data, while others are fixed by the experiment. Common parameters include: ➜ p is estimated for Bernoulli and Binomial distributions ➜ n is the fixed or known number of Binomial trials ➜ λ is estimated for the Poisson distribution ➜ μ and σ are estimated for the Normal distribution
    7.2 Estimating p
    1. We estimate the probability of success using: p = Number of successes / Total number of trialsExample: Purchases = 40 Visitors = 200Therefore: p = 40 / 200 p = 0.2 The estimated purchase probability is: 20%
    7.3 Estimating λ
    1. We estimate λ using the average number of events per interval. Example customer arrivals: Hour 1: 10Hour 2: 14Hour 3: 12Hour 4: 8Hour 5: 16 Here, λ = (10 + 14 + 12 + 8 + 16) / 5λ = 12 The estimated average arrival rate is: 12 customers per hour
    7.4 Estimating μ and σ
    1. For a Normal model: - Estimate μ using the sample mean - Estimate σ using the sample standard deviation. 📌 Parameters summarize important features of a probability distribution.

8. Choosing the Appropriate Distribution

    8.1 🍰 Cake Shop Example
    1. A distribution selection guide for a cake shop:
Cake Shop Example
DistributionUse CaseCake Shop Example
NormalContinuous, approximately symmetric dataDaily sales amount
BernoulliOne binary outcomeWhether one visitor buys a cake
BinomialSuccesses in a fixed number of trialsBuyers among 100 visitors
PoissonNumber of events in a fixed intervalCustomer arrivals per hour
    8.2 Distribution Selection Questions
    1. Ask the following questions: Q: Is the variable continuous and approximately symmetric? A: Consider: Normal distribution Q: Is there one trial with two outcomes? A: Consider: Bernoulli distribution Q: Are we counting successes across a fixed number of trials? A: Consider: Binomial distribution Q: 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.

9. PMF, PDF, and CDF

    9.1 📊 Why Do We Need These Functions?
    1. Probability distributions use different functions to describe probabilities. The main functions are: - Probability Mass Function (PMF) - Probability Density Function (PDF) - Cumulative Distribution Function (CDF).
    9.2 Probability Mass Function
    1. 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.
    9.3 Probability Density Function
    1. 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) = 0 Probability 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.
    9.4 Cumulative Distribution Function
    1. 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.5 Quick Comparison
FunctionMeaningApplicable To
PMFProbability of an exact discrete valueDiscrete distributions
PDFDensity of a continuous variableContinuous distributions
CDFProbability of a value less than or equal to xAll distributions

10. Confidence Intervals

    10.1 🎯 What is a Confidence Interval?
    1. 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.
    10.2 Point Estimate vs. Interval Estimate
    1. 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.
    10.3 Net Analogy
    1. 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.
    10.4 General Confidence Interval Formula
    1. The general structure is: Confidence Interval = Point Estimate ± Margin of Error The margin of error is: Margin of Error = Critical Value × Standard Error Therefore: CI = Point Estimate ± Critical Value × Standard Error
    10.5 Confidence Interval for a Mean
    1. When using a Normal critical value and a known population standard deviation: CI = X̄ ± Z × SE where: X̄ = Sample meanZ = Critical valueSE = Standard error The standard error is: SE = σ / √n where: σ = Population standard deviationn = Sample size For a 95% confidence level: Z ≈ 1.96 A Normal-based confidence interval for a population mean with known population standard deviation uses this structure.
    10.6 Python Code
    1. Download heart_df_clean data. 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})")
    10.7 Interpreting a 95% Confidence Level
    1. 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.
    10.8 Important Note about Z and t
    1. 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 interval Unknown population standard deviation → Often t-based interval

11. Summary

Final Distribution Summary
DistributionVariable TypeParametersExample
NormalContinuousμ, σHeight or sales amount
BernoulliDiscrete binarypOne customer purchases or not
BinomialDiscrete countn, pBuyers among 100 visitors
PoissonDiscrete countλArrivals per hour
Ad PlaceholderSlot: 7421026683

Practice QuestionsNot started

  1. Probability Distributions and CI

    Question 1 of 1

      Load heart_diseases_cleaned dataset and:
      1. Calculate the probability that a single randomly selected patient is a currentSmoker.
      2. If we randomly pick 20 patients, what is the probability that - Exactly 8 of them are smokers? - More than 10 are smokers?
      3. Calculate mean and standard deviation of BMI
      4. Assuming BMI is normally distributed calculate: - Probability that a randomly selected patient has BMI greater than 30. - Probability that a patient has BMI between 25 & 30. - Probability that a randomly selected patient has BMI less than 25. - 95% confidence interval for the mean BMI of the population.
Ad PlaceholderSlot: 5413242224