1 // Copyright John Maddock 2007.
2 // Copyright Paul A. Bristow 2010.
3 // Use, modification and distribution are subject to the
4 // Boost Software License, Version 1.0. (See accompanying file
5 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 // Note that this file contains quickbook mark-up as well as code
8 // and comments, don't change any of the special comment mark-ups!
12 #include <boost/math/distributions/negative_binomial.hpp>
13 using boost::math::negative_binomial_distribution
;
15 using namespace boost::math::policies
;
17 typedef negative_binomial_distribution
<
19 policy
<discrete_quantile
<real
> >
23 double x
= quantile(dist_type(20, 0.3), 0.05);
24 // Upper 95% quantile:
25 double y
= quantile(complement(dist_type(20, 0.3), 0.05));
27 //] //[/policy_ref_snip5]
30 using std::cout
; using std::endl
;
34 cout
<< "quantile(dist_type(20, 0.3), 0.05) = " << x
35 << "\nquantile(complement(dist_type(20, 0.3), 0.05) = " << y
<< endl
;
41 quantile(dist_type(20, 0.3), 0.05) = 27.3898
42 quantile(complement(dist_type(20, 0.3), 0.05) = 68.1584