Git Product home page Git Product logo

eurostat / quantile Goto Github PK

View Code? Open in Web Editor NEW
9.0 3.0 3.0 7.25 MB

Agnostic (re)implementations (R/SAS/Python/C) of common quantile estimation algorithms.

Home Page: https://github.com/eurostat/quantile

License: European Union Public License 1.1

R 8.79% C 10.42% Python 39.41% SAS 32.49% Julia 5.91% HTML 2.98%
quantile-estimation agnostic-implementation ntts2017 micro-soa open-algorithm quantile sas-quantile r-quantile c-quantile python-quantile

quantile's Introduction

DOI quantile

Software-agnostic (re)implementations of common quantile estimation algorithms

This material is meant as a proof of concept for Grazzini and Lamarche's article and aims at promoting software/language-agnostic development and deployment of statistical processes.

Rationale

We consider here the implementation of quantile estimates based on order statistics. Although quantiles are often implemented throughout various packages of statistical software (R, Python, SAS, Stata, Maple, etc...), the different implementations may not be consistent with each other and, therefore, provide different output estimates. Typically, this happens because different estimation methods are available in the literature, and each one of them corresponds to a specific implementation.

Let us consider, for instance, the (broad) range of techniques for quantile estimation implemented ad-hoc in both SAS and R software. They are respectively made available through the SAS procedure UNIVARIATE and the R function quantile, whose documentations are displayed below:

SAS UNIVARIATE R quantile
doc SAS doc R

Looking at which of Hyndman and Fan's (HF#n), Cunnane's (C), and/or Filliben's (F) algorithms (see references below) are actually available (or not: n.a.) on either software, it appears that there is no one-to-one correspondance between the implementations:

algorithm HF#1 HF#2 HF#3 HF#4 HF#5 HF#6 HF#7 HF#8 HF#9 C F
quantile type 1 2 3 4 5 6 7 8 9 n.a. n.a.
UNIVARIATE PCTLDEF 3 5 2 1 n.a. 4 n.a. n.a. n.a. n.a. n.a.

In particular, the algorithms implemented by default (i.e., when no parameter type, or PCTLDEF, is passed) differ, since indeed HF#7 (type=7) is the default algorithm in R quantile implementation, while HF#2 (PCTLDEF=5) is the default one in SAS UNIVARIATE implementation. Similarly, note that Python method mquantiles implements Cunnane's algorithm as its default option (through (α,β)=(.4,.4) parameter).

Altogether, a user may be left at a disadvantage since he may neither understand all the implications of the estimation process – depending on which platform he performs his calculations, depending on whether he chooses default parameters or not, ... – nor how to test the validity of results produced by the software. A stronger control of the practical and effective implementation of statistical methods and techniques is required.

Objectives

We propose to go back to the original algorithms and provide with a canonical implementation of quantile estimates on different software platforms and/or using different programming languages, so as to show that a consistent implementation is possible accross platforms. In practice, we implement 10 algorithms, 9 derived from Hyndman and Fan's framework, plus 1 described in Cunnane's article and 1 proposed by Filiben, in R, Python, C and SAS. To do so, we either extend/complement (wrap) already existing implementations for quantile estimation (R function quantile, Python method mquantiles, C function gsl_stats, or SAS procedure UNIVARIATE), or actually reimplement the algorithm from scratch (SAS, C and Python). In the former case, we provide with consistent parameterisation/configuration accross the different software so as to ensure consistency and transparency for the user.

However, unnecessary duplication (the same algorithm is being, above, implemented on 4 different platforms) shall be avoided, and, instead the choice of statistical software/packages should be transparent to the user, i.e. the quantile estimation should be provided in a "software-agnostic" manner. To this end, we show that it is possible to easily implement microservices (SOA) that run the quantile estimation (either operated using R or Python) through a web interface (shiny for R, flask for Python).

About

documentation available at: https://eurostat.github.io/quantile/
version 0.9
status since Thu Jan 5 10:22:03 2017 – closed
contributors
license EUPL (cite the source code or the reference above!)

References

quantile's People

Contributors

gjacopo avatar pierre-lamarche avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.