In [ ]:


In [32]:
#help(dbinom) #uncomment this line and re-run to see the help for the binomial distribution.

Here is a binomial distribution with 20 observations and probablity 0.3 of success.


In [27]:
barplot(dbinom(0:20, 20, 0.3))



In [36]:
#help(dhyper)

Here is the hypergeometric distribution, showing the probability of drawing (without replacement) x = 0, 1, ... 8 white balls in 8 draws, from an urn containg 10 white balls and 7 black balls.


In [35]:
barplot(dhyper(0:8, 10,7,8))


Here is a Beta distribution. While not discrete, it is used as a distribution for e.g. the p parameter in a binomial.


In [28]:
curve(dbeta(x, shape1 = 5, shape2 = 2), col = "red")



In [ ]: