C++ main module for mmsd Package  1.0
STAT_InverseNormalDistribution.h
Go to the documentation of this file.
1 #ifndef STAT_InverseNormalDistribution_H
2 #define STAT_InverseNormalDistribution_H
3 
4 #include "STAT_Distribution.h"
5 #include <boost/math/distributions/inverse_gaussian.hpp>
6 
9 
19  // ATTRIBUTES
20 
21 private:
22 
23 
24 
25  // ASSOCIATIONS
26  boost::math::inverse_gaussian_distribution<tReal> *mDistribution;
27  SP::STAT_NormalDistribution mNormal;
28  SP::STAT_UniformDistribution mUniform;
29 
30 protected:
31  // METHODS
32 
33  // CONSTRUCTORS
34 
37 
38 
39 
40  // DESTRUCTORS
41 
42 
45  virtual ~STAT_InverseNormalDistribution(void);
46 
47 
48 
49 public:
50  //----------------
51  // NEW constructors
52  // ---------------
53 
56  inline static SP::STAT_InverseNormalDistribution New(const tReal& mean,
57  const tReal& sd) {
58  SP::STAT_InverseNormalDistribution p(new STAT_InverseNormalDistribution(),
60  p->setProperties(mean,sd);
61  p->setThis(p);
62  return p;
63  }
66  inline static SP::STAT_InverseNormalDistribution New() {
67  return New(1,1);
68  }
71  virtual SP::STAT_Distribution NewInstance() const {
72  return New();
73  }
74 
75 
78  virtual void copy(const STAT_Distribution& d) {
79  tReal m=d.mean();
80  tReal v=d.variance();
81  if (v!=0)
82  setProperties(m,m*m*m/v);
83  }
84  // --------------------
85  // ATTRIBUTES setting
86  // --------------------
87 
88  void setProperties(const tReal& mean,
89  const tReal& scale);
90 
91  // -----------------------
92  // USUAL Functions
93  // ------------------------
94 
95 
98  virtual tReal pdf(const tReal& x) const;
99 
102  virtual tReal cdf(const tReal& x) const;
103 
106  virtual tReal cdfc(const tReal& x) const;
107 
110  virtual void range(tReal& xmin,tReal& xmax) const;
111 
114  virtual tReal mean() const;
115 
118  virtual tReal variance() const;
121  virtual tReal standardDeviation() const;
122 
126  virtual tReal random() const;
127 
128 
131  virtual void computeSample(const int& n,CORE_RealArray& sample) const;
132 
133 
134 
135 
136 
137 protected:
138  /* \brief return the growth rate of the distribution
139  * @param adjust: is true rescale the parameters of the distribution suach as its growth rate is rho
140  *
141  */
142  virtual tReal computeGrowthRate(const tReal& v,
143  const tBoolean& adjust,
144  const tReal& rho);
145 
146 
147 
148 };
149 
150 #endif
void setProperties(const tReal &mean, const tReal &scale)
Definition: STAT_InverseNormalDistribution.cpp:25
virtual void copy(const STAT_Distribution &d)
copy the distribution
Definition: STAT_InverseNormalDistribution.h:78
virtual tReal standardDeviation() const
compute the standard deviation
Definition: STAT_InverseNormalDistribution.cpp:72
virtual tReal cdfc(const tReal &x) const
compute the cumulative distribution complement function at x point
Definition: STAT_InverseNormalDistribution.cpp:57
virtual tReal computeGrowthRate()
return the growth rate of the distribution such that Esperance(E(exp(-z*X)))=0.5
Definition: STAT_Distribution.h:133
virtual tReal pdf(const tReal &x) const
compute the probability density function at x point
Definition: STAT_InverseNormalDistribution.cpp:46
This class is the class to describes Normal distribution.
Definition: STAT_NormalDistribution.h:17
virtual tReal mean() const =0
compute the mean
#define tBoolean
Definition: types.h:48
virtual tReal random() const
random return a random numbers in range
Definition: STAT_InverseNormalDistribution.cpp:77
virtual void computeSample(const int &n, CORE_RealArray &sample) const
compute a sample of size n
Definition: STAT_InverseNormalDistribution.cpp:85
This class is the class to describes Uniform distribution.
Definition: STAT_UniformDistribution.h:18
virtual ~STAT_InverseNormalDistribution(void)
destroy an object.
Definition: STAT_InverseNormalDistribution.cpp:17
DEFINE_SPTR(STAT_NormalDistribution)
virtual tReal mean() const
compute the mean
Definition: STAT_InverseNormalDistribution.cpp:62
static SP::STAT_InverseNormalDistribution New(const tReal &mean, const tReal &sd)
create a InverseNormal distibution
Definition: STAT_InverseNormalDistribution.h:56
virtual SP::STAT_Distribution NewInstance() const
create a new instance of the distribution
Definition: STAT_InverseNormalDistribution.h:71
this class describes an array
Definition: CORE_Array.h:18
STAT_InverseNormalDistribution()
create an object
Definition: STAT_InverseNormalDistribution.cpp:6
This class is the class to describes general distribution.
Definition: STAT_Distribution.h:25
static SP::STAT_InverseNormalDistribution New()
create a InverseNormal distibution
Definition: STAT_InverseNormalDistribution.h:66
This class is the class to describes InverseNormal distribution.
Definition: STAT_InverseNormalDistribution.h:17
virtual tReal variance() const =0
compute the variance
virtual void range(tReal &xmin, tReal &xmax) const
compute the range of the distribution
Definition: STAT_InverseNormalDistribution.cpp:38
#define tReal
Definition: types.h:18
virtual tReal cdf(const tReal &x) const
compute the cumulative distribution function at x point
Definition: STAT_InverseNormalDistribution.cpp:51
virtual tReal variance() const
compute the variance
Definition: STAT_InverseNormalDistribution.cpp:67
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:106