]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | <html> |
2 | <head> | |
3 | <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> | |
4 | <title>Noncentral T Distribution</title> | |
5 | <link rel="stylesheet" href="../../../math.css" type="text/css"> | |
6 | <meta name="generator" content="DocBook XSL Stylesheets V1.77.1"> | |
7 | <link rel="home" href="../../../index.html" title="Math Toolkit 2.5.1"> | |
8 | <link rel="up" href="../dists.html" title="Distributions"> | |
9 | <link rel="prev" href="nc_f_dist.html" title="Noncentral F Distribution"> | |
10 | <link rel="next" href="normal_dist.html" title="Normal (Gaussian) Distribution"> | |
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="nc_f_dist.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../dists.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="normal_dist.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a> | |
24 | </div> | |
25 | <div class="section"> | |
26 | <div class="titlepage"><div><div><h4 class="title"> | |
27 | <a name="math_toolkit.dist_ref.dists.nc_t_dist"></a><a class="link" href="nc_t_dist.html" title="Noncentral T Distribution">Noncentral T | |
28 | Distribution</a> | |
29 | </h4></div></div></div> | |
30 | <pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">math</span><span class="special">/</span><span class="identifier">distributions</span><span class="special">/</span><span class="identifier">non_central_t</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></pre> | |
31 | <pre class="programlisting"><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> | |
32 | ||
33 | <span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">RealType</span> <span class="special">=</span> <span class="keyword">double</span><span class="special">,</span> | |
34 | <span class="keyword">class</span> <a class="link" href="../../../policy.html" title="Chapter 15. Policies: Controlling Precision, Error Handling etc">Policy</a> <span class="special">=</span> <a class="link" href="../../pol_ref/pol_ref_ref.html" title="Policy Class Reference">policies::policy<></a> <span class="special">></span> | |
35 | <span class="keyword">class</span> <span class="identifier">non_central_t_distribution</span><span class="special">;</span> | |
36 | ||
37 | <span class="keyword">typedef</span> <span class="identifier">non_central_t_distribution</span><span class="special"><></span> <span class="identifier">non_central_t</span><span class="special">;</span> | |
38 | ||
39 | <span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">RealType</span><span class="special">,</span> <span class="keyword">class</span> <a class="link" href="../../../policy.html" title="Chapter 15. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">></span> | |
40 | <span class="keyword">class</span> <span class="identifier">non_central_t_distribution</span> | |
41 | <span class="special">{</span> | |
42 | <span class="keyword">public</span><span class="special">:</span> | |
43 | <span class="keyword">typedef</span> <span class="identifier">RealType</span> <span class="identifier">value_type</span><span class="special">;</span> | |
44 | <span class="keyword">typedef</span> <span class="identifier">Policy</span> <span class="identifier">policy_type</span><span class="special">;</span> | |
45 | ||
46 | <span class="comment">// Constructor:</span> | |
47 | <span class="identifier">non_central_t_distribution</span><span class="special">(</span><span class="identifier">RealType</span> <span class="identifier">v</span><span class="special">,</span> <span class="identifier">RealType</span> <span class="identifier">delta</span><span class="special">);</span> | |
48 | ||
49 | <span class="comment">// Accessor to degrees_of_freedom parameter v:</span> | |
50 | <span class="identifier">RealType</span> <span class="identifier">degrees_of_freedom</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span> | |
51 | ||
52 | <span class="comment">// Accessor to non-centrality parameter delta:</span> | |
53 | <span class="identifier">RealType</span> <span class="identifier">non_centrality</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span> | |
54 | <span class="special">};</span> | |
55 | ||
56 | <span class="special">}}</span> <span class="comment">// namespaces</span> | |
57 | </pre> | |
58 | <p> | |
59 | The noncentral T distribution is a generalization of the <a class="link" href="students_t_dist.html" title="Students t Distribution">Students | |
60 | t Distribution</a>. Let X have a normal distribution with mean δ and variance | |
61 | 1, and let ν S<sup>2</sup> have a chi-squared distribution with degrees of freedom ν. | |
62 | Assume that X and S<sup>2</sup> are independent. The distribution of t<sub>ν</sub>(δ)=X/S is called | |
63 | a noncentral t distribution with degrees of freedom ν and noncentrality parameter | |
64 | δ. | |
65 | </p> | |
66 | <p> | |
67 | This gives the following PDF: | |
68 | </p> | |
69 | <p> | |
70 | <span class="inlinemediaobject"><img src="../../../../equations/nc_t_ref1.svg"></span> | |
71 | </p> | |
72 | <p> | |
73 | where <sub>1</sub>F<sub>1</sub>(a;b;x) is a confluent hypergeometric function. | |
74 | </p> | |
75 | <p> | |
76 | The following graph illustrates how the distribution changes for different | |
77 | values of ν and δ: | |
78 | </p> | |
79 | <p> | |
80 | <span class="inlinemediaobject"><img src="../../../../graphs/nc_t_pdf.svg" align="middle"></span> | |
81 | <span class="inlinemediaobject"><img src="../../../../graphs/nc_t_cdf.svg" align="middle"></span> | |
82 | </p> | |
83 | <h5> | |
84 | <a name="math_toolkit.dist_ref.dists.nc_t_dist.h0"></a> | |
85 | <span class="phrase"><a name="math_toolkit.dist_ref.dists.nc_t_dist.member_functions"></a></span><a class="link" href="nc_t_dist.html#math_toolkit.dist_ref.dists.nc_t_dist.member_functions">Member | |
86 | Functions</a> | |
87 | </h5> | |
88 | <pre class="programlisting"><span class="identifier">non_central_t_distribution</span><span class="special">(</span><span class="identifier">RealType</span> <span class="identifier">v</span><span class="special">,</span> <span class="identifier">RealType</span> <span class="identifier">delta</span><span class="special">);</span> | |
89 | </pre> | |
90 | <p> | |
91 | Constructs a non-central t distribution with degrees of freedom parameter | |
92 | <span class="emphasis"><em>v</em></span> and non-centrality parameter <span class="emphasis"><em>delta</em></span>. | |
93 | </p> | |
94 | <p> | |
95 | Requires <span class="emphasis"><em>v</em></span> > 0 (including positive infinity) and | |
96 | finite <span class="emphasis"><em>delta</em></span>, otherwise calls <a class="link" href="../../error_handling.html#math_toolkit.error_handling.domain_error">domain_error</a>. | |
97 | </p> | |
98 | <pre class="programlisting"><span class="identifier">RealType</span> <span class="identifier">degrees_of_freedom</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span> | |
99 | </pre> | |
100 | <p> | |
101 | Returns the parameter <span class="emphasis"><em>v</em></span> from which this object was | |
102 | constructed. | |
103 | </p> | |
104 | <pre class="programlisting"><span class="identifier">RealType</span> <span class="identifier">non_centrality</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span> | |
105 | </pre> | |
106 | <p> | |
107 | Returns the non-centrality parameter <span class="emphasis"><em>delta</em></span> from which | |
108 | this object was constructed. | |
109 | </p> | |
110 | <h5> | |
111 | <a name="math_toolkit.dist_ref.dists.nc_t_dist.h1"></a> | |
112 | <span class="phrase"><a name="math_toolkit.dist_ref.dists.nc_t_dist.non_member_accessors"></a></span><a class="link" href="nc_t_dist.html#math_toolkit.dist_ref.dists.nc_t_dist.non_member_accessors">Non-member | |
113 | Accessors</a> | |
114 | </h5> | |
115 | <p> | |
116 | All the <a class="link" href="../nmp.html" title="Non-Member Properties">usual non-member accessor | |
117 | functions</a> that are generic to all distributions are supported: | |
118 | <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.cdf">Cumulative Distribution Function</a>, | |
119 | <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.pdf">Probability Density Function</a>, | |
120 | <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.quantile">Quantile</a>, <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.hazard">Hazard Function</a>, <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.chf">Cumulative Hazard Function</a>, | |
121 | <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.mean">mean</a>, <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.median">median</a>, | |
122 | <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.mode">mode</a>, <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.variance">variance</a>, | |
123 | <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.sd">standard deviation</a>, | |
124 | <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.skewness">skewness</a>, <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.kurtosis">kurtosis</a>, <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.kurtosis_excess">kurtosis_excess</a>, | |
125 | <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.range">range</a> and <a class="link" href="../nmp.html#math_toolkit.dist_ref.nmp.support">support</a>. | |
126 | </p> | |
127 | <p> | |
128 | The domain of the random variable is [-∞, +∞]. | |
129 | </p> | |
130 | <h5> | |
131 | <a name="math_toolkit.dist_ref.dists.nc_t_dist.h2"></a> | |
132 | <span class="phrase"><a name="math_toolkit.dist_ref.dists.nc_t_dist.accuracy"></a></span><a class="link" href="nc_t_dist.html#math_toolkit.dist_ref.dists.nc_t_dist.accuracy">Accuracy</a> | |
133 | </h5> | |
134 | <p> | |
135 | The following table shows the peak errors (in units of <a href="http://en.wikipedia.org/wiki/Machine_epsilon" target="_top">epsilon</a>) | |
136 | found on various platforms with various floating-point types. Unless otherwise | |
137 | specified, any floating-point type that is narrower than the one shown | |
138 | will have <a class="link" href="../../relative_error.html#math_toolkit.relative_error.zero_error">effectively | |
139 | zero error</a>. | |
140 | </p> | |
141 | <div class="table"> | |
142 | <a name="math_toolkit.dist_ref.dists.nc_t_dist.table_non_central_t_CDF"></a><p class="title"><b>Table 5.8. Error rates for non central t CDF</b></p> | |
143 | <div class="table-contents"><table class="table" summary="Error rates for non central t CDF"> | |
144 | <colgroup> | |
145 | <col> | |
146 | <col> | |
147 | <col> | |
148 | <col> | |
149 | <col> | |
150 | </colgroup> | |
151 | <thead><tr> | |
152 | <th> | |
153 | </th> | |
154 | <th> | |
155 | <p> | |
156 | Microsoft Visual C++ version 12.0<br> Win32<br> double | |
157 | </p> | |
158 | </th> | |
159 | <th> | |
160 | <p> | |
161 | GNU C++ version 5.1.0<br> linux<br> double | |
162 | </p> | |
163 | </th> | |
164 | <th> | |
165 | <p> | |
166 | GNU C++ version 5.1.0<br> linux<br> long double | |
167 | </p> | |
168 | </th> | |
169 | <th> | |
170 | <p> | |
171 | Sun compiler version 0x5130<br> Sun Solaris<br> long double | |
172 | </p> | |
173 | </th> | |
174 | </tr></thead> | |
175 | <tbody> | |
176 | <tr> | |
177 | <td> | |
178 | <p> | |
179 | Non Central T | |
180 | </p> | |
181 | </td> | |
182 | <td> | |
183 | <p> | |
184 | <span class="blue">Max = 138ε (Mean = 31.5ε)</span> | |
185 | </p> | |
186 | </td> | |
187 | <td> | |
188 | <p> | |
189 | <span class="blue">Max = 0.796ε (Mean = 0.0691ε)</span><br> | |
190 | <br> (<span class="emphasis"><em>Rmath 3.0.2:</em></span> <span class="red">Max | |
191 | = 5.28e+15ε (Mean = 8.49e+14ε) <a class="link" href="../../logs_and_tables/logs.html#errors_GNU_C_version_5_1_0_linux_double_non_central_t_CDF_Rmath_3_0_2_Non_Central_T">And | |
192 | other failures.</a>)</span> | |
193 | </p> | |
194 | </td> | |
195 | <td> | |
196 | <p> | |
197 | <span class="blue">Max = 141ε (Mean = 31.1ε)</span> | |
198 | </p> | |
199 | </td> | |
200 | <td> | |
201 | <p> | |
202 | <span class="blue">Max = 145ε (Mean = 30.2ε)</span> | |
203 | </p> | |
204 | </td> | |
205 | </tr> | |
206 | <tr> | |
207 | <td> | |
208 | <p> | |
209 | Non Central T (small non-centrality) | |
210 | </p> | |
211 | </td> | |
212 | <td> | |
213 | <p> | |
214 | <span class="blue">Max = 3.61ε (Mean = 1.03ε)</span> | |
215 | </p> | |
216 | </td> | |
217 | <td> | |
218 | <p> | |
219 | <span class="blue">Max = 0ε (Mean = 0ε)</span><br> <br> (<span class="emphasis"><em>Rmath | |
220 | 3.0.2:</em></span> Max = 2.09e+03ε (Mean = 244ε)) | |
221 | </p> | |
222 | </td> | |
223 | <td> | |
224 | <p> | |
225 | <span class="blue">Max = 7.86ε (Mean = 1.69ε)</span> | |
226 | </p> | |
227 | </td> | |
228 | <td> | |
229 | <p> | |
230 | <span class="blue">Max = 9.15ε (Mean = 2.25ε)</span> | |
231 | </p> | |
232 | </td> | |
233 | </tr> | |
234 | <tr> | |
235 | <td> | |
236 | <p> | |
237 | Non Central T (large parameters) | |
238 | </p> | |
239 | </td> | |
240 | <td> | |
241 | <p> | |
242 | <span class="blue">Max = 286ε (Mean = 62.8ε)</span> | |
243 | </p> | |
244 | </td> | |
245 | <td> | |
246 | <p> | |
247 | <span class="blue">Max = 257ε (Mean = 72.1ε)</span><br> <br> | |
248 | (<span class="emphasis"><em>Rmath 3.0.2:</em></span> Max = 2.46ε (Mean = 0.657ε)) | |
249 | </p> | |
250 | </td> | |
251 | <td> | |
252 | <p> | |
253 | <span class="blue">Max = 5.26e+05ε (Mean = 1.48e+05ε)</span> | |
254 | </p> | |
255 | </td> | |
256 | <td> | |
257 | <p> | |
258 | <span class="blue">Max = 5.24e+05ε (Mean = 1.47e+05ε)</span> | |
259 | </p> | |
260 | </td> | |
261 | </tr> | |
262 | </tbody> | |
263 | </table></div> | |
264 | </div> | |
265 | <br class="table-break"><div class="table"> | |
266 | <a name="math_toolkit.dist_ref.dists.nc_t_dist.table_non_central_t_CDF_complement"></a><p class="title"><b>Table 5.9. Error rates for non central t CDF complement</b></p> | |
267 | <div class="table-contents"><table class="table" summary="Error rates for non central t CDF complement"> | |
268 | <colgroup> | |
269 | <col> | |
270 | <col> | |
271 | <col> | |
272 | <col> | |
273 | <col> | |
274 | </colgroup> | |
275 | <thead><tr> | |
276 | <th> | |
277 | </th> | |
278 | <th> | |
279 | <p> | |
280 | Microsoft Visual C++ version 12.0<br> Win32<br> double | |
281 | </p> | |
282 | </th> | |
283 | <th> | |
284 | <p> | |
285 | GNU C++ version 5.1.0<br> linux<br> double | |
286 | </p> | |
287 | </th> | |
288 | <th> | |
289 | <p> | |
290 | GNU C++ version 5.1.0<br> linux<br> long double | |
291 | </p> | |
292 | </th> | |
293 | <th> | |
294 | <p> | |
295 | Sun compiler version 0x5130<br> Sun Solaris<br> long double | |
296 | </p> | |
297 | </th> | |
298 | </tr></thead> | |
299 | <tbody> | |
300 | <tr> | |
301 | <td> | |
302 | <p> | |
303 | Non Central T | |
304 | </p> | |
305 | </td> | |
306 | <td> | |
307 | <p> | |
308 | <span class="blue">Max = 150ε (Mean = 32.3ε)</span> | |
309 | </p> | |
310 | </td> | |
311 | <td> | |
312 | <p> | |
313 | <span class="blue">Max = 0.707ε (Mean = 0.0497ε)</span><br> | |
314 | <br> (<span class="emphasis"><em>Rmath 3.0.2:</em></span> <span class="red">Max | |
315 | = 6.19e+15ε (Mean = 6.72e+14ε) <a class="link" href="../../logs_and_tables/logs.html#errors_GNU_C_version_5_1_0_linux_double_non_central_t_CDF_complement_Rmath_3_0_2_Non_Central_T">And | |
316 | other failures.</a>)</span> | |
317 | </p> | |
318 | </td> | |
319 | <td> | |
320 | <p> | |
321 | <span class="blue">Max = 203ε (Mean = 31.8ε)</span> | |
322 | </p> | |
323 | </td> | |
324 | <td> | |
325 | <p> | |
326 | <span class="blue">Max = 340ε (Mean = 43.6ε)</span> | |
327 | </p> | |
328 | </td> | |
329 | </tr> | |
330 | <tr> | |
331 | <td> | |
332 | <p> | |
333 | Non Central T (small non-centrality) | |
334 | </p> | |
335 | </td> | |
336 | <td> | |
337 | <p> | |
338 | <span class="blue">Max = 5.21ε (Mean = 1.43ε)</span> | |
339 | </p> | |
340 | </td> | |
341 | <td> | |
342 | <p> | |
343 | <span class="blue">Max = 0ε (Mean = 0ε)</span><br> <br> (<span class="emphasis"><em>Rmath | |
344 | 3.0.2:</em></span> Max = 1.87e+03ε (Mean = 263ε)) | |
345 | </p> | |
346 | </td> | |
347 | <td> | |
348 | <p> | |
349 | <span class="blue">Max = 7.48ε (Mean = 1.86ε)</span> | |
350 | </p> | |
351 | </td> | |
352 | <td> | |
353 | <p> | |
354 | <span class="blue">Max = 10.9ε (Mean = 2.43ε)</span> | |
355 | </p> | |
356 | </td> | |
357 | </tr> | |
358 | <tr> | |
359 | <td> | |
360 | <p> | |
361 | Non Central T (large parameters) | |
362 | </p> | |
363 | </td> | |
364 | <td> | |
365 | <p> | |
366 | <span class="blue">Max = 227ε (Mean = 50.4ε)</span> | |
367 | </p> | |
368 | </td> | |
369 | <td> | |
370 | <p> | |
371 | <span class="blue">Max = 478ε (Mean = 96.3ε)</span><br> <br> | |
372 | (<span class="emphasis"><em>Rmath 3.0.2:</em></span> Max = 2.24ε (Mean = 0.945ε)) | |
373 | </p> | |
374 | </td> | |
375 | <td> | |
376 | <p> | |
377 | <span class="blue">Max = 9.79e+05ε (Mean = 1.97e+05ε)</span> | |
378 | </p> | |
379 | </td> | |
380 | <td> | |
381 | <p> | |
382 | <span class="blue">Max = 9.79e+05ε (Mean = 1.97e+05ε)</span> | |
383 | </p> | |
384 | </td> | |
385 | </tr> | |
386 | </tbody> | |
387 | </table></div> | |
388 | </div> | |
389 | <br class="table-break"><div class="caution"><table border="0" summary="Caution"> | |
390 | <tr> | |
391 | <td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="../../../../../../../doc/src/images/caution.png"></td> | |
392 | <th align="left">Caution</th> | |
393 | </tr> | |
394 | <tr><td align="left" valign="top"><p> | |
395 | The complexity of the current algorithm is dependent upon δ<sup>2</sup>: consequently | |
396 | the time taken to evaluate the CDF increases rapidly for δ > 500, likewise | |
397 | the accuracy decreases rapidly for very large δ. | |
398 | </p></td></tr> | |
399 | </table></div> | |
400 | <p> | |
401 | Accuracy for the quantile and PDF functions should be broadly similar. | |
402 | The <span class="emphasis"><em>mode</em></span> is determined numerically and cannot in principal | |
403 | be more accurate than the square root of floating-point type FPT epsilon, | |
404 | accessed using <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">tools</span><span class="special">::</span><span class="identifier">epsilon</span><span class="special"><</span><span class="identifier">FPT</span><span class="special">>()</span></code>. | |
405 | For 64-bit <code class="computeroutput"><span class="keyword">double</span></code>, epsilon | |
406 | is about 1e-16, so the fractional accuracy is limited to 1e-8. | |
407 | </p> | |
408 | <h5> | |
409 | <a name="math_toolkit.dist_ref.dists.nc_t_dist.h3"></a> | |
410 | <span class="phrase"><a name="math_toolkit.dist_ref.dists.nc_t_dist.tests"></a></span><a class="link" href="nc_t_dist.html#math_toolkit.dist_ref.dists.nc_t_dist.tests">Tests</a> | |
411 | </h5> | |
412 | <p> | |
413 | There are two sets of tests of this distribution: | |
414 | </p> | |
415 | <p> | |
416 | Basic sanity checks compare this implementation to the test values given | |
417 | in "Computing discrete mixtures of continuous distributions: noncentral | |
418 | chisquare, noncentral t and the distribution of the square of the sample | |
419 | multiple correlation coefficient." Denise Benton, K. Krishnamoorthy, | |
420 | Computational Statistics & Data Analysis 43 (2003) 249-267. | |
421 | </p> | |
422 | <p> | |
423 | Accuracy checks use test data computed with this implementation and arbitary | |
424 | precision interval arithmetic: this test data is believed to be accurate | |
425 | to at least 50 decimal places. | |
426 | </p> | |
427 | <p> | |
428 | The cases of large (or infinite) ν and/or large δ has received special treatment | |
429 | to avoid catastrophic loss of accuracy. New tests have been added to confirm | |
430 | the improvement achieved. | |
431 | </p> | |
432 | <p> | |
433 | From Boost 1.52, degrees of freedom ν can be +∞ | |
434 | when the normal distribution | |
435 | located at δ | |
436 | (equivalent to the central Student's t distribution) is used | |
437 | in place for accuracy and speed. | |
438 | </p> | |
439 | <h5> | |
440 | <a name="math_toolkit.dist_ref.dists.nc_t_dist.h4"></a> | |
441 | <span class="phrase"><a name="math_toolkit.dist_ref.dists.nc_t_dist.implementation"></a></span><a class="link" href="nc_t_dist.html#math_toolkit.dist_ref.dists.nc_t_dist.implementation">Implementation</a> | |
442 | </h5> | |
443 | <p> | |
444 | The CDF is computed using a modification of the method described in "Computing | |
445 | discrete mixtures of continuous distributions: noncentral chisquare, noncentral | |
446 | t and the distribution of the square of the sample multiple correlation | |
447 | coefficient." Denise Benton, K. Krishnamoorthy, Computational Statistics | |
448 | & Data Analysis 43 (2003) 249-267. | |
449 | </p> | |
450 | <p> | |
451 | This uses the following formula for the CDF: | |
452 | </p> | |
453 | <p> | |
454 | <span class="inlinemediaobject"><img src="../../../../equations/nc_t_ref2.svg"></span> | |
455 | </p> | |
456 | <p> | |
457 | Where I<sub>x</sub>(a,b) is the incomplete beta function, and Φ(x) is the normal CDF | |
458 | at x. | |
459 | </p> | |
460 | <p> | |
461 | Iteration starts at the largest of the Poisson weighting terms (at i = | |
462 | δ<sup>2</sup> / 2) and then proceeds in both directions as per Benton and Krishnamoorthy's | |
463 | paper. | |
464 | </p> | |
465 | <p> | |
466 | Alternatively, by considering what happens when t = ∞, we have x = 1, and | |
467 | therefore I<sub>x</sub>(a,b) = 1 and: | |
468 | </p> | |
469 | <p> | |
470 | <span class="inlinemediaobject"><img src="../../../../equations/nc_t_ref3.svg"></span> | |
471 | </p> | |
472 | <p> | |
473 | From this we can easily show that: | |
474 | </p> | |
475 | <p> | |
476 | <span class="inlinemediaobject"><img src="../../../../equations/nc_t_ref4.svg"></span> | |
477 | </p> | |
478 | <p> | |
479 | and therefore we have a means to compute either the probability or its | |
480 | complement directly without the risk of cancellation error. The crossover | |
481 | criterion for choosing whether to calculate the CDF or its complement is | |
482 | the same as for the <a class="link" href="nc_beta_dist.html" title="Noncentral Beta Distribution">Noncentral | |
483 | Beta Distribution</a>. | |
484 | </p> | |
485 | <p> | |
486 | The PDF can be computed by a very similar method using: | |
487 | </p> | |
488 | <p> | |
489 | <span class="inlinemediaobject"><img src="../../../../equations/nc_t_ref5.svg"></span> | |
490 | </p> | |
491 | <p> | |
492 | Where I<sub>x</sub><sup>'</sup>(a,b) is the derivative of the incomplete beta function. | |
493 | </p> | |
494 | <p> | |
495 | For both the PDF and CDF we switch to approximating the distribution by | |
496 | a Student's t distribution centred on δ when ν is very large. The crossover | |
497 | location appears to be when δ/(4ν) < ε, this location was estimated by | |
498 | inspection of equation 2.6 in "A Comparison of Approximations To Percentiles | |
499 | of the Noncentral t-Distribution". H. Sahai and M. M. Ojeda, Revista | |
500 | Investigacion Operacional Vol 21, No 2, 2000, page 123. | |
501 | </p> | |
502 | <p> | |
503 | Equation 2.6 is a Fisher-Cornish expansion by Eeden and Johnson. The second | |
504 | term includes the ratio δ/(4ν), so when this term become negligible, this | |
505 | and following terms can be ignored, leaving just Student's t distribution | |
506 | centred on δ. | |
507 | </p> | |
508 | <p> | |
509 | This was also confirmed by experimental testing. | |
510 | </p> | |
511 | <p> | |
512 | See also | |
513 | </p> | |
514 | <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> | |
515 | <li class="listitem"> | |
516 | "Some Approximations to the Percentage Points of the Noncentral | |
517 | t-Distribution". C. van Eeden. International Statistical Review, | |
518 | 29, 4-31. | |
519 | </li> | |
520 | <li class="listitem"> | |
521 | "Continuous Univariate Distributions". N.L. Johnson, S. Kotz | |
522 | and N. Balkrishnan. 1995. John Wiley and Sons New York. | |
523 | </li> | |
524 | </ul></div> | |
525 | <p> | |
526 | The quantile is calculated via the usual <a class="link" href="../../roots/roots_noderiv.html" title="Root Finding Without Derivatives">root-finding | |
527 | without derivatives</a> method with the initial guess taken as the quantile | |
528 | of a normal approximation to the noncentral T. | |
529 | </p> | |
530 | <p> | |
531 | There is no closed form for the mode, so this is computed via functional | |
532 | maximisation of the PDF. | |
533 | </p> | |
534 | <p> | |
535 | The remaining functions (mean, variance etc) are implemented using the | |
536 | formulas given in Weisstein, Eric W. "Noncentral Student's t-Distribution." | |
537 | From MathWorld--A Wolfram Web Resource. <a href="http://mathworld.wolfram.com/NoncentralStudentst-Distribution.html" target="_top">http://mathworld.wolfram.com/NoncentralStudentst-Distribution.html</a> | |
538 | and in the <a href="http://reference.wolfram.com/mathematica/ref/NoncentralStudentTDistribution.html" target="_top">Mathematica | |
539 | documentation</a>. | |
540 | </p> | |
541 | <p> | |
542 | Some analytic properties of noncentral distributions (particularly unimodality, | |
543 | and monotonicity of their modes) are surveyed and summarized by: | |
544 | </p> | |
545 | <p> | |
546 | Andrea van Aubel & Wolfgang Gawronski, Applied Mathematics and Computation, | |
547 | 141 (2003) 3-12. | |
548 | </p> | |
549 | </div> | |
550 | <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> | |
551 | <td align="left"></td> | |
552 | <td align="right"><div class="copyright-footer">Copyright © 2006-2010, 2012-2014 Nikhar Agrawal, | |
553 | Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos, Hubert | |
554 | Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Johan Råde, Gautam Sewani, | |
555 | Benjamin Sobotta, Thijs van den Berg, Daryle Walker and Xiaogang Zhang<p> | |
556 | Distributed under the Boost Software License, Version 1.0. (See accompanying | |
557 | 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>) | |
558 | </p> | |
559 | </div></td> | |
560 | </tr></table> | |
561 | <hr> | |
562 | <div class="spirit-nav"> | |
563 | <a accesskey="p" href="nc_f_dist.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../dists.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="normal_dist.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a> | |
564 | </div> | |
565 | </body> | |
566 | </html> |