math/doc/html/math_toolkit/anderson_darling.html
2019-10-31 17:55:35 +00:00

211 lines
38 KiB
HTML

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>The Anderson-Darling Test</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.11.0">
<link rel="up" href="../statistics.html" title="Chapter&#160;6.&#160;Statistics">
<link rel="prev" href="signal_statistics.html" title="Signal Statistics">
<link rel="next" href="t_test.html" title="t-tests">
</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="signal_statistics.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../statistics.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="t_test.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="math_toolkit.anderson_darling"></a><a class="link" href="anderson_darling.html" title="The Anderson-Darling Test">The Anderson-Darling Test</a>
</h2></div></div></div>
<h4>
<a name="math_toolkit.anderson_darling.h0"></a>
<span class="phrase"><a name="math_toolkit.anderson_darling.synopsis"></a></span><a class="link" href="anderson_darling.html#math_toolkit.anderson_darling.synopsis">Synopsis</a>
</h4>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">math</span><span class="special">/</span><span class="identifier">statistics</span><span class="special">/</span><span class="identifier">anderson_darling</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">{</span> <span class="keyword">namespace</span> <span class="identifier">math</span> <span class="special">{</span> <span class="keyword">namespace</span> <span class="special">{</span> <span class="identifier">statistics</span> <span class="special">{</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">RandomAccessContainer</span><span class="special">&gt;</span>
<span class="keyword">auto</span> <span class="identifier">anderson_darling_normality_statistic</span><span class="special">(</span><span class="identifier">RandomAccessContainer</span> <span class="keyword">const</span> <span class="special">&amp;</span> <span class="identifier">v</span><span class="special">,</span>
<span class="keyword">typename</span> <span class="identifier">RandomAccessContainer</span><span class="special">::</span><span class="identifier">value_type</span> <span class="identifier">mu</span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">RandomAccessContainer</span><span class="special">::</span><span class="identifier">value_type</span><span class="special">&gt;::</span><span class="identifier">quiet_NaN</span><span class="special">(),</span>
<span class="keyword">typename</span> <span class="identifier">RandomAccessContainer</span><span class="special">::</span><span class="identifier">value_type</span> <span class="identifier">sd</span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">RandomAccessContainer</span><span class="special">::</span><span class="identifier">value_type</span><span class="special">&gt;::</span><span class="identifier">quiet_NaN</span><span class="special">());</span>
<span class="special">}}}</span>
</pre>
<h4>
<a name="math_toolkit.anderson_darling.h1"></a>
<span class="phrase"><a name="math_toolkit.anderson_darling.background"></a></span><a class="link" href="anderson_darling.html#math_toolkit.anderson_darling.background">Background</a>
</h4>
<p>
The Anderson-Darling test for normality asks if a given sequence of numbers
are drawn from a normal distribution by computing an integral over the empirical
cumulative distribution function. The test statistic <span class="emphasis"><em>A</em></span><sup>2</sup> is
given by
</p>
<p>
<span class="inlinemediaobject"><object type="image/svg+xml" data="../../graphs/anderson_darling_definition.svg" width="346" height="56"></object></span>
</p>
<p>
where <span class="emphasis"><em>F</em></span><sub><span class="emphasis"><em>n</em></span></sub> is the empirical cumulative
distribution and <span class="emphasis"><em>F</em></span> is the CDF of the normal distribution.
</p>
<p>
The value returned by the routine is <span class="emphasis"><em>A</em></span><sup>2</sup>.
</p>
<p>
If <span class="emphasis"><em>A</em></span><sup>2</sup>/n converges to zero as <span class="emphasis"><em>n</em></span> goes
to infinity, then the hypothesis that the data is normally distributed is supported
by the test.
</p>
<p>
If <span class="emphasis"><em>A</em></span><sup>2</sup>/n converges to a finite positive value as <span class="emphasis"><em>n</em></span>
goes to infinity, then the hypothesis is not supported by the test.
</p>
<p>
An example usage is demonstrated below:
</p>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">vector</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">random</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">iostream</span><span class="special">&gt;</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">math</span><span class="special">/</span><span class="identifier">statistics</span><span class="special">/</span><span class="identifier">anderson_darling</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
<span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">statistics</span><span class="special">::</span><span class="identifier">anderson_darling_normality_statistic</span><span class="special">;</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">random_device</span> <span class="identifier">rd</span><span class="special">;</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">normal_distribution</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">&gt;</span> <span class="identifier">dis</span><span class="special">(</span><span class="number">0</span><span class="special">,</span> <span class="number">1</span><span class="special">);</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">&gt;</span> <span class="identifier">v</span><span class="special">(</span><span class="number">8192</span><span class="special">);</span>
<span class="keyword">for</span> <span class="special">(</span><span class="keyword">auto</span> <span class="special">&amp;</span> <span class="identifier">x</span> <span class="special">:</span> <span class="identifier">v</span><span class="special">)</span> <span class="special">{</span> <span class="identifier">x</span> <span class="special">=</span> <span class="identifier">dis</span><span class="special">(</span><span class="identifier">rd</span><span class="special">);</span> <span class="special">}</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">sort</span><span class="special">(</span><span class="identifier">v</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">end</span><span class="special">());</span>
<span class="keyword">double</span> <span class="identifier">presumed_mean</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span>
<span class="keyword">double</span> <span class="identifier">presumed_standard_deviation</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span>
<span class="keyword">double</span> <span class="identifier">Asq</span> <span class="special">=</span> <span class="identifier">anderson_darling_normality_statistic</span><span class="special">(</span><span class="identifier">v</span><span class="special">,</span> <span class="identifier">presumed_mean</span><span class="special">,</span> <span class="identifier">presumed_standard_deviation</span><span class="special">);</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"A^2/n = "</span> <span class="special">&lt;&lt;</span> <span class="identifier">Asq</span><span class="special">/</span><span class="identifier">v</span><span class="special">.</span><span class="identifier">size</span><span class="special">()</span> <span class="special">&lt;&lt;</span> <span class="string">"\n"</span><span class="special">;</span>
<span class="number">5.39e-05</span> <span class="comment">// should be small . . .</span>
<span class="comment">// Now use an incorrect hypothesis:</span>
<span class="identifier">presumed_mean</span> <span class="special">=</span> <span class="number">4</span><span class="special">;</span>
<span class="identifier">Asq</span> <span class="special">=</span> <span class="identifier">anderson_darling_normality_statistic</span><span class="special">(</span><span class="identifier">v</span><span class="special">,</span> <span class="identifier">presumed_mean</span><span class="special">,</span> <span class="identifier">presumed_standard_deviation</span><span class="special">);</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"A^2/n = "</span> <span class="special">&lt;&lt;</span> <span class="identifier">Asq</span><span class="special">/</span><span class="identifier">v</span><span class="special">.</span><span class="identifier">size</span><span class="special">()</span> <span class="special">&lt;&lt;</span> <span class="string">"\n"</span><span class="special">;</span>
<span class="number">7.41</span> <span class="comment">// should be somewhat large . . .</span>
</pre>
<p>
The Anderson-Darling normality requires sorted data. If the data are not sorted
an exception is thrown.
</p>
<p>
If you simply wish to know whether or not data is normally distributed, and
not whether it is normally distributed with a presumed mean and variance, then
you can call the function without the final two arguments, and the mean and
variance will be estimated from the data themselves:
</p>
<pre class="programlisting"><span class="keyword">double</span> <span class="identifier">Asq</span> <span class="special">=</span> <span class="identifier">anderson_darling_normality_statistic</span><span class="special">(</span><span class="identifier">v</span><span class="special">);</span>
</pre>
<p>
The following graph demonstrates the convergence of the test statistic. Each
data point represents a vector of length <span class="emphasis"><em>n</em></span> which is filled
with normally distributed data. The test statistic is computed over this vector,
divided by <span class="emphasis"><em>n</em></span>, and passed to the natural logarithm. This
exhibits the (admittedly slow) convergence of the integral to zero when the
hypothesis is true.
</p>
<p>
<span class="inlinemediaobject"><object type="image/svg+xml" data="../../graphs/anderson_darling_simulation.svg"></object></span>
</p>
<h4>
<a name="math_toolkit.anderson_darling.h2"></a>
<span class="phrase"><a name="math_toolkit.anderson_darling.performance"></a></span><a class="link" href="anderson_darling.html#math_toolkit.anderson_darling.performance">Performance</a>
</h4>
<pre class="programlisting"><span class="special">---------------------------------------------------------------</span>
<span class="identifier">Benchmark</span> <span class="identifier">Time</span>
<span class="special">---------------------------------------------------------------</span>
<span class="identifier">AndersonDarlingNormalityTest</span><span class="special">&lt;</span><span class="keyword">float</span><span class="special">&gt;/</span><span class="number">8</span> <span class="number">224</span> <span class="identifier">ns</span> <span class="identifier">bytes_per_second</span><span class="special">=</span><span class="number">136.509</span><span class="identifier">M</span><span class="special">/</span><span class="identifier">s</span>
<span class="identifier">AndersonDarlingNormalityTest</span><span class="special">&lt;</span><span class="keyword">float</span><span class="special">&gt;/</span><span class="number">16</span> <span class="number">435</span> <span class="identifier">ns</span> <span class="identifier">bytes_per_second</span><span class="special">=</span><span class="number">140.254</span><span class="identifier">M</span><span class="special">/</span><span class="identifier">s</span>
<span class="identifier">AndersonDarlingNormalityTest</span><span class="special">&lt;</span><span class="keyword">float</span><span class="special">&gt;/</span><span class="number">32</span> <span class="number">898</span> <span class="identifier">ns</span> <span class="identifier">bytes_per_second</span><span class="special">=</span><span class="number">135.995</span><span class="identifier">M</span><span class="special">/</span><span class="identifier">s</span>
<span class="identifier">AndersonDarlingNormalityTest</span><span class="special">&lt;</span><span class="keyword">float</span><span class="special">&gt;/</span><span class="number">64</span> <span class="number">1773</span> <span class="identifier">ns</span> <span class="identifier">bytes_per_second</span><span class="special">=</span><span class="number">137.675</span><span class="identifier">M</span><span class="special">/</span><span class="identifier">s</span>
<span class="identifier">AndersonDarlingNormalityTest</span><span class="special">&lt;</span><span class="keyword">float</span><span class="special">&gt;/</span><span class="number">128</span> <span class="number">3455</span> <span class="identifier">ns</span> <span class="identifier">bytes_per_second</span><span class="special">=</span><span class="number">141.338</span><span class="identifier">M</span><span class="special">/</span><span class="identifier">s</span>
<span class="identifier">AndersonDarlingNormalityTest</span><span class="special">&lt;</span><span class="keyword">float</span><span class="special">&gt;/</span><span class="number">256</span> <span class="number">7001</span> <span class="identifier">ns</span> <span class="identifier">bytes_per_second</span><span class="special">=</span><span class="number">139.488</span><span class="identifier">M</span><span class="special">/</span><span class="identifier">s</span>
<span class="identifier">AndersonDarlingNormalityTest</span><span class="special">&lt;</span><span class="keyword">float</span><span class="special">&gt;/</span><span class="number">512</span> <span class="number">13996</span> <span class="identifier">ns</span> <span class="identifier">bytes_per_second</span><span class="special">=</span><span class="number">139.551</span><span class="identifier">M</span><span class="special">/</span><span class="identifier">s</span>
<span class="identifier">AndersonDarlingNormalityTest</span><span class="special">&lt;</span><span class="keyword">float</span><span class="special">&gt;/</span><span class="number">1024</span> <span class="number">28129</span> <span class="identifier">ns</span> <span class="identifier">bytes_per_second</span><span class="special">=</span><span class="number">138.868</span><span class="identifier">M</span><span class="special">/</span><span class="identifier">s</span>
<span class="identifier">AndersonDarlingNormalityTest</span><span class="special">&lt;</span><span class="keyword">float</span><span class="special">&gt;/</span><span class="number">2048</span> <span class="number">55723</span> <span class="identifier">ns</span> <span class="identifier">bytes_per_second</span><span class="special">=</span><span class="number">140.206</span><span class="identifier">M</span><span class="special">/</span><span class="identifier">s</span>
<span class="identifier">AndersonDarlingNormalityTest</span><span class="special">&lt;</span><span class="keyword">float</span><span class="special">&gt;/</span><span class="number">4096</span> <span class="number">112008</span> <span class="identifier">ns</span> <span class="identifier">bytes_per_second</span><span class="special">=</span><span class="number">139.501</span><span class="identifier">M</span><span class="special">/</span><span class="identifier">s</span>
<span class="identifier">AndersonDarlingNormalityTest</span><span class="special">&lt;</span><span class="keyword">float</span><span class="special">&gt;/</span><span class="number">8192</span> <span class="number">224643</span> <span class="identifier">ns</span> <span class="identifier">bytes_per_second</span><span class="special">=</span><span class="number">139.11</span><span class="identifier">M</span><span class="special">/</span><span class="identifier">s</span>
<span class="identifier">AndersonDarlingNormalityTest</span><span class="special">&lt;</span><span class="keyword">float</span><span class="special">&gt;/</span><span class="number">16384</span> <span class="number">450320</span> <span class="identifier">ns</span> <span class="identifier">bytes_per_second</span><span class="special">=</span><span class="number">138.791</span><span class="identifier">M</span><span class="special">/</span><span class="identifier">s</span>
<span class="identifier">AndersonDarlingNormalityTest</span><span class="special">&lt;</span><span class="keyword">float</span><span class="special">&gt;/</span><span class="number">32768</span> <span class="number">896409</span> <span class="identifier">ns</span> <span class="identifier">bytes_per_second</span><span class="special">=</span><span class="number">139.45</span><span class="identifier">M</span><span class="special">/</span><span class="identifier">s</span>
<span class="identifier">AndersonDarlingNormalityTest</span><span class="special">&lt;</span><span class="keyword">float</span><span class="special">&gt;/</span><span class="number">65536</span> <span class="number">1797800</span> <span class="identifier">ns</span> <span class="identifier">bytes_per_second</span><span class="special">=</span><span class="number">139.058</span><span class="identifier">M</span><span class="special">/</span><span class="identifier">s</span>
<span class="identifier">AndersonDarlingNormalityTest</span><span class="special">&lt;</span><span class="keyword">float</span><span class="special">&gt;/</span><span class="number">131072</span> <span class="number">3604995</span> <span class="identifier">ns</span> <span class="identifier">bytes_per_second</span><span class="special">=</span><span class="number">138.698</span><span class="identifier">M</span><span class="special">/</span><span class="identifier">s</span>
<span class="identifier">AndersonDarlingNormalityTest</span><span class="special">&lt;</span><span class="keyword">float</span><span class="special">&gt;/</span><span class="number">262144</span> <span class="number">7235625</span> <span class="identifier">ns</span> <span class="identifier">bytes_per_second</span><span class="special">=</span><span class="number">138.207</span><span class="identifier">M</span><span class="special">/</span><span class="identifier">s</span>
<span class="identifier">AndersonDarlingNormalityTest</span><span class="special">&lt;</span><span class="keyword">float</span><span class="special">&gt;/</span><span class="number">524288</span> <span class="number">14502815</span> <span class="identifier">ns</span> <span class="identifier">bytes_per_second</span><span class="special">=</span><span class="number">137.904</span><span class="identifier">M</span><span class="special">/</span><span class="identifier">s</span>
<span class="identifier">AndersonDarlingNormalityTest</span><span class="special">&lt;</span><span class="keyword">float</span><span class="special">&gt;/</span><span class="number">1048576</span> <span class="number">29058087</span> <span class="identifier">ns</span> <span class="identifier">bytes_per_second</span><span class="special">=</span><span class="number">137.659</span><span class="identifier">M</span><span class="special">/</span><span class="identifier">s</span>
<span class="identifier">AndersonDarlingNormalityTest</span><span class="special">&lt;</span><span class="keyword">float</span><span class="special">&gt;/</span><span class="number">2097152</span> <span class="number">58470439</span> <span class="identifier">ns</span> <span class="identifier">bytes_per_second</span><span class="special">=</span><span class="number">136.824</span><span class="identifier">M</span><span class="special">/</span><span class="identifier">s</span>
<span class="identifier">AndersonDarlingNormalityTest</span><span class="special">&lt;</span><span class="keyword">float</span><span class="special">&gt;/</span><span class="number">4194304</span> <span class="number">117476365</span> <span class="identifier">ns</span> <span class="identifier">bytes_per_second</span><span class="special">=</span><span class="number">136.201</span><span class="identifier">M</span><span class="special">/</span><span class="identifier">s</span>
<span class="identifier">AndersonDarlingNormalityTest</span><span class="special">&lt;</span><span class="keyword">float</span><span class="special">&gt;/</span><span class="number">8388608</span> <span class="number">239887895</span> <span class="identifier">ns</span> <span class="identifier">bytes_per_second</span><span class="special">=</span><span class="number">133.397</span><span class="identifier">M</span><span class="special">/</span><span class="identifier">s</span>
<span class="identifier">AndersonDarlingNormalityTest</span><span class="special">&lt;</span><span class="keyword">float</span><span class="special">&gt;/</span><span class="number">16777216</span> <span class="number">488787211</span> <span class="identifier">ns</span> <span class="identifier">bytes_per_second</span><span class="special">=</span><span class="number">130.94</span><span class="identifier">M</span><span class="special">/</span><span class="identifier">s</span>
<span class="identifier">AndersonDarlingNormalityTest</span><span class="special">&lt;</span><span class="keyword">float</span><span class="special">&gt;</span><span class="identifier">_BigO</span> <span class="number">28.96</span> <span class="identifier">N</span> <span class="number">28.96</span> <span class="identifier">N</span>
<span class="identifier">AndersonDarlingNormalityTest</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">&gt;/</span><span class="number">8</span> <span class="number">470</span> <span class="identifier">ns</span> <span class="identifier">bytes_per_second</span><span class="special">=</span><span class="number">129.733</span><span class="identifier">M</span><span class="special">/</span><span class="identifier">s</span>
<span class="identifier">AndersonDarlingNormalityTest</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">&gt;/</span><span class="number">16</span> <span class="number">911</span> <span class="identifier">ns</span> <span class="identifier">bytes_per_second</span><span class="special">=</span><span class="number">133.989</span><span class="identifier">M</span><span class="special">/</span><span class="identifier">s</span>
<span class="identifier">AndersonDarlingNormalityTest</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">&gt;/</span><span class="number">32</span> <span class="number">1773</span> <span class="identifier">ns</span> <span class="identifier">bytes_per_second</span><span class="special">=</span><span class="number">137.723</span><span class="identifier">M</span><span class="special">/</span><span class="identifier">s</span>
<span class="identifier">AndersonDarlingNormalityTest</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">&gt;/</span><span class="number">64</span> <span class="number">3368</span> <span class="identifier">ns</span> <span class="identifier">bytes_per_second</span><span class="special">=</span><span class="number">144.966</span><span class="identifier">M</span><span class="special">/</span><span class="identifier">s</span>
<span class="identifier">AndersonDarlingNormalityTest</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">&gt;/</span><span class="number">128</span> <span class="number">6627</span> <span class="identifier">ns</span> <span class="identifier">bytes_per_second</span><span class="special">=</span><span class="number">147.357</span><span class="identifier">M</span><span class="special">/</span><span class="identifier">s</span>
<span class="identifier">AndersonDarlingNormalityTest</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">&gt;/</span><span class="number">256</span> <span class="number">12458</span> <span class="identifier">ns</span> <span class="identifier">bytes_per_second</span><span class="special">=</span><span class="number">156.777</span><span class="identifier">M</span><span class="special">/</span><span class="identifier">s</span>
<span class="identifier">AndersonDarlingNormalityTest</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">&gt;/</span><span class="number">512</span> <span class="number">23060</span> <span class="identifier">ns</span> <span class="identifier">bytes_per_second</span><span class="special">=</span><span class="number">169.395</span><span class="identifier">M</span><span class="special">/</span><span class="identifier">s</span>
<span class="identifier">AndersonDarlingNormalityTest</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">&gt;/</span><span class="number">1024</span> <span class="number">44529</span> <span class="identifier">ns</span> <span class="identifier">bytes_per_second</span><span class="special">=</span><span class="number">175.45</span><span class="identifier">M</span><span class="special">/</span><span class="identifier">s</span>
<span class="identifier">AndersonDarlingNormalityTest</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">&gt;/</span><span class="number">2048</span> <span class="number">88735</span> <span class="identifier">ns</span> <span class="identifier">bytes_per_second</span><span class="special">=</span><span class="number">176.087</span><span class="identifier">M</span><span class="special">/</span><span class="identifier">s</span>
<span class="identifier">AndersonDarlingNormalityTest</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">&gt;/</span><span class="number">4096</span> <span class="number">175583</span> <span class="identifier">ns</span> <span class="identifier">bytes_per_second</span><span class="special">=</span><span class="number">177.978</span><span class="identifier">M</span><span class="special">/</span><span class="identifier">s</span>
<span class="identifier">AndersonDarlingNormalityTest</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">&gt;/</span><span class="number">8192</span> <span class="number">348042</span> <span class="identifier">ns</span> <span class="identifier">bytes_per_second</span><span class="special">=</span><span class="number">179.577</span><span class="identifier">M</span><span class="special">/</span><span class="identifier">s</span>
<span class="identifier">AndersonDarlingNormalityTest</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">&gt;/</span><span class="number">16384</span> <span class="number">701439</span> <span class="identifier">ns</span> <span class="identifier">bytes_per_second</span><span class="special">=</span><span class="number">178.206</span><span class="identifier">M</span><span class="special">/</span><span class="identifier">s</span>
<span class="identifier">AndersonDarlingNormalityTest</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">&gt;/</span><span class="number">32768</span> <span class="number">1394597</span> <span class="identifier">ns</span> <span class="identifier">bytes_per_second</span><span class="special">=</span><span class="number">179.262</span><span class="identifier">M</span><span class="special">/</span><span class="identifier">s</span>
<span class="identifier">AndersonDarlingNormalityTest</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">&gt;/</span><span class="number">65536</span> <span class="number">2777943</span> <span class="identifier">ns</span> <span class="identifier">bytes_per_second</span><span class="special">=</span><span class="number">179.994</span><span class="identifier">M</span><span class="special">/</span><span class="identifier">s</span>
<span class="identifier">AndersonDarlingNormalityTest</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">&gt;/</span><span class="number">131072</span> <span class="number">5571455</span> <span class="identifier">ns</span> <span class="identifier">bytes_per_second</span><span class="special">=</span><span class="number">179.487</span><span class="identifier">M</span><span class="special">/</span><span class="identifier">s</span>
<span class="identifier">AndersonDarlingNormalityTest</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">&gt;/</span><span class="number">262144</span> <span class="number">11161456</span> <span class="identifier">ns</span> <span class="identifier">bytes_per_second</span><span class="special">=</span><span class="number">179.193</span><span class="identifier">M</span><span class="special">/</span><span class="identifier">s</span>
<span class="identifier">AndersonDarlingNormalityTest</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">&gt;/</span><span class="number">524288</span> <span class="number">22048950</span> <span class="identifier">ns</span> <span class="identifier">bytes_per_second</span><span class="special">=</span><span class="number">181.417</span><span class="identifier">M</span><span class="special">/</span><span class="identifier">s</span>
<span class="identifier">AndersonDarlingNormalityTest</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">&gt;/</span><span class="number">1048576</span> <span class="number">44094409</span> <span class="identifier">ns</span> <span class="identifier">bytes_per_second</span><span class="special">=</span><span class="number">181.429</span><span class="identifier">M</span><span class="special">/</span><span class="identifier">s</span>
<span class="identifier">AndersonDarlingNormalityTest</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">&gt;/</span><span class="number">2097152</span> <span class="number">88300185</span> <span class="identifier">ns</span> <span class="identifier">bytes_per_second</span><span class="special">=</span><span class="number">181.199</span><span class="identifier">M</span><span class="special">/</span><span class="identifier">s</span>
<span class="identifier">AndersonDarlingNormalityTest</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">&gt;/</span><span class="number">4194304</span> <span class="number">176140378</span> <span class="identifier">ns</span> <span class="identifier">bytes_per_second</span><span class="special">=</span><span class="number">181.678</span><span class="identifier">M</span><span class="special">/</span><span class="identifier">s</span>
<span class="identifier">AndersonDarlingNormalityTest</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">&gt;/</span><span class="number">8388608</span> <span class="number">352102955</span> <span class="identifier">ns</span> <span class="identifier">bytes_per_second</span><span class="special">=</span><span class="number">181.769</span><span class="identifier">M</span><span class="special">/</span><span class="identifier">s</span>
<span class="identifier">AndersonDarlingNormalityTest</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">&gt;/</span><span class="number">16777216</span> <span class="number">706160246</span> <span class="identifier">ns</span> <span class="identifier">bytes_per_second</span><span class="special">=</span><span class="number">181.267</span><span class="identifier">M</span><span class="special">/</span><span class="identifier">s</span>
<span class="identifier">AndersonDarlingNormalityTest</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">&gt;</span><span class="identifier">_BigO</span> <span class="number">42.06</span> <span class="identifier">N</span>
</pre>
<h4>
<a name="math_toolkit.anderson_darling.h3"></a>
<span class="phrase"><a name="math_toolkit.anderson_darling.caveats"></a></span><a class="link" href="anderson_darling.html#math_toolkit.anderson_darling.caveats">Caveats</a>
</h4>
<p>
Some authors, including <a href="https://www.itl.nist.gov/div898/handbook/eda/section3/eda35e.htm" target="_top">NIST</a>,
give the following definition of the Anderson-Darling test statistic:
</p>
<p>
<span class="inlinemediaobject"><object type="image/svg+xml" data="../../graphs/alternative_anderson_darling_definition.svg" width="461" height="54"></object></span>
</p>
<p>
This is an approximation to the quadrature sum we use as our definition. Boost.Math
<span class="emphasis"><em>does not compute this quantity</em></span>. (However, with a sufficiently
large amount of data the two definitions seem to agree to two digits, so the
importance of making a clear distinction between the two is unclear.) Our computation
of the Anderson-Darling test statistic agrees with Mathematica.
</p>
</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="signal_statistics.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../statistics.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="t_test.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>