npstat is hosted by Hepforge, IPPP Durham
NPStat  5.10.0
JohnsonKDESmoother.hh
Go to the documentation of this file.
1 #ifndef NPSTAT_JOHNSONKDESMOOTHER_HH_
2 #define NPSTAT_JOHNSONKDESMOOTHER_HH_
3 
4 /*!
5 // \file JohnsonKDESmoother.hh
6 //
7 // \brief Adaptive bandwidth KDE for 1-d unimodal densities
8 //
9 // Author: I. Volobouev
10 //
11 // September 2010
12 */
13 
15 
16 namespace npstat {
17  /**
18  // 1-d KDE implementation with adaptive bandwidth. The adaptive bandwidth
19  // for each data point is set in inverse proportion to the square root of
20  // the pilot density at that point. The pilot density bandwidth is
21  // calculated with Johnson system densities used as reference distributions
22  // for AMISE optimization. The fit of Johnson densities to the data sample
23  // is done by matching sample moments to the curve moments.
24  */
26  {
27  public:
28  /**
29  // Constructor arguments are as follows:
30  //
31  // nbins, xmin, xmax -- Parameters for the histogram which will
32  // be accumulated using the data sample to be
33  // smoothed.
34  //
35  // symbetaPower -- Power of the symmetric beta kernel to use.
36  // Gaussian kernel will be used in case
37  // this parameter is negative. This parameter
38  // must not exceed 10.
39  //
40  // bwFactor -- Fudge factor for the plugin bandwidth used
41  // for the pilot and final density estimates.
42  //
43  // label -- Label for the axis. Useful in case
44  // smoothing results are stored for inspection.
45  */
46  JohnsonKDESmoother(unsigned nbins, double xmin, double xmax,
47  int symbetaPower, double bwFactor=1.0,
48  const char* label = 0);
49 
50  inline virtual ~JohnsonKDESmoother() {}
51 
52  //@{
53  /** Simple inspector of object properties */
54  inline int symbetaPower() const {return symbetaPower_;}
55  inline double bwFactor() const {return bwFactor_;}
56  //@}
57 
58  private:
59  virtual void smoothHisto(HistoND<double>& histo,
60  double effectiveSampleSize,
61  double* bandwidthUsed,
62  bool isSampleWeighted);
63  double bwFactor_;
64  int symbetaPower_;
65 
66  // Useful workspace (1-d arrays with number of elements equal to nbins)
67  ArrayND<double> scan_;
68  ArrayND<double> pilot_;
69  };
70 }
71 
72 #endif // NPSTAT_JOHNSONKDESMOOTHER_HH_
Interface definition for 1-d nonparametric density estimation.
Definition: AbsMarginalSmootherBase.hh:29
Definition: JohnsonKDESmoother.hh:26
JohnsonKDESmoother(unsigned nbins, double xmin, double xmax, int symbetaPower, double bwFactor=1.0, const char *label=0)
int symbetaPower() const
Definition: JohnsonKDESmoother.hh:54
Definition: AbsArrayProjector.hh:14