Skip to content
Snippets Groups Projects
Commit 8334184e authored by Mauro Donega's avatar Mauro Donega
Browse files

clean up

parent 3387871c
No related branches found
No related tags found
No related merge requests found
%% Cell type:markdown id: tags:
# Quantiles
%% Cell type:code id: tags:
``` python
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
from scipy.stats import norm
plt.figure(figsize=[5,15])
plt.subplot(211)
# cumulative of the gaussian pdf
x = np.linspace(-5,5,100)
plt.plot(x, norm.cdf(x),'b-', alpha=0.6)
plt.xlabel(r'x [units]')
plt.ylabel(r'cdf(x)')
# draw vertical line from (70,100) to (70, 250)
for i in range(0,11):
step = i*0.1
plt.plot([-5,5], [step, step], 'k--', lw='0.2')
plt.plot([norm.ppf(step),norm.ppf(step)], [step, 0], 'k--', lw='0.2')
plt.subplot(212)
plt.subplots_adjust(top=0.5)
# gaussian pdf
x = np.linspace(-5,5,100)
plt.plot(x, norm.pdf(x),'b-', alpha=0.6)
plt.xlabel(r'x [units]')
plt.ylabel(r'pdf(x)')
s =[]
p =[]
for i in range(0,11):
step = i*0.1
s.append("{:.1f}".format(step))
p.append("{:.3f}".format(norm.ppf(step)))
plt.plot([norm.ppf(step),norm.ppf(step)], [norm.pdf(norm.ppf(step)), 0], 'k--', lw='0.2')
print (s)
print (p)
```
%% Output
['0.0', '0.1', '0.2', '0.3', '0.4', '0.5', '0.6', '0.7', '0.8', '0.9', '1.0']
['-inf', '-1.282', '-0.842', '-0.524', '-0.253', '0.000', '0.253', '0.524', '0.842', '1.282', 'inf']
%% Cell type:code id: tags:
``` python
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment