• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title>The Anderson-Darling Test</title>
5<link rel="stylesheet" href="../math.css" type="text/css">
6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7<link rel="home" href="../index.html" title="Math Toolkit 2.12.0">
8<link rel="up" href="../statistics.html" title="Chapter 6. Statistics">
9<link rel="prev" href="signal_statistics.html" title="Signal Statistics">
10<link rel="next" href="t_test.html" title="t-tests">
11</head>
12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13<table cellpadding="2" width="100%"><tr>
14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
15<td align="center"><a href="../../../../../index.html">Home</a></td>
16<td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td>
17<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
18<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
19<td align="center"><a href="../../../../../more/index.htm">More</a></td>
20</tr></table>
21<hr>
22<div class="spirit-nav">
23<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>
24</div>
25<div class="section">
26<div class="titlepage"><div><div><h2 class="title" style="clear: both">
27<a name="math_toolkit.anderson_darling"></a><a class="link" href="anderson_darling.html" title="The Anderson-Darling Test">The Anderson-Darling Test</a>
28</h2></div></div></div>
29<h4>
30<a name="math_toolkit.anderson_darling.h0"></a>
31      <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>
32    </h4>
33<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>
34
35<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>
36
37<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>
38<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>
39                                          <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>
40                                          <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>
41
42<span class="special">}}}</span>
43</pre>
44<h4>
45<a name="math_toolkit.anderson_darling.h1"></a>
46      <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>
47    </h4>
48<p>
49      The Anderson-Darling test for normality asks if a given sequence of numbers
50      are drawn from a normal distribution by computing an integral over the empirical
51      cumulative distribution function. The test statistic <span class="emphasis"><em>A</em></span><sup>2</sup> is
52      given by
53    </p>
54<p>
55      <span class="inlinemediaobject"><object type="image/svg+xml" data="../../graphs/anderson_darling_definition.svg" width="346" height="56"></object></span>
56    </p>
57<p>
58      where <span class="emphasis"><em>F</em></span><sub><span class="emphasis"><em>n</em></span></sub> is the empirical cumulative
59      distribution and <span class="emphasis"><em>F</em></span> is the CDF of the normal distribution.
60    </p>
61<p>
62      The value returned by the routine is <span class="emphasis"><em>A</em></span><sup>2</sup>.
63    </p>
64<p>
65      If <span class="emphasis"><em>A</em></span><sup>2</sup>/n converges to zero as <span class="emphasis"><em>n</em></span> goes
66      to infinity, then the hypothesis that the data is normally distributed is supported
67      by the test.
68    </p>
69<p>
70      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>
71      goes to infinity, then the hypothesis is not supported by the test.
72    </p>
73<p>
74      An example usage is demonstrated below:
75    </p>
76<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">vector</span><span class="special">&gt;</span>
77<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">random</span><span class="special">&gt;</span>
78<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">iostream</span><span class="special">&gt;</span>
79<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>
80<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>
81<span class="identifier">std</span><span class="special">::</span><span class="identifier">random_device</span> <span class="identifier">rd</span><span class="special">;</span>
82<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>
83<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>
84<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>
85<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>
86<span class="keyword">double</span> <span class="identifier">presumed_mean</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span>
87<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>
88<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>
89<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>
90<span class="number">5.39e-05</span> <span class="comment">// should be small . . .</span>
91<span class="comment">// Now use an incorrect hypothesis:</span>
92<span class="identifier">presumed_mean</span> <span class="special">=</span> <span class="number">4</span><span class="special">;</span>
93<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>
94<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>
95<span class="number">7.41</span> <span class="comment">// should be somewhat large . . .</span>
96</pre>
97<p>
98      The Anderson-Darling normality requires sorted data. If the data are not sorted
99      an exception is thrown.
100    </p>
101<p>
102      If you simply wish to know whether or not data is normally distributed, and
103      not whether it is normally distributed with a presumed mean and variance, then
104      you can call the function without the final two arguments, and the mean and
105      variance will be estimated from the data themselves:
106    </p>
107<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>
108</pre>
109<p>
110      The following graph demonstrates the convergence of the test statistic. Each
111      data point represents a vector of length <span class="emphasis"><em>n</em></span> which is filled
112      with normally distributed data. The test statistic is computed over this vector,
113      divided by <span class="emphasis"><em>n</em></span>, and passed to the natural logarithm. This
114      exhibits the (admittedly slow) convergence of the integral to zero when the
115      hypothesis is true.
116    </p>
117<p>
118      <span class="inlinemediaobject"><object type="image/svg+xml" data="../../graphs/anderson_darling_simulation.svg"></object></span>
119    </p>
120<h4>
121<a name="math_toolkit.anderson_darling.h2"></a>
122      <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>
123    </h4>
124<pre class="programlisting"><span class="special">---------------------------------------------------------------</span>
125<span class="identifier">Benchmark</span>                                              <span class="identifier">Time</span>
126<span class="special">---------------------------------------------------------------</span>
127<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>
128<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>
129<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>
130<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>
131<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>
132<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>
133<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>
134<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>
135<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>
136<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>
137<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>
138<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>
139<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>
140<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>
141<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>
142<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>
143<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>
144<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>
145<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>
146<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>
147<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>
148<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>
149<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>
150<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>
151<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>
152<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>
153<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>
154<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>
155<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>
156<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>
157<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>
158<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>
159<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>
160<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>
161<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>
162<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>
163<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>
164<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>
165<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>
166<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>
167<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>
168<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>
169<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>
170<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>
171<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>
172<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>
173</pre>
174<h4>
175<a name="math_toolkit.anderson_darling.h3"></a>
176      <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>
177    </h4>
178<p>
179      Some authors, including <a href="https://www.itl.nist.gov/div898/handbook/eda/section3/eda35e.htm" target="_top">NIST</a>,
180      give the following definition of the Anderson-Darling test statistic:
181    </p>
182<p>
183      <span class="inlinemediaobject"><object type="image/svg+xml" data="../../graphs/alternative_anderson_darling_definition.svg" width="461" height="54"></object></span>
184    </p>
185<p>
186      This is an approximation to the quadrature sum we use as our definition. Boost.Math
187      <span class="emphasis"><em>does not compute this quantity</em></span>. (However, with a sufficiently
188      large amount of data the two definitions seem to agree to two digits, so the
189      importance of making a clear distinction between the two is unclear.) Our computation
190      of the Anderson-Darling test statistic agrees with Mathematica.
191    </p>
192</div>
193<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
194<td align="left"></td>
195<td align="right"><div class="copyright-footer">Copyright © 2006-2019 Nikhar
196      Agrawal, Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos,
197      Hubert Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Matthew Pulver, Johan
198      Råde, Gautam Sewani, Benjamin Sobotta, Nicholas Thompson, Thijs van den Berg,
199      Daryle Walker and Xiaogang Zhang<p>
200        Distributed under the Boost Software License, Version 1.0. (See accompanying
201        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>)
202      </p>
203</div></td>
204</tr></table>
205<hr>
206<div class="spirit-nav">
207<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>
208</div>
209</body>
210</html>
211