title: Implementing a Kolmogorov Smirnov test in python scipy
body: <p>I have a data set on N numbers that I want to test for normality.
  I know scipy.stats has a <a href="http://docs.scipy.org/doc/scipy-0.7.x/reference/generated/scipy.stats.kstest.html" rel="noreferrer">kstest function</a>
  but there are no examples on how to use it and how to interpret the results.
  Is anyone here familiar with it that can give me some advice?</p>
  
  <p>According to the documentation, using kstest returns two numbers, the KS test statistic D and the p-value.
  If the p-value is greater than the significance level (say 5%), then we cannot reject the hypothesis that the data come from the given distribution.</p>
  
  <p>When I do a test run by drawing 10000 samples from a normal distribution and testing for gaussianity:</p>
  
  <pre><code>import numpy as np
  from scipy.stats import kstest
  
  mu,sigma = 0.07, 0.89
  kstest(np.random.normal(mu,sigma,10000),'norm')
  </code></pre>
  
  <p>I get the following output:</p>
  
  <blockquote>
    <p>(0.04957880905196102, 8.9249710700788814e-22)</p>
  </blockquote>
  
  <p>The p-value is less than 5% which means that we can reject the hypothesis that the data are normally distributed. But the samples were drawn from a normal distribution!</p>
  
  <p>Can someone understand and explain to me the discrepancy here?</p>
  
  <p>(Does testing for normality assume mu = 0 and sigma = 1? If so, how can I test that my data are gaussianly distributed but with a different mu and sigma?)</p>