<jupyter_start><jupyter_text>DistributionsLet's play with a few distributions and their Scipy functions to familiarise ourselves with how to invoke them.<jupyter_code>import scipy.stats as st
import matplotlib.pyplot as plt
import numpy as np
xs = np.linspace(-5, 10, 2000)
ks = np.arange(50)<jupyter_output><empty_output><jupyter_text>Discrete PMFsBinomial distribution, Poisson distribution<jupyter_code>pmf_binom = st.binom.pmf(ks, 50, 0.25)
plt.bar(ks, pmf_binom, label="Binomial Example (dice)", alpha=0.8)

pmf_poisson = st.poisson.pmf(ks, 30)
plt.bar(ks, pmf_poisson, label="Poisson Example (car crash)", alpha=0.8)
plt.legend();

print(st.binom.pmf(10, 50, 0.25))
print(st.poisson.pmf(50, 30))<jupyter_output>0.09851840993941652
0.00022087848072126846<jupyter_text>Continuous DistributionsUniform, normal, exponential, student-t, log-normal, skew-normal.<jupyter_code>pdf_uniform = st.uniform.pdf(xs, -4, 10)
plt.plot(xs, pdf_uniform, label="Uniform(-4,6)")

pdf_normal = st.norm.pdf(xs, loc=5, scale=2)
plt.plot(xs, pdf_normal, label="Normal(5, 2)")

pdf_exponential = st.expon.pdf(xs, loc=-2, scale=2)
plt.plot(xs, pdf_exponential, label="Exponential(0.5)")

pdf_studentt = st.t.pdf(xs, 1)
plt.plot(xs, pdf_studentt, label="Student-t(1)")

pdf_lognorm = st.lognorm.pdf(xs, 1)
plt.plot(xs, pdf_lognorm, label="Lognorm(1)")

pdf_skewnorm = st.skewnorm.pdf(xs, -6)
plt.plot(xs, pdf_skewnorm, label="Skewnorm(5)")

plt.legend()
plt.ylabel("Prob")
plt.xlabel("x");
plt.plot(xs, st.t.pdf(xs, 1, loc=4, scale=2), label="In built")
plt.plot(xs, st.t.pdf((xs-4)/2, 1, loc=0, scale=1), label="Manually")
plt.legend();<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.16879174256223436, 'fraction_numerical': 0.0588949605343048, 'mean_word_length': 6.923076923076923, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '391880', 'license': 'Unlicense', 'n_tokens_mistral': 759, 'n_tokens_neox': 685, 'n_words': 127, 'path': 'Statistical Analysis/Probability/Distributions.ipynb', 'repo_name': 'meghasharma123/Notebook-Ex', 'size': '1647'}