npstat is hosted by Hepforge, IPPP Durham
NPStat  5.10.0
SineGOFTest1D.hh
Go to the documentation of this file.
1 #ifndef NPSTAT_SINEGOFTEST1D_HH_
2 #define NPSTAT_SINEGOFTEST1D_HH_
3 
4 /*!
5 // \file SineGOFTest1D.hh
6 //
7 // \brief Goodness-of-fit test based on the sine expansion of the
8 // difference between the empirical cdf and the cdf of the null
9 //
10 // Note that the sine expansion of this difference is equivalent to
11 // the cosine expansion of the empirical comparison density
12 //
13 // Author: I. Volobouev
14 //
15 // November 2022
16 */
17 
19 
20 namespace npstat {
22  {
23  public:
24  // The mask, if provided, should contain nSineTerms elements.
25  // Put some number in the mask in order to discard the
26  // corresponding eigenvector and put 0 there to keep it.
27  // The sine terms (sin(Pi n x)) numbering in the mask
28  // is shifted: n = 1 corresponds to mask[0], n = 2 corresponds
29  // to mask[1], etc.
30  inline SineGOFTest1D(const AbsDistribution1D& distro,
31  const unsigned nSineTerms,
32  const unsigned char* mask=0,
33  const unsigned lenMask=0)
34  : AbsSmoothGOFTest1D(distro, nSineTerms, mask, lenMask) {}
35 
36  inline SineGOFTest1D(const AbsDistribution1D& distro,
37  const std::vector<int>& mask)
38  : AbsSmoothGOFTest1D(distro, mask) {}
39 
40  inline virtual ~SineGOFTest1D() {}
41 
42  inline virtual std::string shortName() const
43  {return testNameWithMask("Sine");}
44 
45  virtual unsigned normalizedDeviations(
46  const double* data, unsigned long sz,
47  bool isDataSorted,
48  double* deviations, unsigned lenDeviations) const;
49 
50  virtual unsigned normalizedDeviations(
51  const float* data, unsigned long sz,
52  bool isDataSorted,
53  double* deviations, unsigned lenDeviations) const;
54 
55  private:
56  template<typename Numeric>
57  unsigned normalizedDeviationsHelper(
58  const Numeric* data, unsigned long lenData,
59  double* deviations) const;
60  };
61 }
62 
63 #include "npstat/stat/SineGOFTest1D.icc"
64 
65 #endif // NPSTAT_SINEGOFTEST1D_HH_
Base class for smooth tests for goodness-of-fit.
Definition: AbsSmoothGOFTest1D.hh:20
Definition: SineGOFTest1D.hh:22
virtual unsigned normalizedDeviations(const double *data, unsigned long sz, bool isDataSorted, double *deviations, unsigned lenDeviations) const
Definition: AbsArrayProjector.hh:14
Definition: AbsDistribution1D.hh:31