id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 9834,Negative Binomial Distribution: degenerate cases,HS ,John Maddock,"In the following calculations (please see code included below), the 4 results cannot be all correct at the same time. Also, if one will to uncomment the last block of code, one would find that its calculation would fail. '''Thoughts:''' * Now when the probability of ""success"" p0 (you used p in your documentation) is 1, shouldn't the value of the corresponding random variable be simply 0? If so, shouldn't the quantiles at p=0 and p=1 be both at 0? * Similarly, when p0 is 0, I would think it is quite ""natural"" to set/define the corresponding random variable to be one with mass 1 at infinity ... no need to work so hard to search for the zero as the error to the final calculation shows. Thank you.[[br]] HS P.S. Please copy the included code to a test.cpp and then build with g++ -o test test.cpp. P.ps. If the evaluation policy will to change to ignore the error, it ''appears'' that the calculation never complete. Can something be done to prevent this? Suggestions? {{{ #define BOOST_MATH_DOMAIN_ERROR_POLICY ignore_error #define BOOST_MATH_OVERFLOW_ERROR_POLICY ignore_error // #define BOOST_MATH_EVALUATION_ERROR_POLICY ignore_error #define BOOST_MATH_DISCRETE_QUANTILE_POLICY integer_round_up #include #include #include int main() { double _r0 = 3.0; double _p0 = 1.0; boost::math::negative_binomial_distribution<> _dist( _r0, _p0 ); std::printf( ""\n"" "" r = %g\n"" "" p = %g\n\n"", _r0, _p0 ); std::printf( "" Quantile(%g;upperTail=false) = %g\n"", 1.0, boost::math::quantile( _dist, 1.0 ) ); std::printf( "" Quantile(%g;upperTail=true) = %g\n\n"", 1.0, boost::math::quantile( boost::math::complement( _dist, 1.0 ) ) ); std::printf( "" Quantile(%g;upperTail=false) = %g\n"", 0.0, boost::math::quantile( _dist, 0.0 ) ); std::printf( "" Quantile(%g;upperTail=true) = %g\n\n"", 0.0, boost::math::quantile( boost::math::complement( _dist, 0.0 ) ) ); /* { _p0 = 0.0; boost::math::negative_binomial_distribution<> _dist( _r0, _p0 ); std::printf( ""\n"" "" r = %g\n"" "" p = %g\n\n"", _r0, _p0 ); std::printf( "" Quantile(%g;upperTail=false) = %g\n"", 0.32, boost::math::quantile( _dist, 0.32 ) ); } */ return EXIT_SUCCESS; } }}} ",Feature Requests,closed,To Be Determined,math,Boost Development Trunk,Problem,fixed,,