2
0
mirror of https://github.com/boostorg/math.git synced 2026-01-31 20:32:07 +00:00

Added non-central F docs, plus updated nc beta docs.

[SVN r43124]
This commit is contained in:
John Maddock
2008-02-06 12:46:52 +00:00
parent 657df81a9d
commit ca25f35eef
10 changed files with 713 additions and 3 deletions

View File

@@ -17,6 +17,7 @@
[include distributions/negative_binomial.qbk]
[include distributions/nc_beta.qbk]
[include distributions/nc_chi_squared.qbk]
[include distributions/nc_f.qbk]
[include distributions/normal.qbk]
[include distributions/pareto.qbk]
[include distributions/poisson.qbk]

View File

@@ -80,10 +80,10 @@ Returns the parameter /lambda/ from which this object was constructed.
Most of the [link math_toolkit.dist.dist_ref.nmp usual non-member accessor functions]
are supported: __cdf, __pdf, __quantile,
__hazard, __chf, __range and __support.
__median, __mode, __hazard, __chf, __range and __support.
However, the following are not currently implemented:
__mean, __median, __mode, __variance, __sd, __skewness,
__mean, __variance, __sd, __skewness,
__kurtosis and __kurtosis_excess.
The domain of the random variable is \[0, 1\].

View File

@@ -0,0 +1,188 @@
[section:nc_f_dist Non Central 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:
non_central_f_distribution(RealType v1, RealType v2, RealType lambda);
// Accessor to parameters:
RealType degrees_of_freedom1()const;
RealType degrees_of_freedom2()const;
// Accessor to non centrality parameter:
RealType non_centrality()const;
};
}} // namespaces
The non-central F distribution is a generalization of the
[link math_toolkit.dist.dist_ref.dists.f_dist Fisher F distribution].
It is defined as the ratio
F = (X/v1) / (Y/v2)
where X is a non-central [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]:
[$../graphs/nc_f_pdf.png]
[h4 Member Functions]
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.
RealType degrees_of_freedom1()const;
Returns the parameter /v1/ from which this object was constructed.
RealType degrees_of_freedom2()const;
Returns the parameter /v2/ from which this object was constructed.
RealType non_centrality()const;
Returns the parameter /lambda/ from which this object was constructed.
[h4 Non-member Accessors]
All the [link math_toolkit.dist.dist_ref.nmp usual non-member accessor functions]
that are generic to all distributions are supported: __usual_accessors.
The domain of the random variable is \[0, +[infin]\].
[h4 Accuracy]
This distribution is implemented in terms of the
[link math_toolkit.dist.dist_ref.dists.nc_beta_dist non-central beta distribution]:
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 R statistical
package and the 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:
f(x;v1,v2;[lambda]) = (v1\/v2) / ((1+y)*(1+y)) * g(y\/(1+y);v1\/2,v2\/2;[lambda])
where g(x; a, b; [lambda]) is the non central beta PDF, and:
y = x * v1 \/ v2
]]
[[cdf][Using the relation:
p = B[sub y](v1\/2, v2\/2; [lambda])
where B[sub x](a, b; [lambda]) is the non-central beta distribution CDF and
y = x * v1 \/ v2
]]
[[cdf complement][Using the relation:
q = 1 - B[sub y](v1\/2, v2\/2; [lambda])
where 1 - B[sub x](a, b; [lambda]) is the complement of the
non-central beta distribution CDF and
y = x * v1 \/ v2
]]
[[quantile][Using the relation:
x = (bx \/ (1-bx)) * (v1 \/ v2)
where
bx = Q[sub p][super -1](v1\/2, v2\/2; [lambda])
and
Q[sub p][super -1](v1\/2, v2\/2; [lambda])
is the non-central beta quantile.
]]
[[quantile
from the complement][
Using the relation:
x = (bx \/ (1-bx)) * (v1 \/ v2)
where
bx = QC[sub q][super -1](v1\/2, v2\/2; [lambda])
and
QC[sub q][super -1](v1\/2, v2\/2; [lambda])
is the non-central beta quantile from the complement.]]
[[mean][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] ]]
]
[endsect][/section:nc_beta_dist]
[/ nc_beta.qbk
Copyright 2006 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).
]

View File

@@ -14,7 +14,7 @@ for mmlfile in $*; do
pngfile=$(basename $svgfile .svg).png
tempfile=temp.mml
# strip html wrappers put in by MathCast:
cat $svgfile | tr -d "\r\n" | sed -e 's/.*\(<math[^>]*>.*<\/math>\).*/\1/' > $tempfile
cat $mmlfile | tr -d "\r\n" | sed -e 's/.*\(<math[^>]*>.*<\/math>\).*/\1/' > $tempfile
echo Generating $svgfile
$python $math2svg $tempfile > $svgfile
@@ -24,3 +24,4 @@ for mmlfile in $*; do
done

View File

@@ -0,0 +1,314 @@
<?xml version='1.0'?>
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN'
'http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd'
[<!ENTITY mathml 'http://www.w3.org/1998/Math/MathML'>]>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head><title>nc_f_ref1</title>
<!-- MathML created with MathCast Equation Editor version 0.88 -->
</head>
<body>
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mrow>
<mi>f</mi>
<mfenced>
<mrow>
<mi>x</mi>
<mo>;</mo>
<msub>
<mi>&#x03BD;</mi>
<mn>1</mn>
</msub>
<mo>,</mo>
<msub>
<mi>&#x03BD;</mi>
<mn>2</mn>
</msub>
<mo>;</mo>
<mi>&#x03BB;</mi>
</mrow>
</mfenced>
<mspace width="1em"/>
<mo>=</mo>
<mspace width="1em"/>
<msup>
<mi>e</mi>
<mrow>
<mrow>
<mo>&#x2212;</mo>
<mfrac>
<mi>&#x03BB;</mi>
<mn>2</mn>
</mfrac>
</mrow>
<mo>+</mo>
<mfrac>
<mfenced>
<mrow>
<mi>&#x03BB;</mi>
<msub>
<mi>&#x03BD;</mi>
<mn>1</mn>
</msub>
<mi>x</mi>
</mrow>
</mfenced>
<mfenced>
<mrow>
<mn>2</mn>
<mfenced>
<mrow>
<msub>
<mi>&#x03BD;</mi>
<mn>2</mn>
</msub>
<mo>+</mo>
<msub>
<mi>&#x03BD;</mi>
<mn>1</mn>
</msub>
<mi>x</mi>
</mrow>
</mfenced>
</mrow>
</mfenced>
</mfrac>
</mrow>
</msup>
<msup>
<mrow>
<msub>
<mi>&#x03BD;</mi>
<mn>1</mn>
</msub>
</mrow>
<mrow>
<mfrac>
<mrow>
<msub>
<mi>&#x03BD;</mi>
<mn>1</mn>
</msub>
</mrow>
<mn>2</mn>
</mfrac>
</mrow>
</msup>
<msup>
<mrow>
<msub>
<mi>&#x03BD;</mi>
<mn>2</mn>
</msub>
</mrow>
<mrow>
<mfrac>
<mrow>
<msub>
<mi>&#x03BD;</mi>
<mn>2</mn>
</msub>
</mrow>
<mn>2</mn>
</mfrac>
</mrow>
</msup>
<msup>
<mi>x</mi>
<mrow>
<mfrac>
<mrow>
<msub>
<mi>&#x03BD;</mi>
<mn>1</mn>
</msub>
</mrow>
<mn>2</mn>
</mfrac>
<mo>&#x2212;</mo>
<mn>1</mn>
</mrow>
</msup>
<msup>
<mfenced>
<mrow>
<msub>
<mi>&#x03BD;</mi>
<mn>2</mn>
</msub>
<mo>+</mo>
<msub>
<mi>&#x03BD;</mi>
<mn>1</mn>
</msub>
<mi>x</mi>
</mrow>
</mfenced>
<mrow>
<mo>&#x2212;</mo>
<mfrac>
<mfenced>
<mrow>
<msub>
<mi>&#x03BD;</mi>
<mn>1</mn>
</msub>
<mo>+</mo>
<msub>
<mi>&#x03BD;</mi>
<mn>2</mn>
</msub>
</mrow>
</mfenced>
<mn>2</mn>
</mfrac>
</mrow>
</msup>
<mfrac>
<mrow>
<mi>&#x0393;</mi>
<mfenced>
<mrow>
<mfrac>
<mn>1</mn>
<mn>2</mn>
</mfrac>
<msub>
<mi>&#x03BD;</mi>
<mn>1</mn>
</msub>
</mrow>
</mfenced>
<mi>&#x0393;</mi>
<mfenced>
<mrow>
<mn>1</mn>
<mo>+</mo>
<mfrac>
<mn>1</mn>
<mn>2</mn>
</mfrac>
<msub>
<mi>&#x03BD;</mi>
<mn>2</mn>
</msub>
</mrow>
</mfenced>
<msubsup>
<mi>L</mi>
<mrow>
<mfrac>
<mrow>
<msub>
<mi>&#x03BD;</mi>
<mn>2</mn>
</msub>
</mrow>
<mn>2</mn>
</mfrac>
</mrow>
<mrow>
<mfrac>
<mrow>
<msub>
<mi>&#x03BD;</mi>
<mn>1</mn>
</msub>
</mrow>
<mn>2</mn>
</mfrac>
<mo>&#x2212;</mo>
<mn>1</mn>
</mrow>
</msubsup>
<mfenced>
<mrow>
<mo>&#x2212;</mo>
<mfrac>
<mrow>
<mi>&#x03BB;</mi>
<msub>
<mi>&#x03BD;</mi>
<mn>1</mn>
</msub>
<mi>x</mi>
</mrow>
<mrow>
<mn>2</mn>
<mfenced>
<mrow>
<msub>
<mi>&#x03BD;</mi>
<mn>2</mn>
</msub>
<mo>+</mo>
<msub>
<mi>&#x03BD;</mi>
<mn>1</mn>
</msub>
<mi>x</mi>
</mrow>
</mfenced>
</mrow>
</mfrac>
</mrow>
</mfenced>
</mrow>
<mrow>
<mi>B</mi>
<mfenced>
<mrow>
<mfrac>
<mn>1</mn>
<mn>2</mn>
</mfrac>
<mrow>
<msub>
<mi>&#x03BD;</mi>
<mn>1</mn>
</msub>
</mrow>
<mo>,</mo>
<mfrac>
<mn>1</mn>
<mn>2</mn>
</mfrac>
<mrow>
<msub>
<mi>&#x03BD;</mi>
<mn>2</mn>
</msub>
</mrow>
</mrow>
</mfenced>
<mi>&#x0393;</mi>
<mfenced>
<mrow>
<mfrac>
<mn>1</mn>
<mn>2</mn>
</mfrac>
<mfenced>
<mrow>
<mrow>
<msub>
<mi>&#x03BD;</mi>
<mn>1</mn>
</msub>
</mrow>
<mo>+</mo>
<mrow>
<msub>
<mi>&#x03BD;</mi>
<mn>2</mn>
</msub>
</mrow>
</mrow>
</mfenced>
</mrow>
</mfenced>
</mrow>
</mfrac>
</mrow>
</math>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 31 KiB

View File

@@ -0,0 +1,202 @@
<?xml version='1.0'?>
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN'
'http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd'
[<!ENTITY mathml 'http://www.w3.org/1998/Math/MathML'>]>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head><title>nc_f_ref2</title>
<!-- MathML created with MathCast Equation Editor version 0.88 -->
</head>
<body>
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mrow>
<mi>f</mi>
<mfenced>
<mrow>
<mi>x</mi>
<mo>;</mo>
<msub>
<mi>&#x03BD;</mi>
<mn>1</mn>
</msub>
<mo>,</mo>
<msub>
<mi>&#x03BD;</mi>
<mn>2</mn>
</msub>
<mo>;</mo>
<mi>&#x03BB;</mi>
</mrow>
</mfenced>
<mspace width="1em"/>
<mo>=</mo>
<mspace width="1em"/>
<munderover>
<mo>&#x2211;</mo>
<mrow>
<mi>k</mi>
<mo>=</mo>
<mn>0</mn>
</mrow>
<mi>&#x221E;</mi>
</munderover>
<mfrac>
<mrow>
<msup>
<mi>e</mi>
<mrow>
<mo>&#x2212;</mo>
<mfrac>
<mi>&#x03BB;</mi>
<mn>2</mn>
</mfrac>
</mrow>
</msup>
<msup>
<mfenced>
<mrow>
<mfrac>
<mi>&#x03BB;</mi>
<mn>2</mn>
</mfrac>
</mrow>
</mfenced>
<mi>k</mi>
</msup>
</mrow>
<mrow>
<mi>B</mi>
<mfenced>
<mrow>
<mfrac>
<mrow>
<msub>
<mi>&#x03BD;</mi>
<mn>2</mn>
</msub>
</mrow>
<mn>2,</mn>
</mfrac>
<mfrac>
<mrow>
<msub>
<mi>&#x03BD;</mi>
<mn>1</mn>
</msub>
</mrow>
<mn>2</mn>
</mfrac>
<mo>+</mo>
<mi>k</mi>
</mrow>
</mfenced>
<mi>k</mi>
<mo>!</mo>
</mrow>
</mfrac>
<msup>
<mfenced>
<mrow>
<mfrac>
<mrow>
<msub>
<mi>&#x03BD;</mi>
<mn>1</mn>
</msub>
</mrow>
<mrow>
<msub>
<mi>&#x03BD;</mi>
<mn>2</mn>
</msub>
</mrow>
</mfrac>
</mrow>
</mfenced>
<mrow>
<mfrac>
<mrow>
<msub>
<mi>&#x03BD;</mi>
<mn>1</mn>
</msub>
</mrow>
<mn>2</mn>
</mfrac>
<mo>+</mo>
<mi>k</mi>
</mrow>
</msup>
<msup>
<mfenced>
<mrow>
<mfrac>
<mrow>
<msub>
<mi>&#x03BD;</mi>
<mn>2</mn>
</msub>
</mrow>
<mrow>
<mrow>
<msub>
<mi>&#x03BD;</mi>
<mn>2</mn>
</msub>
</mrow>
<mo>+</mo>
<mrow>
<msub>
<mi>&#x03BD;</mi>
<mn>1</mn>
</msub>
</mrow>
<mi>x</mi>
</mrow>
</mfrac>
</mrow>
</mfenced>
<mrow>
<mfrac>
<mrow>
<mrow>
<msub>
<mi>&#x03BD;</mi>
<mn>1</mn>
</msub>
</mrow>
<mo>+</mo>
<mrow>
<msub>
<mi>&#x03BD;</mi>
<mn>2</mn>
</msub>
</mrow>
</mrow>
<mn>2</mn>
</mfrac>
<mo>+</mo>
<mi>k</mi>
</mrow>
</msup>
<msup>
<mi>x</mi>
<mrow>
<mfrac>
<mrow>
<msub>
<mi>&#x03BD;</mi>
<mn>1</mn>
</msub>
</mrow>
<mn>2</mn>
</mfrac>
<mo>+</mo>
<mi>k</mi>
<mo>&#x2212;</mo>
<mn>1</mn>
</mrow>
</msup>
</mrow>
</math>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 18 KiB