npstat is hosted by Hepforge, IPPP Durham
NPStat  5.10.0
minuitFitJohnsonCurves.hh
Go to the documentation of this file.
1 #ifndef NPSI_MINUITFITJOHNSONCURVES_HH_
2 #define NPSI_MINUITFITJOHNSONCURVES_HH_
3 
4 /*!
5 // \file minuitFitJohnsonCurves.hh
6 //
7 // \brief Binned fit of Johnson curves by maximum likelihood
8 //
9 // Author: I. Volobouev
10 //
11 // September 2010
12 */
13 
14 #include "npstat/stat/HistoND.hh"
15 
16 namespace npsi {
17  /**
18  // Fitting Johnson system of curves to histogrammed data
19  // using the maximum likelihood method
20  //
21  */
22  class JohnsonFit
23  {
24  public:
25  /**
26  // In the constructor, arguments are as follows:
27  //
28  // "histo" is the 1-d histogram to fit.
29  //
30  // "qmin" and "qmax" are the quantiles which define the
31  // fitted region. For example, set them to 0.05 and 0.95,
32  // respectively, if you would like to fit central 90% of
33  // the distribution.
34  //
35  // "minlog" limits the contribution of any single bin
36  // into the log-likelihood from below. No bin can contribute
37  // less then "minlog" even if the value of the fitted density
38  // for that bin is 0. Typically, this parameter should be set
39  // to a negative number with a reasonably large magnitude,
40  // on the order of log(DBL_MIN).
41  //
42  */
43  template <class Numeric,class Axis>
45  double qmin, double qmax, double minlog);
46 
47  /**
48  // Check fit convergence. If the fit did not converge,
49  // the results will be set by simple array-based calculations.
50  */
51  inline bool converged() const {return converged_;}
52 
53  //@{
54  /** Examine fitted value */
55  inline double mean() const {return mean_;}
56  inline double sigma() const {return sigma_;}
57  inline double skewness() const {return skew_;}
58  inline double kurtosis() const {return kurt_;}
59  //@}
60 
61  //@{
62  /**
63  // Figure out the region fitted. The minimum bin is included
64  // and the maximum bin is excluded from the fit.
65  */
66  inline unsigned minFitBin() const {return minFitBin_;}
67  inline unsigned maxFitBin() const {return maxFitBin_;}
68  //@}
69 
70  private:
71  double mean_;
72  double sigma_;
73  double skew_;
74  double kurt_;
75  unsigned minFitBin_;
76  unsigned maxFitBin_;
77  bool converged_;
78  };
79 }
80 
81 #include "npstat/interfaces/minuitFitJohnsonCurves.icc"
82 
83 #endif // NPSI_MINUITFITJOHNSONCURVES_HH_
Arbitrary-dimensional histogram template.
Definition: minuitFitJohnsonCurves.hh:23
bool converged() const
Definition: minuitFitJohnsonCurves.hh:51
double mean() const
Definition: minuitFitJohnsonCurves.hh:55
JohnsonFit(const npstat::HistoND< Numeric, Axis > &histo, double qmin, double qmax, double minlog)
unsigned minFitBin() const
Definition: minuitFitJohnsonCurves.hh:66
Definition: HistoND.hh:46
Definition: fitCompositeJohnson.hh:16