Fitting Binomial Distribution | Data Science and A.I. Lecture Series

Fitting Binomial Distribution

Introduction

  • Fitting a binomial distribution involves comparing observed frequencies with expected frequencies derived from the binomial probability formula.
  • The recurrence relation simplifies the process of finding probabilities.
  • This technique is useful for testing if a dataset follows a binomial distribution.

Binomial Probability Function

The binomial probability function is:

$$p(x) = {n \choose x} p^x q^{n – x}$$

Where:

  • n = number of trials
  • p = probability of success
  • q = 1 – p = probability of failure

Derivation of Recurrence Relation

Start with the binomial probability function:

$$p(x) = \frac{n!}{x! (n – x)!} p^x q^{n – x}$$

For \( p(x + 1) \):

$$p(x + 1) = \frac{n!}{(x + 1)! (n – x – 1)!} p^{x+1} q^{n – x – 1}$$

Divide \( p(x + 1) \) by \( p(x) \):

$$\frac{p(x + 1)}{p(x)} = \frac{(n – x)}{(x + 1)} \cdot \frac{p}{q}$$

Therefore, the recurrence relation is:

$$p(x + 1) = \frac{(n – x)}{(x + 1)} \cdot \frac{p}{q} \cdot p(x)$$

Example: Tossing 4 Coins

Observed data:

  • 0 heads: 15 times
  • 1 head: 35 times
  • 2 heads: 90 times
  • 3 heads: 40 times
  • 4 heads: 20 times

Total number of tosses: 200

Calculation of Mean and Probability

Mean:

$$\bar{x} = \frac{415}{200} = 2.075$$

Probability of success:

$$p = \frac{2.075}{4} = 0.5188, \quad q = 1 – p = 0.4812$$

Calculate:

$$p(0) = q^4 = (0.4812)^4 = 0.0536$$

Using Recurrence Relation

Use:

$$p(x + 1) = \frac{(n – x)}{(x + 1)} \cdot \frac{p}{q} \cdot p(x)$$

Calculate:

  • p(1) = 4 × (0.5188 / 0.4812) × 0.0536 = 0.23115
  • p(2) = (3 / 2) × (0.5188 / 0.4812) × 0.23115 = 0.37382
  • p(3) = 2 × (0.5188 / 0.4812) × 0.37382 = 0.26859
  • p(4) = (1 / 4) × (0.5188 / 0.4812) × 0.26859 = 0.0724

Detailed Summary Table

Number of Heads (X) Recurrence Relation p(x) Expected Frequency
0 Initial: q^4 0.0536 10.72
1 4 × (p/q) × p(0) 0.23115 46.23
2 (3/2) × (p/q) × p(1) 0.37382 74.76
3 2 × (p/q) × p(2) 0.26859 53.71
4 (1/4) × (p/q) × p(3) 0.0724 14.48

Conclusion

    • The expected frequencies using the binomial model are close to the observed frequencies.
    • The example supports the assumption that the coin is unbiased.
    • The recurrence relation simplifies stepwise calculation of probabilities.

PDF

binomial probability fitting

Video

 

Reach PostNetwork Academy

Thank You!

©Postnetwork-All rights reserved.