npstat is hosted by Hepforge, IPPP Durham
NPStat  5.10.0
PearsonsChiSquared.hh
Go to the documentation of this file.
1 #ifndef NPSTAT_PEARSONSCHISQUARED_HH_
2 #define NPSTAT_PEARSONSCHISQUARED_HH_
3 
4 /*!
5 // \file PearsonsChiSquared.hh
6 //
7 // \brief Pearson's chi-squared test
8 //
9 // Author: I. Volobouev
10 //
11 // May 2014
12 */
13 
14 #include <string>
15 
17 
18 namespace npstat {
20  {
21  public:
22  /**
23  // Constructor arguments are as follows:
24  //
25  // minCountToUse -- Only bins with reference counts
26  // above this cutoff (or bins with
27  // sum of reference and data above
28  // this cutoff in case the parameter
29  // "forUncertaintyUseReferenceOnly"
30  // is false) will be used to calculate
31  // the chi-square.
32  //
33  // subtractForNDoFCalculation -- The number to be subtracted
34  // from the number of bins passing
35  // the cut in order to calculate the
36  // number of degrees of freedom. This
37  // can be useful in case the reference
38  // distribution was fitted from data
39  // or normalized to the data.
40  //
41  // forUncertaintyUseReferenceOnly -- If true, only reference counts
42  // will be used to estimate variance
43  // of bin difference (otherwise the
44  // variance is set to the sum of data
45  // and reference).
46  */
47  PearsonsChiSquared(double minCountToUse,
48  double subtractForNDoFCalculation,
49  bool forUncertaintyUseReferenceOnly);
50 
51  inline virtual ~PearsonsChiSquared() {}
52 
53  virtual const char* name() const;
54 
55  private:
56  virtual void compareD(const double* data, const double* reference,
57  unsigned len, double* distance,
58  double* pvalue) const;
59 
60  mutable std::string name_;
61  double minCount_;
62  double subtractForNDoF_;
63  bool referenceOnly_;
64  };
65 }
66 
67 #endif // NPSTAT_PEARSONSCHISQUARED_HH_
Interface definition for comparing binned samples and/or densities.
Definition: AbsBinnedComparison1D.hh:22
Definition: PearsonsChiSquared.hh:20
virtual const char * name() const
PearsonsChiSquared(double minCountToUse, double subtractForNDoFCalculation, bool forUncertaintyUseReferenceOnly)
Definition: AbsArrayProjector.hh:14