jmquintana79
4/14/2016 - 3:08 PM

Plot to check quantiles of distribution for any sample: qqplot

Plot to check quantiles of distribution for any sample: qqplot

## probplot (scipy)

# Tutorial: http://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.probplot.html
import numpy as np 
import pylab 
import scipy.stats as stats

measurements = np.random.normal(loc = 20, scale = 5, size=100)   
stats.probplot(measurements, dist="norm", plot=pylab)
pylab.show()


## qqplot (statsmodels)

# Tutorial: http://statsmodels.sourceforge.net/devel/generated/statsmodels.graphics.gofplots.qqplot.html
import numpy as np
import statsmodels.api as sm
import pylab

test = np.random.normal(0,1, 1000)

sm.qqplot(test, line='45')
pylab.show()