title: SciPy skewnormal fitting
body: <p>I am trying to fit data into a skew normal distribution using the <em>SciPy Skewnorm</em> package.</p>
  
  <p>However, I am failing to understand the usage properly as I cannot find proper documentation or examples on this matter.</p>
  
  <p>On the help section I found <a href="https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.skewnorm.html" rel="noreferrer">Documentation</a> and trying to use <code>skewnorm.fit()</code> along with <code>skewnorm.pdf()</code> to fit data into a model and use that model to output a distribution and compare with the original data. </p>
  
  <p>Please let me know if anyone can help with this.</p>
  
  <pre><code>from scipy import stats
  import matplotlib.pyplot as plt
  import numpy as np
  
  # choose some parameters
  a, loc, scale = 5.3, -0.1, 2.2
  # draw a sample
  data = stats.skewnorm(a, loc, scale).rvs(1000)
  # estimate parameters from sample
  ae, loce, scalee = stats.skewnorm.fit(data)
  # Plot the PDF.
  plt.figure()
  plt.hist(data, bins=100, normed=True, alpha=0.6, color='g')
  xmin, xmax = plt.xlim()
  x = np.linspace(xmin, xmax, 100)
  p = stats.skewnorm.pdf(x,ae, loce, scalee)#.rvs(100)
  plt.plot(x, p, 'k', linewidth=2)
  </code></pre>
  
  <p>Output: </p>
  
  <p><img src="https://i.stack.imgur.com/9E7rt.png" alt="enter image description here"></p>