cokelaer / fitter

Fit data to many distributions
https://fitter.readthedocs.io/
GNU General Public License v3.0
364 stars 58 forks source link

The ks_test results obtained from the module are different from the results while using the ks_test myself #85

Open Summer0328 opened 1 year ago

Summer0328 commented 1 year ago

Hi,

I use f.summary() to print the ks_statistic and ks_pvalue. However, the ks_pvalue for a good fit (visually) is lower than 0.05. I then calculate the ks_pvalue using the paras obtained from the f_fitted_param to do the ks_test myself and find a high p_value. Could you explain the ks_test you applied? Why is there a significant difference?

Attached is my way to calculate the p_value. a = f.fitted_param['invgamma'][0] loc = f.fitted_param['invgamma'][1] scale = f.fitted_param['invgamma'][2] x = np.linspace(invgamma.ppf(0.001, a,loc,scale), invgamma.ppf(0.999, a,loc,scale), 10000) ks_value = stats.kstest(data, x)