/robustbase

A Python Based Library to Calculate Statistical Estimators

Primary LanguagePythonMIT LicenseMIT

Downloads Downloads Downloads

robustbase

A Python Library to Calculate Estimators.

Installation

OS X , Windows & Linux:

pip install robustbase

Usage example

This package is used to calculate the following statistical estimators.

  • Qn scale estimator
    • Compute the robust scale estimator Qn, an efficient alternative to the MAD. Read More.
Qn(x, constant = 2.21914, finite_corr=True)
from robustbase import Qn
  
x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

# with bias correction
res = Qn(x)  # ans = 3.196183

# Without bias correction
res = Qn(x, finite_corr=False)  # ans = 4.43828
  • Sn scale estimator
    • Compute the robust scale estimator Sn, an efficient alternative to the MAD.Read More.
Sn(x, constant = 1.1926, finite_corr=True)
from robustbase import Sn
  
x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

# with bias correction
res = Sn(x)  # ans = 3.5778 
# Note: This is not working properly as R Sn code works (Fix it)

# Without bias correction
res = Sn(x, finite_corr=False)  # ans = 3.5778
  • Median Absolute Deviation(MAD)
mad(x, center = None, constant = 1.4826, na = False,
    low = False, high = False)
from robustbase import mad

x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
res = mad(x)
  • Interquartile Range (IQR)
iqr(x)
from robustbase import iqr

x = [1, 2, 3, 4. 5]
res = iqr(x)

Development setup

For local development setup

git clone https://github.com/deepak7376/robustbase
cd robustbase
pip install -r requirements.txt

Meta

Deepak Yadav – @imdeepak_dkydky.united@gmail.com

Distributed under the MIT license. See LICENSE for more information.

https://github.com/deepak7376/robustbase/blob/master/LICENSE

Contributing

  1. Fork it (https://github.com/deepak7376/robustbase/fork)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request

References

https://www.itl.nist.gov/div898/software/dataplot/refman2/auxillar/qn_scale.htm https://www.itl.nist.gov/div898/software/dataplot/refman2/auxillar/sn_scale.htm https://www.statisticshowto.datasciencecentral.com/median-absolute-deviation/ https://www.statisticshowto.datasciencecentral.com/probability-and-statistics/interquartile-range/