Skip to main content

A Python Based Library to Calculate Estimators (Sn, Qn, MAD, IQR)

Project description

robustbase

A Python Library to Calculate Estimators.

:Author: Deepak Yadav :Version: 2.0 :Copyright: This document has been placed in the public domain.

.. contents::

Qn scale estimator

The median absolute deviation (MAD) and interquartile range are the two most commonly used robust alternatives to the standard deviation. The MAD in particular is a very robust scale estimator. However, the MAD has the following limitations:

  • It does not have particularly high efficiency for data that is in fact normal (37%). In comparison, the median has 64% efficiency for normal data.
  • The MAD statistic also has an implicit assumption of symmetry. That is, it measures the distance from a measure of central location (the median).

Rousseeuw and Croux proposed the Qn estimate of scale as an alternative to the MAD. It shares desirable robustness properties with MAD (50% breakdown point, bounded influence function). In addition, it has significantly better normal efficiency (82%) and it does not depend on symmetry. ReadMore <https://www.itl.nist.gov/div898/software/dataplot/refman2/auxillar/qn_scale.htm> _

Sn scale estimator

Rousseeuw and Croux proposed the Sn estimate of scale as an alternative to the MAD. It shares desirable robustness properties with MAD (50% breakdown point, bounded influence function). In addition, it has significantly better normal efficiency (58%) and it does not depend on symmetry.

The Sn scale estimate is defined as:

Sn=cMediani{Medianj|xi−xj|} That is, for each i we compute the median of {|xi - xj j = 1, ..., n}. The median of these n numbers is then the estimate of Sn. The constant c is determined to make Sn a consistent estimator. The value used is 1.1926 (this is the value needed to make Sn a consistent estimator for normal data). 'ReadMore https://www.itl.nist.gov/div898/software/dataplot/refman2/auxillar/sn_scale.htm'_

Median Absolute Deviation(MAD)

The median absolute deviation(MAD) is a robust measure of how spread out a set of data is. The variance and standard deviation are also measures of spread, but they are more affected by extremely high or extremely low values and non normality. If your data is normal, the standard deviation is usually the best choice for assessing spread. However, if your data isn’t normal, the MAD is one statistic you can use instead.

The MAD is defined as:

MAD = median(|Yi – median(Yi|)

'ReadMore https://www.statisticshowto.datasciencecentral.com/median-absolute-deviation/'_

Interquartile Range (IQR)

The interquartile range is a measure of where the “middle fifty” is in a data set. Where a range is a measure of where the beginning and end are in a set, an interquartile range is a measure of where the bulk of the values lie. That’s why it’s preferred over many other measures of spread (i.e. the average or median) when reporting things like school performance or SAT scores.

The interquartile range formula is the first quartile subtracted from the third quartile: IQR = Q3 – Q1.

'ReadMore https://www.statisticshowto.datasciencecentral.com/probability-and-statistics/interquartile-range/"_

Installation

  • Install from python pacakage 'or' -pip install robustbase

  • Clone the repo and run

  • python3 setup.py install

How to Use

code::

from robustbase.robustbase import Qn import numpy as np

data = np.random.rand(10) print(Qn(data))

References

soon...

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

robustbase-0.2.1.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

robustbase-0.2.1-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file robustbase-0.2.1.tar.gz.

File metadata

  • Download URL: robustbase-0.2.1.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2.post20191203 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.0

File hashes

Hashes for robustbase-0.2.1.tar.gz
Algorithm Hash digest
SHA256 88fc375d324d0a0f4f09c8bb5556c35e9fa742009c974d1168d79e39b54e6f95
MD5 9bf842e4d83f34cdcc7cf1af5588edb6
BLAKE2b-256 79598af8d82c7eb693f22ab8adf4bcc26d54fc1a755affd4860e5e2617d28092

See more details on using hashes here.

File details

Details for the file robustbase-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: robustbase-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2.post20191203 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.0

File hashes

Hashes for robustbase-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6b5032732797954f0c5b361f4beae4cea0576013664515a287ea76a8226c8a2f
MD5 7458bac1fe82fd7a298019d3578a778d
BLAKE2b-256 576c673a8a0a2991e8858fc50425b1db04f5c857f9029d7e6e1f891165b1224f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page