October 2019
Beginner to intermediate
674 pages
16h 43m
English
The discrete uniform distribution is a distribution that models an event with a finite set of possible outcomes where each outcome is equally likely to be observed. For n outcomes, each has a probability of occurrence of 1/n.
An example of this is throwing a fair die. The probability of any of the six outcomes is 1/6. The PMF is given by 1/n, and the expected value and variance are given by (max + min)/2 and (n2 -1)/12 respectively:
from matplotlib import pyplot as plt
import matplotlib.pyplot as plt
X=range(0,11)
Y=[1/6.0 if x in range(1,7) else 0.0 for x in X]
plt.plot(X,Y,'go-', linewidth=0, drawstyle='steps-pre',
label="p(x)=1/6")
plt.legend(loc="upper left")plt.vlines(range(1,7),0,max(Y), linestyle='-') ...Read now
Unlock full access