Math::Regressionizer — README

Math::Regressionizer

Raku package with a class that allows pipeline-like specification and execution of regression workflows.

Extensive guide is given in the Jupyter notebook "Rapid-specification-of-regression-workflows.ipynb" and the corresponding Markdown document "Rapid-specification-of-regression-workflows.md".

Features summary

  • The class Math::Regressionizer facilitates rapid specifications of regressions workflows.

    • To quickly specify:

      • data rescaling and summary

      • regression computations

      • outliers finding

      • conditional Cumulative Distribution Functions (CDFs) reconstruction

      • plotting of data, fits, residual errors, outliers, CDFs

  • Math::Regressionizer works with datasets, numerical arrays, lists of numbers, and lists of numeric pairs.

Details and arguments

  • The curves computed with Quantile Regression are called regression quantiles.

  • Math::Regressionizer has three regression methods:

    • quantile-regression

    • quantile-regression-fit

    • least-squares-fit

  • The regression quantiles computed with the methods quantile-regression and quantile-regression_fit correspond to probabilities specified with the argument :probs(:@probabilities).

  • The methodquantile-regression computes fits using a B-spline functions basis.

    • The basis is specified with the arguments :@knots and :order(:$interpolation-order).

    • :order(:$interpolation-order) is 3 by default.

  • The methods quantile-regession-fit and least-squares-fit use lists of basis functions to fit with specified with the argument :funcs(:@basis).

Workflows flowchart

The following flowchart summarizes the workflows that are supported by Regressionizer:

i_raw_githubusercontent_com_antononcube_python_regressionizer_main_docs_img_quantile_regression_workflow_extended_jpg

Usage examples

Load packages:

use Math::Regressionizer;
use Data::Generators;

Generate random data:

srand(0);
my @x = 0, 0 + 1/300 ... 2;
my @y = @x.map({ sin(2 * pi * $_) }) <<+>> random-variate(NormalDistribution.new(0, 0.4), @x.elems);
my @data = @x Z @y;

Compute quantile regression for probabilities [0.2, 0.5, 0.8] and make the corresponding plot:

#% html
my $obj = 
  Math::Regressionizer.new(@data)
  .quantile-regression(knots => 8, probs => [0.2, 0.5, 0.8])
  .plot(title => "B-splines fit", template => "dark", format => 'html')

Remark If the code cell above is executed in a Jupyter notebook with a Raku kernel then the plot is shown. "Math::Regressionizer" uses the package "JavaScript::Google::Charts" for its plots.

Export the plot obtained above:

spurt('qr-plot.html', $obj.take-value)

i_raw_githubusercontent_com_antononcube_python_regressionizer_main_docs_img_random_data_b_spline_rqs_png

References

Articles, books

[RK1] Roger Koenker, Quantile Regression, Cambridge University Press, 2005.

[RK2] Roger Koenker, "Quantile Regression in R: a vignette", (2006), CRAN.

[AA1] Anton Antonov, "A monad for Quantile Regression workflows", (2018), MathematicaForPrediction at GitHub.

Packages, paclets

[RKp1] Roger Koenker, quantreg, CRAN.

[AAp1] Anton Antonov, Quantile Regression, WL paclet, (2014-2023), GitHub/antononcube.

[AAp2] Anton Antonov, Monadic Quantile Regression, WL paclet, (2018-2024), GitHub/antononcube.

[AAp3] Anton Antonov, QuantileRegression, (2019), Wolfram Function Repository.

Repositories

[AAr1] Anton Antonov, DSL::English::QuantileRegressionWorkflows, Raku package, (2020), GitHub/antononcube.

Videos

[AAv1] Anton Antonov, "Boston useR! QuantileRegression Workflows 2019-04-18", (2019), Anton Antonov at YouTube.

[AAv2] Anton Antonov, "useR! 2020: How to simplify Machine Learning workflows specifications", (2020), R Consortium at YouTube.

[AAv3] Anton Antonov, "Quantile Regression Workflows (PyData Global 2024)", (2025), Anton Antonov at YouTube.

Math::Regressionizer v0.0.3

A package for rapid specification of Quantile Regression workflows.

Authors

  • Anton Antonov

License

Artistic-2.0

Dependencies

Data::Transformers:ver<0.0.4+>Math::Splines:ver<0.0.2+>Math::Polynomial::Chebyshev:ver<0.0.2+>Math::QuantileRegression:ver<0.0.4+>Statistics::OutlierIdentifiersJavaScript::Google::Charts

Test Dependencies

Provides

  • Math::Regressionizer

The Camelia image is copyright 2009 by Larry Wall. "Raku" is a trademark of the Yet Another Society. All rights reserved.

Built with Podlite — the markup and publishing tools behind this site.