0

This is a very simple example, I'm simulating normally distributed data in Python, and performing a Kolmogorov - Smirnov Test on my sample to check the goodness-of-fit(of the sample distribution compared with a Normal distribution)

Code:

from matplotlib import pyplot as plt

import numpy as np

from scipy import stats

data = stats.norm.rvs(5, 10, size=1000)

plt.hist(data)

print(stats.kstest(data, 'norm'))

enter image description here

KstestResult(statistic=0.57991242997450898, pvalue=0.0)

However, the p-value I get is very small!-> which means I have to reject the Null hypothesis, and conclude that the sample does not follow the distribution.

Could someone explain what I'm doing wrong here?

coelhudo
  • 105
  • 5
ricksanchez
  • 639
  • 1
  • 10
  • 16
  • 1
    I'm assuming that the KS test will by default compare the sample distribution to a Gaussian distribution with mean 0 and SD 1, which is not the case in your experiment. – Vincent Guillemot Jan 30 '18 at 12:23

0 Answers0