Imported Upstream version 1.57.0
[platform/upstream/boost.git] / libs / math / doc / sf / owens_t.qbk
1 [section:owens_t Owen's T function]
2
3 [h4 Synopsis]
4
5 ``
6 #include <boost/math/special_functions/owens_t.hpp>
7 ``
8
9   namespace boost{ namespace math{
10   
11   template <class T>
12   ``__sf_result`` owens_t(T h, T a);
13   
14   template <class T, class ``__Policy``>
15   ``__sf_result`` owens_t(T h, T a, const ``__Policy``&);
16   
17   }} // namespaces
18   
19 [h4 Description]
20
21 Returns the
22 [@http://en.wikipedia.org/wiki/Owen%27s_T_function Owens_t function]
23 of ['h] and ['a].
24
25 [optional_policy]
26
27 [sixemspace][sixemspace][equation owens_t]
28
29 [$../graphs/plot_owens_t.png]
30
31 The function `owens_t(h, a)` gives the probability
32 of the event ['(X > h and 0 < Y < a * X)],
33 where ['X] and ['Y] are independent standard normal random variables.
34
35 For h and a > 0, T(h,a),
36 gives the volume of an uncorrelated bivariate normal distribution
37 with zero means and unit variances over the area between
38 ['y = ax] and ['y = 0] and to the right of ['x = h].
39
40 That is the area shaded in the figure below (Owens 1956).
41
42 [graph owens_integration_area]
43
44 and is also illustrated by a 3D plot.
45
46 [$../graphs/plot_owens_3d_xyp.png]
47
48 This function is used in the computation of the __skew_normal_distrib.
49 It is also used in the computation of bivariate and
50 multivariate normal distribution probabilities.
51 The return type of this function is computed using the __arg_pomotion_rules:
52 the result is of type `double` when T is an integer type, and type T otherwise.
53
54 Owen's original paper (page 1077) provides some additional corner cases.
55
56 [: ['T(h, 0) = 0]]
57
58 [:['T(0, a) = [frac12][pi] arctan(a)]]
59
60 [:['T(h, 1) = [frac12] G(h) \[1 - G(h)\]]]
61
62 [:['T(h, [infin]) = G(|h|)]]
63
64 where G(h) is the univariate normal with zero mean and unit variance integral from -[infin] to h.  
65
66 [h4 Accuracy]
67
68 Over the built-in types and range tested,
69 errors are less than 10 * std::numeric_limits<RealType>::epsilon().
70
71 [h4 Testing]
72
73 Test data was generated by Patefield and Tandy algorithms T1 and T4,
74 and also the suggested reference routine T7.
75
76 * T1 was rejected if the result was too small compared to `atan(a)` (ie cancellation),
77 * T4 was rejected if there was no convergence,
78 * Both were rejected if they didn't agree.
79
80 Over the built-in types and range tested,
81 errors are less than 10 std::numeric_limits<RealType>::epsilon().
82
83 However, that there was a whole domain (large ['h], small ['a])
84 where it was not possible to generate any reliable test values
85 (all the methods got rejected for one reason or another).
86
87 There are also two sets of sanity tests: spot values are computed using __Mathematica and __R.
88
89
90 [h4 Implementation]
91
92 The function was proposed and evaluated by
93 [@http://projecteuclid.org/DPubS?service=UI&version=1.0&verb=Display&handle=euclid.aoms/1177728074
94 Donald. B. Owen, Tables for computing bivariate normal probabilities, 
95 Ann. Math. Statist., 27, 1075-1090 (1956)].
96
97 The algorithms of Patefield, M. and Tandy, D.
98 "Fast and accurate Calculation of Owen's T-Function", Journal of Statistical Software, 5 (5), 1 - 25 (2000)
99 are adapted for C++ with arbitrary RealType.
100
101 The Patefield-Tandy algorithm provides six methods of evalualution (T1 to T6);
102 the best method is selected according to the values of ['a] and ['h].
103 See the original paper and the source in
104 [@../../../../boost/math/special_functions/owens_t.hpp owens_t.hpp] for details.
105
106 The Patefield-Tandy algorithm is accurate to approximately 20 decimal places, so for
107 types with greater precision we use:
108
109 * A modified version of T1 which folds the calculation of ['atan(h)] into the T1 series
110 (to avoid subtracting two values similar in magnitude), and then accelerates the
111 resulting alternating series using method 1 from H. Cohen, F. Rodriguez Villegas, D. Zagier, 
112 "Convergence acceleration of alternating series", Bonn, (1991).  The result is valid everywhere,
113 but doesn't always converge, or may become too divergent in the first few terms to sum accurately.
114 This is used for ['ah < 1].
115 * A modified version of T2 which is accelerated in the same manner as T1.  This is used for ['h > 1].
116 * A version of T4 only when both T1 and T2 have failed to produce an accurate answer.
117 * Fallback to the Patefiled Tandy algorithm when all the above methods fail: this happens not at all
118 for our test data at 100 decimal digits precision.  However, there is a difficult area when 
119 ['a] is very close to 1 and the precision increases which may cause this to happen in very exceptional 
120 circumstances.
121
122 Using the above algorithm and a 100-decimal digit type, results accurate to 80 decimal places were obtained
123 in the difficult area where ['a] is close to 1, and greater than 95 decimal places elsewhere.
124
125 [endsect] [/section:owens_t The owens_t Function]
126
127 [/ 
128   Copyright 2012 Bejamin Sobotta, John Maddock and Paul A. Bristow.
129   Distributed under the Boost Software License, Version 1.0.
130   (See accompanying file LICENSE_1_0.txt or copy at
131   http://www.boost.org/LICENSE_1_0.txt).
132 ]
133
134