File: nc_f.qbk

package info (click to toggle)
boost1.88 1.88.0-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 576,932 kB
  • sloc: cpp: 4,149,234; xml: 136,789; ansic: 35,092; python: 33,910; asm: 5,698; sh: 4,604; ada: 1,681; makefile: 1,633; pascal: 1,139; perl: 1,124; sql: 640; yacc: 478; ruby: 271; java: 77; lisp: 24; csh: 6
file content (195 lines) | stat: -rw-r--r-- 6,209 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
[section:nc_f_dist Noncentral F Distribution]

``#include <boost/math/distributions/non_central_f.hpp>``

   namespace boost{ namespace math{ 

   template <class RealType = double, 
             class ``__Policy``   = ``__policy_class`` >
   class non_central_f_distribution;

   typedef non_central_f_distribution<> non_central_f;

   template <class RealType, class ``__Policy``>
   class non_central_f_distribution
   {
   public:
      typedef RealType  value_type;
      typedef Policy    policy_type;

      // Constructor:
      BOOST_MATH_GPU_ENABLED non_central_f_distribution(RealType v1, RealType v2, RealType lambda);

      // Accessor to degrees_of_freedom parameters v1 & v2:
      BOOST_MATH_GPU_ENABLED RealType degrees_of_freedom1()const;
      BOOST_MATH_GPU_ENABLED RealType degrees_of_freedom2()const;

      // Accessor to non-centrality parameter lambda:
      BOOST_MATH_GPU_ENABLED RealType non_centrality()const;
   };
   
   }} // namespaces
   
The noncentral F distribution is a generalization of the __F_distrib.
It is defined as the ratio 

[expression F = (X/v1) / (Y/v2)]
   
where X is a noncentral [chi][super 2]
random variable with /v1/ degrees of freedom and non-centrality parameter [lambda], 
and Y is a central [chi][super 2] random variable with /v2/ degrees of freedom.

This gives the following PDF:

[equation nc_f_ref1]

where ['L[sub a][super b](c)] is a generalised Laguerre polynomial and ['B(a,b)] is the 
__beta function, or

[equation nc_f_ref2]

The following graph illustrates how the distribution changes
for different values of [lambda]:

[graph nc_f_pdf]

[h4 Member Functions]

      BOOST_MATH_GPU_ENABLED non_central_f_distribution(RealType v1, RealType v2, RealType lambda);
      
Constructs a non-central beta distribution with parameters /v1/ and /v2/
and non-centrality parameter /lambda/.

Requires /v1/ > 0, /v2/ > 0 and lambda >= 0, otherwise calls __domain_error.

      BOOST_MATH_GPU_ENABLED RealType degrees_of_freedom1()const;
      
Returns the parameter /v1/ from which this object was constructed.

      BOOST_MATH_GPU_ENABLED RealType degrees_of_freedom2()const;
      
Returns the parameter /v2/ from which this object was constructed.

      BOOST_MATH_GPU_ENABLED RealType non_centrality()const;
      
Returns the non-centrality parameter /lambda/ from which this object was constructed.

[h4 Non-member Accessors]

All the [link math_toolkit.dist_ref.nmp usual non-member accessor functions]
that are generic to all distributions are supported: __usual_accessors.
For this distribution all non-member accessor functions are marked with `BOOST_MATH_GPU_ENABLED` and can
be run on both host and device.

The domain of the random variable is \[0, +[infin]\].

[h4 Accuracy]

This distribution is implemented in terms of the
__non_central_beta_distrib: refer to that distribution for accuracy data.

[h4 Tests]

Since this distribution is implemented by adapting another distribution, 
the tests consist of basic sanity checks computed by the
[@http://www.r-project.org/ R-2.5.1 Math library statistical
package] and its pbeta and dbeta functions.

[h4 Implementation]

In the following table /v1/ and /v2/ are the first and second
degrees of freedom parameters of the distribution, [lambda]
is the non-centrality parameter,
/x/ is the random variate, /p/ is the probability, and /q = 1-p/.

[table
[[Function][Implementation Notes]]
[[pdf][Implemented in terms of the non-central beta PDF using the relation:

[role serif_italic f(x;v1,v2;[lambda]) = (v1\/v2) / ((1+y)*(1+y)) * g(y\/(1+y);v1\/2,v2\/2;[lambda])]

where [role serif_italic g(x; a, b; [lambda])] is the non central beta PDF, and:
 
[role serif_italic y = x * v1 \/ v2]
]]
[[cdf][Using the relation:

[role serif_italic p = B[sub y](v1\/2, v2\/2; [lambda])]

where [role serif_italic B[sub x](a, b; [lambda])] is the noncentral beta distribution CDF and

[role serif_italic y = x * v1 \/ v2]

]]

[[cdf complement][Using the relation:

[role serif_italic q = 1 - B[sub y](v1\/2, v2\/2; [lambda])]

where [role serif_italic 1 - B[sub x](a, b; [lambda])] is the complement of the 
noncentral beta distribution CDF and

[role serif_italic y = x * v1 \/ v2]

]]
[[quantile][Using the relation:

[role serif_italic x = (bx \/ (1-bx)) * (v1 \/ v2)]

where

[role serif_italic bx = Q[sub p][super -1](v1\/2, v2\/2; [lambda])]

and 

[role serif_italic Q[sub p][super -1](v1\/2, v2\/2; [lambda])]

is the noncentral beta quantile.

]]
[[quantile

from the complement][
Using the relation:

[role serif_italic x = (bx \/ (1-bx)) * (v1 \/ v2)]

where

[role serif_italic bx = QC[sub q][super -1](v1\/2, v2\/2; [lambda])]

and 

[role serif_italic QC[sub q][super -1](v1\/2, v2\/2; [lambda])]

is the noncentral beta quantile from the complement.]]
[[mean][[role serif_italic v2 * (v1 + l) \/ (v1 * (v2 - 2))]]]
[[mode][By numeric maximalisation of the PDF.]]
[[variance][Refer to, [@http://mathworld.wolfram.com/NoncentralF-Distribution.html
    Weisstein, Eric W. "Noncentral F-Distribution." From MathWorld--A Wolfram Web Resource.]  ]]
[[skewness][Refer to, [@http://mathworld.wolfram.com/NoncentralF-Distribution.html
    Weisstein, Eric W. "Noncentral F-Distribution." From MathWorld--A Wolfram Web Resource.],
    and to the [@http://reference.wolfram.com/mathematica/ref/NoncentralFRatioDistribution.html
    Mathematica documentation]  ]]
[[kurtosis and kurtosis excess]
    [Refer to, [@http://mathworld.wolfram.com/NoncentralF-Distribution.html
    Weisstein, Eric W. "Noncentral F-Distribution." From MathWorld--A Wolfram Web Resource.],
    and to the [@http://reference.wolfram.com/mathematica/ref/NoncentralFRatioDistribution.html
    Mathematica documentation]  ]]
]

Some analytic properties of noncentral distributions
(particularly unimodality, and monotonicity of their modes)
are surveyed and summarized by:

Andrea van Aubel & Wolfgang Gawronski, Applied Mathematics and Computation, 141 (2003) 3-12.

[endsect] [/section:nc_f_dist]

[/ nc_f.qbk
  Copyright 2008 John Maddock and Paul A. Bristow.
  Distributed under the Boost Software License, Version 1.0.
  (See accompanying file LICENSE_1_0.txt or copy at
  http://www.boost.org/LICENSE_1_0.txt).
]