2
0
mirror of https://github.com/boostorg/math.git synced 2026-01-19 04:22:09 +00:00
Files
math/doc/html/dist.html
Evan Miller 18ed616376 Kolmogorov-Smirnov distribution (#422)
* Kolmogorov-Smirnov distribution #421

Add a new distribution, kolmogorov_smirnov_distribution, which takes a
parameter that represents the number of observations used in a
Kolmogorov-Smirnov test. (The K-S test is a popular test for comparing
two CDFs, but the test statistic is not implemented here.)

This implementation includes Kolmogorov's original 1st order Taylor
expansion. There is a literature on the distribution's other
mathematical properties (higher order terms and exact version); this
literature is summarized in the main header file for anyone who may
want to expand the implementation later.

The CDF is implemented using a Jacobi theta function, and the PDF is a
hand-rolled derivative of that function. Quantiles plug the CDF and PDF
into a Newton-Raphson iteration. The mean and variance have nice
closed-form expressions, and the mode uses a dumb run-time maximizer.

This commit includes graphs, a ULP plotter for the PDF, and the usual
compilation and numerical tests. The test file is on the small side, but
it integrates the distribution from zero to infinity, and covers the
quantiles pretty well. As of now the numerical tests only verify
self-consistency (e.g. distribution moments and CDF-quantile relations),
so there's room to add some external checks.

* Implement skewness for K-S distribution [CI SKIP]

The third moment integrates nicely with the help of Apery's constant
(zeta_three). Verify the result via quadrature.

* Implement kurtosis for the K-S distribution

Verify the result via quadrature.
2020-09-04 08:48:51 -04:00

227 lines
15 KiB
HTML

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Chapter&#160;5.&#160;Statistical Distributions and Functions</title>
<link rel="stylesheet" href="math.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="index.html" title="Math Toolkit 2.12.0">
<link rel="up" href="index.html" title="Math Toolkit 2.12.0">
<link rel="prev" href="math_toolkit/constants_faq.html" title="Math Constants FAQs">
<link rel="next" href="math_toolkit/stat_tut.html" title="Statistical Distributions Tutorial">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
<td align="center"><a href="../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="math_toolkit/constants_faq.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="index.html"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="math_toolkit/stat_tut.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="chapter">
<div class="titlepage"><div><div><h1 class="title">
<a name="dist"></a>Chapter&#160;5.&#160;Statistical Distributions and Functions</h1></div></div></div>
<div class="toc">
<p><b>Table of Contents</b></p>
<dl class="toc">
<dt><span class="section"><a href="math_toolkit/stat_tut.html">Statistical Distributions Tutorial</a></span></dt>
<dd><dl>
<dt><span class="section"><a href="math_toolkit/stat_tut/overview.html">Overview of Statistical
Distributions</a></span></dt>
<dd><dl>
<dt><span class="section"><a href="math_toolkit/stat_tut/overview/headers.html">Headers and
Namespaces</a></span></dt>
<dt><span class="section"><a href="math_toolkit/stat_tut/overview/objects.html">Distributions
are Objects</a></span></dt>
<dt><span class="section"><a href="math_toolkit/stat_tut/overview/generic.html">Generic operations
common to all distributions are non-member functions</a></span></dt>
<dt><span class="section"><a href="math_toolkit/stat_tut/overview/complements.html">Complements
are supported too - and when to use them</a></span></dt>
<dt><span class="section"><a href="math_toolkit/stat_tut/overview/parameters.html">Parameters
can be calculated</a></span></dt>
<dt><span class="section"><a href="math_toolkit/stat_tut/overview/summary.html">Summary</a></span></dt>
</dl></dd>
<dt><span class="section"><a href="math_toolkit/stat_tut/weg.html">Worked Examples</a></span></dt>
<dd><dl>
<dt><span class="section"><a href="math_toolkit/stat_tut/weg/dist_construct_eg.html">Distribution
Construction Examples</a></span></dt>
<dt><span class="section"><a href="math_toolkit/stat_tut/weg/st_eg.html">Student's t Distribution
Examples</a></span></dt>
<dd><dl>
<dt><span class="section"><a href="math_toolkit/stat_tut/weg/st_eg/tut_mean_intervals.html">Calculating
confidence intervals on the mean with the Students-t distribution</a></span></dt>
<dt><span class="section"><a href="math_toolkit/stat_tut/weg/st_eg/tut_mean_test.html">Testing
a sample mean for difference from a "true" mean</a></span></dt>
<dt><span class="section"><a href="math_toolkit/stat_tut/weg/st_eg/tut_mean_size.html">Estimating
how large a sample size would have to become in order to give a significant
Students-t test result with a single sample test</a></span></dt>
<dt><span class="section"><a href="math_toolkit/stat_tut/weg/st_eg/two_sample_students_t.html">Comparing
the means of two samples with the Students-t test</a></span></dt>
<dt><span class="section"><a href="math_toolkit/stat_tut/weg/st_eg/paired_st.html">Comparing
two paired samples with the Student's t distribution</a></span></dt>
</dl></dd>
<dt><span class="section"><a href="math_toolkit/stat_tut/weg/cs_eg.html">Chi Squared Distribution
Examples</a></span></dt>
<dd><dl>
<dt><span class="section"><a href="math_toolkit/stat_tut/weg/cs_eg/chi_sq_intervals.html">Confidence
Intervals on the Standard Deviation</a></span></dt>
<dt><span class="section"><a href="math_toolkit/stat_tut/weg/cs_eg/chi_sq_test.html">Chi-Square
Test for the Standard Deviation</a></span></dt>
<dt><span class="section"><a href="math_toolkit/stat_tut/weg/cs_eg/chi_sq_size.html">Estimating
the Required Sample Sizes for a Chi-Square Test for the Standard Deviation</a></span></dt>
</dl></dd>
<dt><span class="section"><a href="math_toolkit/stat_tut/weg/f_eg.html">F Distribution Examples</a></span></dt>
<dt><span class="section"><a href="math_toolkit/stat_tut/weg/binom_eg.html">Binomial Distribution
Examples</a></span></dt>
<dd><dl>
<dt><span class="section"><a href="math_toolkit/stat_tut/weg/binom_eg/binomial_coinflip_example.html">Binomial
Coin-Flipping Example</a></span></dt>
<dt><span class="section"><a href="math_toolkit/stat_tut/weg/binom_eg/binomial_quiz_example.html">Binomial
Quiz Example</a></span></dt>
<dt><span class="section"><a href="math_toolkit/stat_tut/weg/binom_eg/binom_conf.html">Calculating
Confidence Limits on the Frequency of Occurrence for a Binomial Distribution</a></span></dt>
<dt><span class="section"><a href="math_toolkit/stat_tut/weg/binom_eg/binom_size_eg.html">Estimating
Sample Sizes for a Binomial Distribution.</a></span></dt>
</dl></dd>
<dt><span class="section"><a href="math_toolkit/stat_tut/weg/geometric_eg.html">Geometric Distribution
Examples</a></span></dt>
<dt><span class="section"><a href="math_toolkit/stat_tut/weg/neg_binom_eg.html">Negative Binomial
Distribution Examples</a></span></dt>
<dd><dl>
<dt><span class="section"><a href="math_toolkit/stat_tut/weg/neg_binom_eg/neg_binom_conf.html">Calculating
Confidence Limits on the Frequency of Occurrence for the Negative Binomial
Distribution</a></span></dt>
<dt><span class="section"><a href="math_toolkit/stat_tut/weg/neg_binom_eg/neg_binom_size_eg.html">Estimating
Sample Sizes for the Negative Binomial.</a></span></dt>
<dt><span class="section"><a href="math_toolkit/stat_tut/weg/neg_binom_eg/negative_binomial_example1.html">Negative
Binomial Sales Quota Example.</a></span></dt>
<dt><span class="section"><a href="math_toolkit/stat_tut/weg/neg_binom_eg/negative_binomial_example2.html">Negative
Binomial Table Printing Example.</a></span></dt>
</dl></dd>
<dt><span class="section"><a href="math_toolkit/stat_tut/weg/normal_example.html">Normal Distribution
Examples</a></span></dt>
<dd><dl><dt><span class="section"><a href="math_toolkit/stat_tut/weg/normal_example/normal_misc.html">Some
Miscellaneous Examples of the Normal (Gaussian) Distribution</a></span></dt></dl></dd>
<dt><span class="section"><a href="math_toolkit/stat_tut/weg/inverse_chi_squared_eg.html">Inverse
Chi-Squared Distribution Bayes Example</a></span></dt>
<dt><span class="section"><a href="math_toolkit/stat_tut/weg/nccs_eg.html">Non Central Chi
Squared Example</a></span></dt>
<dd><dl><dt><span class="section"><a href="math_toolkit/stat_tut/weg/nccs_eg/nccs_power_eg.html">Tables
of the power function of the chi<sup>2</sup> test.</a></span></dt></dl></dd>
<dt><span class="section"><a href="math_toolkit/stat_tut/weg/error_eg.html">Error Handling
Example</a></span></dt>
<dt><span class="section"><a href="math_toolkit/stat_tut/weg/find_eg.html">Find Location and
Scale Examples</a></span></dt>
<dd><dl>
<dt><span class="section"><a href="math_toolkit/stat_tut/weg/find_eg/find_location_eg.html">Find
Location (Mean) Example</a></span></dt>
<dt><span class="section"><a href="math_toolkit/stat_tut/weg/find_eg/find_scale_eg.html">Find
Scale (Standard Deviation) Example</a></span></dt>
<dt><span class="section"><a href="math_toolkit/stat_tut/weg/find_eg/find_mean_and_sd_eg.html">Find
mean and standard deviation example</a></span></dt>
</dl></dd>
<dt><span class="section"><a href="math_toolkit/stat_tut/weg/nag_library.html">Comparison with
C, R, FORTRAN-style Free Functions</a></span></dt>
<dt><span class="section"><a href="math_toolkit/stat_tut/weg/c_sharp.html">Using the Distributions
from Within C#</a></span></dt>
</dl></dd>
<dt><span class="section"><a href="math_toolkit/stat_tut/variates.html">Random Variates and Distribution
Parameters</a></span></dt>
<dt><span class="section"><a href="math_toolkit/stat_tut/dist_params.html">Discrete Probability
Distributions</a></span></dt>
</dl></dd>
<dt><span class="section"><a href="math_toolkit/dist_ref.html">Statistical Distributions Reference</a></span></dt>
<dd><dl>
<dt><span class="section"><a href="math_toolkit/dist_ref/nmp.html">Non-Member Properties</a></span></dt>
<dt><span class="section"><a href="math_toolkit/dist_ref/dists.html">Distributions</a></span></dt>
<dd><dl>
<dt><span class="section"><a href="math_toolkit/dist_ref/dists/arcine_dist.html">Arcsine Distribution</a></span></dt>
<dt><span class="section"><a href="math_toolkit/dist_ref/dists/bernoulli_dist.html">Bernoulli
Distribution</a></span></dt>
<dt><span class="section"><a href="math_toolkit/dist_ref/dists/beta_dist.html">Beta Distribution</a></span></dt>
<dt><span class="section"><a href="math_toolkit/dist_ref/dists/binomial_dist.html">Binomial
Distribution</a></span></dt>
<dt><span class="section"><a href="math_toolkit/dist_ref/dists/cauchy_dist.html">Cauchy-Lorentz
Distribution</a></span></dt>
<dt><span class="section"><a href="math_toolkit/dist_ref/dists/chi_squared_dist.html">Chi Squared
Distribution</a></span></dt>
<dt><span class="section"><a href="math_toolkit/dist_ref/dists/empirical_cdf.html">Empirical
Cumulative Distribution Function</a></span></dt>
<dt><span class="section"><a href="math_toolkit/dist_ref/dists/exp_dist.html">Exponential Distribution</a></span></dt>
<dt><span class="section"><a href="math_toolkit/dist_ref/dists/extreme_dist.html">Extreme Value
Distribution</a></span></dt>
<dt><span class="section"><a href="math_toolkit/dist_ref/dists/f_dist.html">F Distribution</a></span></dt>
<dt><span class="section"><a href="math_toolkit/dist_ref/dists/gamma_dist.html">Gamma (and
Erlang) Distribution</a></span></dt>
<dt><span class="section"><a href="math_toolkit/dist_ref/dists/geometric_dist.html">Geometric
Distribution</a></span></dt>
<dt><span class="section"><a href="math_toolkit/dist_ref/dists/hyperexponential_dist.html">Hyperexponential
Distribution</a></span></dt>
<dt><span class="section"><a href="math_toolkit/dist_ref/dists/hypergeometric_dist.html">Hypergeometric
Distribution</a></span></dt>
<dt><span class="section"><a href="math_toolkit/dist_ref/dists/inverse_chi_squared_dist.html">Inverse
Chi Squared Distribution</a></span></dt>
<dt><span class="section"><a href="math_toolkit/dist_ref/dists/inverse_gamma_dist.html">Inverse
Gamma Distribution</a></span></dt>
<dt><span class="section"><a href="math_toolkit/dist_ref/dists/inverse_gaussian_dist.html">Inverse
Gaussian (or Inverse Normal) Distribution</a></span></dt>
<dt><span class="section"><a href="math_toolkit/dist_ref/dists/kolmogorov_smirnov_dist.html">Kolmogorov-Smirnov
Distribution</a></span></dt>
<dt><span class="section"><a href="math_toolkit/dist_ref/dists/laplace_dist.html">Laplace Distribution</a></span></dt>
<dt><span class="section"><a href="math_toolkit/dist_ref/dists/logistic_dist.html">Logistic
Distribution</a></span></dt>
<dt><span class="section"><a href="math_toolkit/dist_ref/dists/lognormal_dist.html">Log Normal
Distribution</a></span></dt>
<dt><span class="section"><a href="math_toolkit/dist_ref/dists/negative_binomial_dist.html">Negative
Binomial Distribution</a></span></dt>
<dt><span class="section"><a href="math_toolkit/dist_ref/dists/nc_beta_dist.html">Noncentral
Beta Distribution</a></span></dt>
<dt><span class="section"><a href="math_toolkit/dist_ref/dists/nc_chi_squared_dist.html">Noncentral
Chi-Squared Distribution</a></span></dt>
<dt><span class="section"><a href="math_toolkit/dist_ref/dists/nc_f_dist.html">Noncentral F
Distribution</a></span></dt>
<dt><span class="section"><a href="math_toolkit/dist_ref/dists/nc_t_dist.html">Noncentral T
Distribution</a></span></dt>
<dt><span class="section"><a href="math_toolkit/dist_ref/dists/normal_dist.html">Normal (Gaussian)
Distribution</a></span></dt>
<dt><span class="section"><a href="math_toolkit/dist_ref/dists/pareto.html">Pareto Distribution</a></span></dt>
<dt><span class="section"><a href="math_toolkit/dist_ref/dists/poisson_dist.html">Poisson Distribution</a></span></dt>
<dt><span class="section"><a href="math_toolkit/dist_ref/dists/rayleigh.html">Rayleigh Distribution</a></span></dt>
<dt><span class="section"><a href="math_toolkit/dist_ref/dists/skew_normal_dist.html">Skew
Normal Distribution</a></span></dt>
<dt><span class="section"><a href="math_toolkit/dist_ref/dists/students_t_dist.html">Students
t Distribution</a></span></dt>
<dt><span class="section"><a href="math_toolkit/dist_ref/dists/triangular_dist.html">Triangular
Distribution</a></span></dt>
<dt><span class="section"><a href="math_toolkit/dist_ref/dists/uniform_dist.html">Uniform Distribution</a></span></dt>
<dt><span class="section"><a href="math_toolkit/dist_ref/dists/weibull_dist.html">Weibull Distribution</a></span></dt>
</dl></dd>
<dt><span class="section"><a href="math_toolkit/dist_ref/dist_algorithms.html">Distribution Algorithms</a></span></dt>
</dl></dd>
<dt><span class="section"><a href="math_toolkit/future.html">Extras/Future Directions</a></span></dt>
</dl>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2006-2019 Nikhar
Agrawal, Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos,
Hubert Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Matthew Pulver, Johan
R&#229;de, Gautam Sewani, Benjamin Sobotta, Nicholas Thompson, Thijs van den Berg,
Daryle Walker and Xiaogang Zhang<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="math_toolkit/constants_faq.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="index.html"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="math_toolkit/stat_tut.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>