dipanda
dipanda

Reputation: 790

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

Upvotes: 1

Views: 490

Answers (1)

Josef
Josef

Reputation: 22897

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.

Upvotes: 1

Related Questions