npstat is hosted by Hepforge, IPPP Durham
NPStat  5.10.0
weightedCopulaHisto.hh
Go to the documentation of this file.
1 #ifndef NPSTAT_WEIGHTEDCOPULAHISTO_HH_
2 #define NPSTAT_WEIGHTEDCOPULAHISTO_HH_
3 
4 /*!
5 // \file weightedCopulaHisto.hh
6 //
7 // \brief Build copula histograms out of sets of weighted points
8 //
9 // Author: I. Volobouev
10 //
11 // June 2015
12 */
13 
14 #include <vector>
15 #include <utility>
16 
17 #include "npstat/stat/HistoND.hh"
18 
19 namespace npstat {
20  /**
21  // Function for building copula density out of sets of points by ordering
22  // the points and remembering the order in each dimension. The histogram
23  // is filled with point weights. All histogram axes should normally have
24  // minimum at 0.0 and maximum at 1.0. This function assumes (but does not
25  // check) that the argument histogram is defined on the unit multivariate
26  // cube. The histogram will be reset before it is filled from the provided
27  // data. The histogram contents will not be normalized after the
28  // histogram is filled. If you want normalized result, call the
29  // "convertHistoToDensity" function (declared in the HistoND header).
30  //
31  // Note that ties are not resolved by this function (i.e., their mutual
32  // order is arbitrary).
33  //
34  // The function arguments are as follows:
35  //
36  // data -- Input data. The pointers (the first element of the pair)
37  // assume to point to objects which have a subscripting
38  // operator. The second element of the pair is the weight.
39  //
40  // dimsToUse -- Point dimensions to use for building the copula. This
41  // array should have at least "nDimsToUse" elements.
42  //
43  // nDimsToUse -- Number of copula dimensions.
44  //
45  // result -- The histogram to fill.
46  //
47  // useFillC -- Specifies whether "fillC" histogram method should be
48  // used instead of the "fill" method.
49  //
50  // The function returns the Kish's effective sample size.
51  */
52  template <class Point, class Histo>
54  const std::vector<std::pair<const Point*, double> >& data,
55  const unsigned* dimsToUse, const unsigned nDimsToUse,
56  Histo* result, bool useFillC = false);
57 
58  /**
59  // A version of "weightedCopulaHisto" with a slightly different interface.
60  // Here, point weights are given in a separate vector. It is assumed
61  // that the element weights[i] corresponds to the point data[i].
62  */
63  template <class Point, class Histo>
65  const std::vector<Point>& data,
66  const std::vector<double>& weights,
67  const unsigned* dimsToUse, const unsigned nDimsToUse,
68  Histo* result, bool useFillC = false);
69 }
70 
71 #include "npstat/stat/weightedCopulaHisto.icc"
72 
73 #endif // NPSTAT_WEIGHTEDCOPULAHISTO_HH_
Arbitrary-dimensional histogram template.
Definition: AbsArrayProjector.hh:14
double weightedCopulaHisto_2(const std::vector< Point > &data, const std::vector< double > &weights, const unsigned *dimsToUse, const unsigned nDimsToUse, Histo *result, bool useFillC=false)
double weightedCopulaHisto(const std::vector< std::pair< const Point *, double > > &data, const unsigned *dimsToUse, const unsigned nDimsToUse, Histo *result, bool useFillC=false)