nc_f.qbk 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. [section:nc_f_dist Noncentral F Distribution]
  2. ``#include <boost/math/distributions/non_central_f.hpp>``
  3. namespace boost{ namespace math{
  4. template <class RealType = double,
  5. class ``__Policy`` = ``__policy_class`` >
  6. class non_central_f_distribution;
  7. typedef non_central_f_distribution<> non_central_f;
  8. template <class RealType, class ``__Policy``>
  9. class non_central_f_distribution
  10. {
  11. public:
  12. typedef RealType value_type;
  13. typedef Policy policy_type;
  14. // Constructor:
  15. non_central_f_distribution(RealType v1, RealType v2, RealType lambda);
  16. // Accessor to degrees_of_freedom parameters v1 & v2:
  17. RealType degrees_of_freedom1()const;
  18. RealType degrees_of_freedom2()const;
  19. // Accessor to non-centrality parameter lambda:
  20. RealType non_centrality()const;
  21. };
  22. }} // namespaces
  23. The noncentral F distribution is a generalization of the __F_distrib.
  24. It is defined as the ratio
  25. [expression F = (X/v1) / (Y/v2)]
  26. where X is a noncentral [chi][super 2]
  27. random variable with /v1/ degrees of freedom and non-centrality parameter [lambda],
  28. and Y is a central [chi][super 2] random variable with /v2/ degrees of freedom.
  29. This gives the following PDF:
  30. [equation nc_f_ref1]
  31. where ['L[sub a][super b](c)] is a generalised Laguerre polynomial and ['B(a,b)] is the
  32. __beta function, or
  33. [equation nc_f_ref2]
  34. The following graph illustrates how the distribution changes
  35. for different values of [lambda]:
  36. [graph nc_f_pdf]
  37. [h4 Member Functions]
  38. non_central_f_distribution(RealType v1, RealType v2, RealType lambda);
  39. Constructs a non-central beta distribution with parameters /v1/ and /v2/
  40. and non-centrality parameter /lambda/.
  41. Requires /v1/ > 0, /v2/ > 0 and lambda >= 0, otherwise calls __domain_error.
  42. RealType degrees_of_freedom1()const;
  43. Returns the parameter /v1/ from which this object was constructed.
  44. RealType degrees_of_freedom2()const;
  45. Returns the parameter /v2/ from which this object was constructed.
  46. RealType non_centrality()const;
  47. Returns the non-centrality parameter /lambda/ from which this object was constructed.
  48. [h4 Non-member Accessors]
  49. All the [link math_toolkit.dist_ref.nmp usual non-member accessor functions]
  50. that are generic to all distributions are supported: __usual_accessors.
  51. The domain of the random variable is \[0, +[infin]\].
  52. [h4 Accuracy]
  53. This distribution is implemented in terms of the
  54. __non_central_beta_distrib: refer to that distribution for accuracy data.
  55. [h4 Tests]
  56. Since this distribution is implemented by adapting another distribution,
  57. the tests consist of basic sanity checks computed by the
  58. [@http://www.r-project.org/ R-2.5.1 Math library statistical
  59. package] and its pbeta and dbeta functions.
  60. [h4 Implementation]
  61. In the following table /v1/ and /v2/ are the first and second
  62. degrees of freedom parameters of the distribution, [lambda]
  63. is the non-centrality parameter,
  64. /x/ is the random variate, /p/ is the probability, and /q = 1-p/.
  65. [table
  66. [[Function][Implementation Notes]]
  67. [[pdf][Implemented in terms of the non-central beta PDF using the relation:
  68. [role serif_italic f(x;v1,v2;[lambda]) = (v1\/v2) / ((1+y)*(1+y)) * g(y\/(1+y);v1\/2,v2\/2;[lambda])]
  69. where [role serif_italic g(x; a, b; [lambda])] is the non central beta PDF, and:
  70. [role serif_italic y = x * v1 \/ v2]
  71. ]]
  72. [[cdf][Using the relation:
  73. [role serif_italic p = B[sub y](v1\/2, v2\/2; [lambda])]
  74. where [role serif_italic B[sub x](a, b; [lambda])] is the noncentral beta distribution CDF and
  75. [role serif_italic y = x * v1 \/ v2]
  76. ]]
  77. [[cdf complement][Using the relation:
  78. [role serif_italic q = 1 - B[sub y](v1\/2, v2\/2; [lambda])]
  79. where [role serif_italic 1 - B[sub x](a, b; [lambda])] is the complement of the
  80. noncentral beta distribution CDF and
  81. [role serif_italic y = x * v1 \/ v2]
  82. ]]
  83. [[quantile][Using the relation:
  84. [role serif_italic x = (bx \/ (1-bx)) * (v1 \/ v2)]
  85. where
  86. [role serif_italic bx = Q[sub p][super -1](v1\/2, v2\/2; [lambda])]
  87. and
  88. [role serif_italic Q[sub p][super -1](v1\/2, v2\/2; [lambda])]
  89. is the noncentral beta quantile.
  90. ]]
  91. [[quantile
  92. from the complement][
  93. Using the relation:
  94. [role serif_italic x = (bx \/ (1-bx)) * (v1 \/ v2)]
  95. where
  96. [role serif_italic bx = QC[sub q][super -1](v1\/2, v2\/2; [lambda])]
  97. and
  98. [role serif_italic QC[sub q][super -1](v1\/2, v2\/2; [lambda])]
  99. is the noncentral beta quantile from the complement.]]
  100. [[mean][[role serif_italic v2 * (v1 + l) \/ (v1 * (v2 - 2))]]]
  101. [[mode][By numeric maximalisation of the PDF.]]
  102. [[variance][Refer to, [@http://mathworld.wolfram.com/NoncentralF-Distribution.html
  103. Weisstein, Eric W. "Noncentral F-Distribution." From MathWorld--A Wolfram Web Resource.] ]]
  104. [[skewness][Refer to, [@http://mathworld.wolfram.com/NoncentralF-Distribution.html
  105. Weisstein, Eric W. "Noncentral F-Distribution." From MathWorld--A Wolfram Web Resource.],
  106. and to the [@http://reference.wolfram.com/mathematica/ref/NoncentralFRatioDistribution.html
  107. Mathematica documentation] ]]
  108. [[kurtosis and kurtosis excess]
  109. [Refer to, [@http://mathworld.wolfram.com/NoncentralF-Distribution.html
  110. Weisstein, Eric W. "Noncentral F-Distribution." From MathWorld--A Wolfram Web Resource.],
  111. and to the [@http://reference.wolfram.com/mathematica/ref/NoncentralFRatioDistribution.html
  112. Mathematica documentation] ]]
  113. ]
  114. Some analytic properties of noncentral distributions
  115. (particularly unimodality, and monotonicity of their modes)
  116. are surveyed and summarized by:
  117. Andrea van Aubel & Wolfgang Gawronski, Applied Mathematics and Computation, 141 (2003) 3-12.
  118. [endsect] [/section:nc_f_dist]
  119. [/ nc_f.qbk
  120. Copyright 2008 John Maddock and Paul A. Bristow.
  121. Distributed under the Boost Software License, Version 1.0.
  122. (See accompanying file LICENSE_1_0.txt or copy at
  123. http://www.boost.org/LICENSE_1_0.txt).
  124. ]