简体   繁体   中英

Distribution fitting in Python without SciPy

I am writing a python script that needs to make a distribution fit against some generated data.

I found that this is possible using SciPy, or other packages having SciPy as dependency; however, due to administrative constraints, I am unable to install SciPy's dependencies (such as Blas) on the machine where the script will run.

Is there a way to perform distribution fitting in Python without using SciPy or packages depending on it?

EDIT : as asked in a comment, what I want to do is perform an Anderson-Darling test for normality.

The alternatives I found so far (but had to disregard):

  1. statsmodel : has SciPy as dependency
  2. R and Matlab python apis: need setup of external software, same problem for me as SciPy

Fitting the normal distribution only requires calculating mean and standard deviation.

The Anderson-Darling test only requires numpy or alternatively could be rewritten using list comprehension. The critical values for the AD-test are tabulated or based on a simple approximation formula. It does not use any difficult parts of scipy like optimize or special.

So, I think it should not be too difficult to translate either the scipy.stats or the statsmodels version to using pure Python or only with numpy as dependency.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM