# -*- coding: utf-8 -*-
"""
Created on Tue Jun 22 13:18:12 2021

@author: Sim
"""
from scipy.stats import binom
import pandas as pd
import matplotlib.pyplot as plt

x = list(range(5))
pmf = binom.pmf(x, 4, 0.5 )
cdf = binom.cdf(x, 4, 0.5)
quantile = binom.ppf([0, 0.25, 0.5, 0.75, 1], 4, 0.5)
moments = binom.stats(4, 0.5, moments='mvsk')
median = binom.median(4, 0.5)
stdev = binom.std(4, 0.5)

xx = binom.rvs(4,0.5, size=1000)
xx2 = pd.Series(xx)
freqx = xx2.value_counts(sort=False)
freqx.plot.bar()
plt.plot(x,pmf*1000, 'r-')
plt.show()

ecdf = freqx.cumsum()
plt.bar(x, ecdf)
ax2 = plt.twinx()
ax2.plot(x, cdf*1000, 'r-')
plt.show()



