]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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) | |
6 | ||
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! | |
9 | ||
10 | //[policy_ref_snip5 | |
11 | ||
12 | #include <boost/math/distributions/negative_binomial.hpp> | |
13 | using boost::math::negative_binomial_distribution; | |
14 | ||
15 | using namespace boost::math::policies; | |
16 | ||
17 | typedef negative_binomial_distribution< | |
18 | double, | |
19 | policy<discrete_quantile<real> > | |
20 | > dist_type; | |
21 | ||
22 | // Lower 5% quantile: | |
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)); | |
26 | ||
27 | //] //[/policy_ref_snip5] | |
28 | ||
29 | #include <iostream> | |
30 | using std::cout; using std::endl; | |
31 | ||
32 | int main() | |
33 | { | |
34 | cout << "quantile(dist_type(20, 0.3), 0.05) = " << x | |
35 | << "\nquantile(complement(dist_type(20, 0.3), 0.05) = " << y << endl; | |
36 | } | |
37 | ||
38 | /* | |
39 | ||
40 | Output: | |
41 | quantile(dist_type(20, 0.3), 0.05) = 27.3898 | |
42 | quantile(complement(dist_type(20, 0.3), 0.05) = 68.1584 | |
43 | ||
44 | */ | |
45 |