<jupyter_start><jupyter_text>Draw Sample<jupyter_code>sample = np.random.normal(loc=14, scale=3, size=1000)
plt.hist(sample, label='norm pdf')<jupyter_output><empty_output><jupyter_text>Draw PDF<jupyter_code>x = np.linspace(-10, 10, 10000)
# create a random variable
rv = norm()
plt.plot(x, rv.pdf(x), label='norm pdf')
# apply analytical formula
plt.plot(x, norm.pdf(x, loc=3, scale=1))
# apply analytical formula
plt.plot(x, norm.cdf(x, loc=3, scale=1))<jupyter_output><empty_output><jupyter_text>Plot a region<jupyter_code># define constants
mu = 998.8 
sigma = 73.10
x1 = 900
x2 = 1100
# calculate the z-transform
z1 = ( x1 - mu ) / sigma
z2 = ( x2 - mu ) / sigma
# build the plot
fig, ax = plt.subplots()

x = np.arange(z1, z2, 0.001) # range of x in spec
y = norm.pdf(x,0,1)
ax.fill_between(x, y, 0, alpha=0.3, color='b')

x_all = np.arange(-10, 10, 0.001)
y2 = norm.pdf(x_all,0,1)
ax.fill_between(x_all, y2, 0, alpha=0.1)


ax.plot(x_all, y2)

ax.set_xlim([-4,4])
ax.set_yticklabels([])

plt.show()<jupyter_output><empty_output><jupyter_text>Compute Area<jupyter_code>norm.cdf(-1.96, loc=0, scale=1)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1742957746478873, 'fraction_numerical': 0.06602112676056338, 'mean_word_length': 5.6104651162790695, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, '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': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '82725', 'license': 'MIT', 'n_tokens_mistral': 552, 'n_tokens_neox': 505, 'n_words': 99, 'path': 'distribution/gaussian.ipynb', 'repo_name': 'shawlu95/Data_Science_Toolbox', 'size': '1136'}