Nov-25-2017, 12:33 PM
(This post was last modified: Nov-25-2017, 12:33 PM by asahdkhaled.)
from scipy.stats import norm as n import numpy as np from scipy.stats import * data= [36, 22, 24, 21, 22, 18, 14, 24, 28, 8, 22, 16, 16, 26, 17, 24, 24, 14, 15, 24, 21, 20, 19, 17, 13, 13, 17, 30, 17, 11, 45, 15, 19, 21, 15, 13, 14, 16, 25, 21] var, std, mean, length = np.var(data), np.std(data), np.mean(data), len(data) mini, maxi = min(data), max(data) a, b = (min(data) - mean) / std, (max(data) - mean) / std uniform, norm2 = np.random.uniform(mini, maxi, length), np.random.normal(mean, std, length) loc, scale = n.fit(data) n_array = norm(loc=loc, scale=scale) #possibility 1: ks_2samp print ks_2samp(data,norm2) #possibility 2: kstest vs n.cdf() print kstest(data, n_array.cdf) #possibility 3:kstest vs. 'norm' print kstest(data, 'norm') #possibility 4: kstest vs. 'norm' with parameters print kstest(data,'norm', (mean,std))Ah yeah sorry. The first n ist just the norm package from scipy.
The second n is just a variable. I renamed it to n_array