Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r80233 - trunk/boost/math/distributions
From: pbristow_at_[hidden]
Date: 2012-08-26 05:43:45


Author: pbristow
Date: 2012-08-26 05:43:43 EDT (Sun, 26 Aug 2012)
New Revision: 80233
URL: http://svn.boost.org/trac/boost/changeset/80233

Log:
delta == 0 treated as special case for mean, variance, skewness and kurtosis
== central Student's t
Text files modified:
   trunk/boost/math/distributions/non_central_t.hpp | 18 +++++++++++++++---
   1 files changed, 15 insertions(+), 3 deletions(-)

Modified: trunk/boost/math/distributions/non_central_t.hpp
==============================================================================
--- trunk/boost/math/distributions/non_central_t.hpp (original)
+++ trunk/boost/math/distributions/non_central_t.hpp 2012-08-26 05:43:43 EDT (Sun, 26 Aug 2012)
@@ -522,8 +522,9 @@
             BOOST_MATH_STD_USING
             if (v > 1 / boost::math::tools::epsilon<T>() )
             {
- normal_distribution<T, Policy> n(delta, 1);
- return boost::math::mean(n);
+ //normal_distribution<T, Policy> n(delta, 1);
+ //return boost::math::mean(n);
+ return delta;
             }
             else
             {
@@ -539,7 +540,10 @@
             {
                return 1;
             }
-
+ if (delta == 0)
+ { // == Student's t
+ return v / (v - 2);
+ }
             T result = ((delta * delta + 1) * v) / (v - 2);
             T m = mean(v, delta, pol);
             result -= m * m;
@@ -554,6 +558,10 @@
             {
                return 0;
             }
+ if(delta == 0)
+ { // == Student's t
+ return 0;
+ }
             T mean = boost::math::detail::mean(v, delta, pol);
             T l2 = delta * delta;
             T var = ((l2 + 1) * v) / (v - 2) - mean * mean;
@@ -572,6 +580,10 @@
             {
                return 3;
             }
+ if (delta == 0)
+ { // == Student's t
+ return 3;
+ }
             T mean = boost::math::detail::mean(v, delta, pol);
             T l2 = delta * delta;
             T var = ((l2 + 1) * v) / (v - 2) - mean * mean;


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk