]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | [section:dist_ref Statistical Distributions Reference] |
2 | ||
3 | [include non_members.qbk] | |
4 | ||
5 | [section:dists Distributions] | |
6 | ||
7 | [include arcsine.qbk] | |
8 | [include bernoulli.qbk] | |
9 | [include beta.qbk] | |
10 | [include binomial.qbk] | |
11 | [include cauchy.qbk] | |
12 | [include chi_squared.qbk] | |
13 | [include exponential.qbk] | |
14 | [include extreme_value.qbk] | |
15 | [include fisher.qbk] | |
16 | [include gamma.qbk] | |
17 | [include geometric.qbk] | |
18 | [include hyperexponential.qbk] | |
19 | [include hypergeometric.qbk] | |
20 | [include inverse_chi_squared.qbk] | |
21 | [include inverse_gamma.qbk] | |
22 | [include inverse_gaussian.qbk] | |
23 | [include laplace.qbk] | |
24 | [include logistic.qbk] | |
25 | [include lognormal.qbk] | |
26 | [include negative_binomial.qbk] | |
27 | [include nc_beta.qbk] | |
28 | [include nc_chi_squared.qbk] | |
29 | [include nc_f.qbk] | |
30 | [include nc_t.qbk] | |
31 | [include normal.qbk] | |
32 | [include pareto.qbk] | |
33 | [include poisson.qbk] | |
34 | [include rayleigh.qbk] | |
35 | [include skew_normal.qbk] | |
36 | [include students_t.qbk] | |
37 | [include triangular.qbk] | |
38 | [include uniform.qbk] | |
39 | [include weibull.qbk] | |
40 | ||
41 | [endsect] [/section:dists Distributions] | |
42 | ||
43 | [include dist_algorithms.qbk] | |
44 | ||
45 | [endsect] [/section:dist_ref Statistical Distributions and Functions Reference] | |
46 | ||
47 | ||
48 | [section:future Extras/Future Directions] | |
49 | ||
50 | [h4 Adding Additional Location and Scale Parameters] | |
51 | ||
52 | In some modelling applications we require a distribution | |
53 | with a specific location and scale: | |
54 | often this equates to a specific mean and standard deviation, although for many | |
55 | distributions the relationship between these properties and the location and | |
56 | scale parameters are non-trivial. See | |
57 | [@http://www.itl.nist.gov/div898/handbook/eda/section3/eda364.htm http://www.itl.nist.gov/div898/handbook/eda/section3/eda364.htm] | |
58 | for more information. | |
59 | ||
60 | The obvious way to handle this is via an adapter template: | |
61 | ||
62 | template <class Dist> | |
63 | class scaled_distribution | |
64 | { | |
65 | scaled_distribution( | |
66 | const Dist dist, | |
67 | typename Dist::value_type location, | |
68 | typename Dist::value_type scale = 0); | |
69 | }; | |
70 | ||
71 | Which would then have its own set of overloads for the non-member accessor functions. | |
72 | ||
73 | [h4 An "any_distribution" class] | |
74 | ||
75 | It is easy to add a distribution object that virtualises | |
76 | the actual type of the distribution, and can therefore hold "any" object | |
77 | that conforms to the conceptual requirements of a distribution: | |
78 | ||
79 | template <class RealType> | |
80 | class any_distribution | |
81 | { | |
82 | public: | |
83 | template <class Distribution> | |
84 | any_distribution(const Distribution& d); | |
85 | }; | |
86 | ||
87 | // Get the cdf of the underlying distribution: | |
88 | template <class RealType> | |
89 | RealType cdf(const any_distribution<RealType>& d, RealType x); | |
90 | // etc.... | |
91 | ||
92 | Such a class would facilitate the writing of non-template code that can | |
93 | function with any distribution type. | |
94 | ||
95 | The [@http://sourceforge.net/projects/distexplorer/ Statistical Distribution Explorer] | |
96 | utility for Windows is a usage example. | |
97 | ||
98 | It's not clear yet whether there is a compelling use case though. | |
99 | Possibly tests for goodness of fit might | |
100 | provide such a use case: this needs more investigation. | |
101 | ||
102 | [h4 Higher Level Hypothesis Tests] | |
103 | ||
104 | Higher-level tests roughly corresponding to the | |
105 | [@http://documents.wolfram.com/mathematica/Add-onsLinks/StandardPackages/Statistics/HypothesisTests.html Mathematica Hypothesis Tests] | |
106 | package could be added reasonably easily, for example: | |
107 | ||
108 | template <class InputIterator> | |
109 | typename std::iterator_traits<InputIterator>::value_type | |
110 | test_equal_mean( | |
111 | InputIterator a, | |
112 | InputIterator b, | |
113 | typename std::iterator_traits<InputIterator>::value_type expected_mean); | |
114 | ||
115 | Returns the probability that the data in the sequence \[a,b) has the mean | |
116 | /expected_mean/. | |
117 | ||
118 | [h4 Integration With Statistical Accumulators] | |
119 | ||
120 | [@http://boost-sandbox.sourceforge.net/libs/accumulators/doc/html/index.html | |
121 | Eric Niebler's accumulator framework] - also work in progress - provides the means | |
122 | to calculate various statistical properties from experimental data. There is an | |
123 | opportunity to integrate the statistical tests with this framework at some later date: | |
124 | ||
125 | // Define an accumulator, all required statistics to calculate the test | |
126 | // are calculated automatically: | |
127 | accumulator_set<double, features<tag::test_expected_mean> > acc(expected_mean=4); | |
128 | // Pass our data to the accumulator: | |
129 | acc = std::for_each(mydata.begin(), mydata.end(), acc); | |
130 | // Extract the result: | |
131 | double p = probability(acc); | |
132 | ||
133 | [endsect] [/section:future Extras Future Directions] | |
134 | ||
135 | [/ dist_reference.qbk | |
136 | Copyright 2006, 2010 John Maddock and Paul A. Bristow. | |
137 | Distributed under the Boost Software License, Version 1.0. | |
138 | (See accompanying file LICENSE_1_0.txt or copy at | |
139 | http://www.boost.org/LICENSE_1_0.txt). | |
140 | ] | |
141 | ||
142 | ||
143 | ||
144 | ||
145 | ||
146 | ||
147 |