npstat is hosted by Hepforge, IPPP Durham
NPStat  5.10.0
weightedLocalQuantileRegression1D.hh
Go to the documentation of this file.
1 #ifndef NPSI_WEIGHTEDLOCALQUANTILEREGRESSION1D_HH_
2 #define NPSI_WEIGHTEDLOCALQUANTILEREGRESSION1D_HH_
3 
4 /*!
5 // \file weightedLocalQuantileRegression1D.hh
6 //
7 // \brief Local quantile regression with single predictor for weighted points
8 //
9 // Authors: C. Cowden, I. Volobouev
10 //
11 // June 2013
12 */
13 
14 #include <vector>
15 
16 #include "npstat/nm/Triple.hh"
17 
18 namespace npsi {
19  /**
20  // High-level driver functions for performing local 1-d quantile
21  // regression fits for weighted points using Minuit2 as a minimization
22  // engine
23  //
24  // The arguments are as follows:
25  //
26  // inputPoints -- are the points for which the regression should be
27  // performed. Predictor is the first member of the triple,
28  // response is the second, and weight is the third. As
29  // a side effect of this function, the input points will
30  // be sorted in the increasing order of the predictor.
31  // This is why the vector of input points is non-const.
32  //
33  // symbetaPower -- the power parameter for "SymmetricBeta1D". 3 and 4
34  // are good values to try.
35  //
36  // bandwidthInCDFSpace -- Approximate fraction of sample points which
37  // will participate in each fit. Due to robustness
38  // requirements (obtaining limited bandwidth in
39  // coordinate space), the bandwidth in the CDF space
40  // must be less than 0.5 (and, of course, positive).
41  //
42  // polyDegree -- this defines the degree of the polynomial that
43  // will be fitted to the quantile curve. It does not
44  // make much sense to go beyond 3 here.
45  //
46  // cdfValue -- which quantile to use in the regression
47  //
48  // xmin, xmax -- the result will be calculated between xmin and xmax
49  // in equidistant steps
50  //
51  // result -- array where the result will be stored
52  //
53  // nResultPoints -- number of coordinate points to use to build the
54  // result. The interval (xmin, xmax) will be split
55  // into "nResultPoints" bins. The coordinates at which
56  // the fits are performed are taken from the middle
57  // of those bins (as in a histogram). Naturally, array
58  // "result" must have at least "nResultPoints" elements.
59  //
60  // verbose -- this switch can be turned on for debugging purposes
61  */
62  template<class Numeric1, class Numeric2>
64  std::vector<npstat::Triple<Numeric1,Numeric1,double> > inputPoints,
65  double symbetaPower, double bandwidthInCDFSpace,
66  unsigned polyDegree, double cdfValue, double xmin, double xmax,
67  Numeric2* result, unsigned nResultPoints, bool verbose=false);
68 }
69 
70 #include "npstat/interfaces/weightedLocalQuantileRegression1D.icc"
71 
72 #endif // NPSI_WEIGHTEDLOCALQUANTILEREGRESSION1D_HH_
A simple analogue of std::pair with three components instead of two.
Definition: fitCompositeJohnson.hh:16
void weightedLocalQuantileRegression1D(std::vector< npstat::Triple< Numeric1, Numeric1, double > > inputPoints, double symbetaPower, double bandwidthInCDFSpace, unsigned polyDegree, double cdfValue, double xmin, double xmax, Numeric2 *result, unsigned nResultPoints, bool verbose=false)
Definition: Triple.hh:18