npstat is hosted by Hepforge, IPPP Durham
NPStat  5.10.0
lorpeSmooth1D.hh
Go to the documentation of this file.
1 #ifndef NPSTAT_LORPESMOOTH1D_HH_
2 #define NPSTAT_LORPESMOOTH1D_HH_
3 
4 /*!
5 // \file lorpeSmooth1D.hh
6 //
7 // \brief Simple driver function for 1-d density estimation by LOrPE
8 //
9 // Author: I. Volobouev
10 //
11 // March 2013
12 */
13 
14 #include "npstat/stat/HistoND.hh"
16 
17 namespace npstat {
18  /**
19  // Simple driver function for density estimation from histograms using
20  // LOrPE. It is assumed that the histogram fill counts correspond to
21  // the actual number of points in the sample. The function arguments are:
22  //
23  // m -- Choose the kernel from the symmetric beta family
24  // proportional to (1 - x^2)^m. If m is negative,
25  // Gaussian kernel will be used, truncated at +- 12 sigma.
26  //
27  // maxDegree -- Degree of the LOrPE polynomial. Interpretation of
28  // non-integer arguments is by the "continuousDegreeTaper"
29  // function.
30  //
31  // result -- Buffer for storing the results. This can coincide
32  // with the input histogram bin contents (so that they
33  // will be changed in-place -- this makes sense only if
34  // the histogram contents are real).
35  //
36  // lenResult -- Length of the "result" buffer.
37  //
38  // bm -- Method used to handle LOrPE weight at the boundary.
39  //
40  // bandwidthFactor -- The plugin bandwidth estimate will be multiplied
41  // by this factor to make the actual kernel bandwidth.
42  //
43  // The function returns the actual bandwidth used.
44  */
45  template<typename Numeric, typename NumOut>
47  const HistoND<Numeric>& histo, double effectiveSampleSize,
48  int m, double maxDegree, NumOut* result, unsigned lenResult,
49  const BoundaryHandling& bm, double bandwidthFactor=1.0);
50 
51  template<typename Numeric, typename NumOut>
52  inline double lorpeSmooth1D(
53  const HistoND<Numeric>& histo,
54  int m, double maxDegree, NumOut* result, unsigned lenResult,
55  const BoundaryHandling& bm, double bandwidthFactor=1.0)
56  {
57  const double n = histo.nFillsInRange();
58  return weightedLorpeSmooth1D(histo, n, m, maxDegree, result,
59  lenResult, bm, bandwidthFactor);
60  }
61 }
62 
63 #include "npstat/stat/lorpeSmooth1D.icc"
64 
65 #endif // NPSTAT_LORPESMOOTH1D_HH_
API for LOrPE boundary handling methods.
Arbitrary-dimensional histogram template.
Definition: BoundaryHandling.hh:21
Definition: HistoND.hh:46
unsigned long nFillsInRange() const
Definition: HistoND.hh:232
Definition: AbsArrayProjector.hh:14
double weightedLorpeSmooth1D(const HistoND< Numeric > &histo, double effectiveSampleSize, int m, double maxDegree, NumOut *result, unsigned lenResult, const BoundaryHandling &bm, double bandwidthFactor=1.0)