npstat is hosted by Hepforge, IPPP Durham
NPStat  5.10.0
RatioOfNormals.hh
Go to the documentation of this file.
1 #ifndef NPSTAT_RATIOOFNORMALS_HH_
2 #define NPSTAT_RATIOOFNORMALS_HH_
3 
4 /*!
5 // \file RatioOfNormals.hh
6 //
7 // \brief Density of the ratio of two correlated normal random variables
8 //
9 // Author: I. Volobouev
10 //
11 // November 2013
12 */
13 
15 
16 namespace npstat {
17  /**
18  // Formulae used in the implementation of this class come from
19  // D.V. Hinkley, "On the ratio of two correlated normal random variables",
20  // Biometrika, v. 56, p. 635 (1969).
21  */
23  {
24  public:
25  /**
26  // The constructor arguments are as follows:
27  //
28  // "mu1" and "s1" are the mean and the standard deviation of the
29  // normal random variable in the numerator.
30  //
31  // "mu2" and "s2" are the mean and the standard deviation of the
32  // normal random variable in the denominator.
33  //
34  // "rho" is the correlation coefficient.
35  */
36  RatioOfNormals(double mu1, double s1, double mu2, double s2, double rho);
37 
38  inline virtual ~RatioOfNormals() {}
39 
40  inline virtual RatioOfNormals* clone() const
41  {return new RatioOfNormals(*this);}
42 
43  virtual double density(double x) const;
44  virtual double cdf(double x) const;
45  virtual double exceedance(double x) const;
46  virtual double quantile(double x) const;
47  virtual unsigned random(AbsRandomGenerator& g,
48  double* generatedRandom) const;
49 
50  inline virtual gs::ClassId classId() const {return gs::ClassId(*this);}
51  virtual bool write(std::ostream&) const;
52 
53  static inline const char* classname() {return "npstat::RatioOfNormals";}
54  static inline unsigned version() {return 1;}
55  static RatioOfNormals* read(const gs::ClassId& id, std::istream&);
56 
57  protected:
58  virtual bool isEqual(const AbsDistribution1D& r) const;
59 
60  private:
62 
63  double mu1_;
64  double s1_;
65  double mu2_;
66  double s2_;
67  double rho_;
68  double support_;
69  };
70 }
71 
72 #endif // NPSTAT_RATIOOFNORMALS_HH_
Interface definition for 1-d continuous statistical distributions.
Definition: RatioOfNormals.hh:23
virtual gs::ClassId classId() const
Definition: RatioOfNormals.hh:50
virtual double quantile(double x) const
virtual double cdf(double x) const
RatioOfNormals(double mu1, double s1, double mu2, double s2, double rho)
virtual double density(double x) const
virtual unsigned random(AbsRandomGenerator &g, double *generatedRandom) const
virtual double exceedance(double x) const
virtual bool isEqual(const AbsDistribution1D &r) const
virtual RatioOfNormals * clone() const
Definition: RatioOfNormals.hh:40
Definition: AbsArrayProjector.hh:14
Definition: AbsDistribution1D.hh:31
Definition: AbsRandomGenerator.hh:27