python - Kolmogorov-Smirnov test in Scipy with non-normalized data -
I am trying to check whether a list of values is evenly distributed or not. I know that there is a proper examination to run the Kolmogorov-Smirnov test. However, my results do not matter to me.
In the code given below, I create two lists of values that are evenly distributed, and y is not evenly distributed.
What should be: I run SippyCest () on both XP and Y, and for the X pass does not pass P-Well, YK-P-value. / P> What's happening: I run SippyCest () on XP and Y, and P-Value is 0.0 for both X and Y. [1] In SPE import data, SP imports are imported as SP imports, as imported matplotlib.pyplot plt% matplotlib inline according to NP import math import [2]: X = np.random.uniform (size = 1000) sigma_x = np .std (x) mean_x = x.mean () plt.hist (x) plt.show () in [3]: y = x ** 4 sigma_y = Np.std (y) mean_y = y.mean () plt [4]: (0.499, 0.0) in [5]: statistics. (4):. Kstest (y, 'uniform', args = (mean_y, sigma_y)) [5]: (0.67400000000000004, 0.0) You are abusing the argument So you do not want to use mean and standard deviation instead you want to define a minimum and more similar definition, loc and
scale , and between "
loc and
loc + scale
args = (0, 1) If you want to test against a uniform equal distribution, or
args = (min (X), max (x)) if you want to use sample estimates. Import import data from
npx = np.random.uniform (size = 1000) Y = x ** 4 stats. Kestest (X, 'Uniform', Args = (0, 1)) # (0.02953849 9688200326, 0.34247911001793319) Statistics. Kestest (y, 'uniform', args = c (0, 1)) # (0.50121963249814794, 0.0)
Comments
Post a Comment