The binomial distribution

The binomial distribution is used to represent the number of successes in n-independent Bernoulli trials, which can be expressed as the following:

Y = X1 + X2 + ... + Xn 

Using the coin toss example, this distribution models the chance of getting X heads over n trials. For 100 tosses, the binomial distribution models the likelihood of getting 0 heads (extremely unlikely) to 50 heads (highest likelihood) to 100 heads (also extremely unlikely). This ends up making the binomial distribution symmetrical when the odds are perfectly even and skewed when the odds are far less even. The PMF is given by the following expression:

 

The expectation and variance are given respectively by the following expressions:

This is shown using the following code block:

     from scipy.stats import binom
       clrs = ['blue','green','red','cyan','magenta']     plt.figure(figsize=(12,6))
      k = np.arange(0, 22)
      for p, color in zip([0.001, 0.1, 0.3, 0.6, 0.999], clrs):
           rv = binom(20, p)
           plt.plot(k, rv.pmf(k), lw=2, color=color, label="$p$=" + str(round(p,1)))
    
            plt.legend()
      plt.title("Binomial distribution PMF")
      plt.tight_layout()
      plt.ylabel("PDF at $k$")
      plt.xlabel("$k$")
  

The following is the output:

Binomial distribution
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset