#include <statdist.h>
Inheritance diagram for matvec::ExponentialDist:

Definition at line 293 of file statdist.h.
Public Methods | |
| ExponentialDist (const double t=1.0) | |
| ExponentialDist (const ExponentialDist &u) | |
| void | display (void) const |
| double | parameter (const int k) const |
| void | parameter (const int k, const double x) |
| void | reset (const double a, const double t) |
| void | sample (Vector< double > &x) const |
| void | sample (doubleMatrix &x) const |
| double | sample (void) const |
| Vector< double > | sample (unsigned n) const |
| doubleMatrix | sample (unsigned m, unsigned n) const |
| double | mean (void) const |
| double | variance (void) const |
| double | pdf (const double x) const |
| double | cdf (const double x) const |
| double | mgf (const double t) const |
| double | inv (const double p) const |
| virtual const std::string | name (void) const |
| virtual double | nonct (const double cv, const double p) |
Protected Attributes | |
| double | alpha_value |
| double | theta_value |
| std::string | distname |
|
|
Definition at line 296 of file statdist.h. References matvec::StatDistBase::distname.
|
|
|
Definition at line 297 of file statdist.h. References matvec::StatDistBase::distname, and matvec::GammaDist::theta_value.
|
|
|
Implements matvec::StatDistBase. Definition at line 820 of file statdist.cpp. References matvec::GammaDist::alpha_value, matvec::gammln(), and matvec::GammaDist::theta_value.
00822 {
00823 if (x < 0.0) throw exception("GammaDist::pdf(): bad arg");
00824 double pr = 0.0;
|
|
|
Reimplemented from matvec::GammaDist. Definition at line 299 of file statdist.h. References matvec::StatDistBase::distname, and matvec::GammaDist::theta_value.
00299 {std::cout << "\t" << distname << "("
00300 << theta_value << ")\n"; return;}
|
|
|
Implements matvec::StatDistBase. Definition at line 832 of file statdist.cpp.
00836 {
00837 if (x < 0.0) throw exception("GammaDist::cdf(): bad arg");
00838 return Gamma_cdf(x,alpha_value,theta_value);
00839 }
00840
00841 double GammaDist::mgf(const double t) const
00842 {
00843 if (t >= 1.0/theta_value) throw exception("GammaDist:mgf(t): t must be < 1/theta");
00844 return 1.0/pow(1.0-theta_value*t,alpha_value);
00845 }
00846
00847 double GammaDist::inv(const double p) const
00848 {
00849 if (p<0.0 || p>1.0) throw exception("GammaDist::inv(): bad arg, value between [0,1] expected");
00850 double eps = 1.0e-6;
00851 double bot = 0.0;
00852 double top = alpha_value*theta_value + 1200.0;
00853 double p2,ppt;
|
|
|
Implements matvec::StatDistBase. Definition at line 279 of file statdist.h. References matvec::GammaDist::alpha_value, and matvec::GammaDist::theta_value.
00279 {return alpha_value*theta_value;}
|
|
|
Implements matvec::StatDistBase. Definition at line 826 of file statdist.cpp.
00826 {
00827 pr = -a;
00828 }
00829 else {
00830 pr = (alpha_value-1.0)*std::log(x) - x/theta_value - a;
|
|
|
Definition at line 45 of file statdistbase.h. References matvec::StatDistBase::distname.
00045 {return distname;}
|
|
||||||||||||
|
Definition at line 58 of file statdistbase.h.
00058 {std::cerr << "error\n"; return 0.0;}
|
|
||||||||||||
|
Reimplemented from matvec::GammaDist. Definition at line 924 of file statdist.cpp. References matvec::GammaDist::theta_value.
00926 {
00927 throw exception("GammaDist::parameter(%d): bad arg1");
00928 }
|
|
|
Reimplemented from matvec::GammaDist. Definition at line 918 of file statdist.cpp. References matvec::GammaDist::alpha_value.
00918 {
00919 if (x <= 0.0) throw exception("GammaDist::parameter(): bad arg2, they must > 0");
00920 if (k == 1) {
00921 alpha_value = x;
00922 }
|
|
|
The random variable X has a gamma distribution if its probability density function is defined by
Implements matvec::StatDistBase. Definition at line 806 of file statdist.cpp. References matvec::GammaDist::alpha_value, and matvec::GammaDist::theta_value.
00809 {
00810 if (a <= 0.0 || t <= 0.0) throw exception("GammaDist::reset(): bad args, they mustbe > 0");
00811 alpha_value = a;
00812 theta_value = t;
00813 }
00814
00815 /*!
00816 The random variable <EM>X</EM> has a gamma distribution if its probability density function is defined by
00817 \f[
00818 f(x) = \frac{1}{\Gamma(\alpha)\theta^\alpha} x^{\alpha-1} e^{-x/\theta}, \quad 0 \leq x < \infty.
|
|
||||||||||||
|
Definition at line 795 of file statdist.cpp. Referenced by matvec::GammaDist::GammaDist().
00795 : bad arg2, nonnegative expected");
00796 }
00797 else {
00798 nc_value = x;
00799 }
00800 }
|
|
||||||||||||
|
Implements matvec::StatDistBase. Definition at line 880 of file statdist.cpp. References matvec::GammaDist::alpha_value, and matvec::GammaDist::theta_value.
00882 {
00883 bot = x[i]; top = &bot[nc];
00884 while (bot < top ) *bot++ = theta_value*sgamma(alpha_value);
00885 }
|
|
|
Implements matvec::StatDistBase. Definition at line 873 of file statdist.cpp. References matvec::GammaDist::alpha_value, and matvec::GammaDist::theta_value.
00878 {
|
|
|
Implements matvec::StatDistBase. Definition at line 276 of file statdist.h. References matvec::GammaDist::alpha_value, matvec::sgamma(), and matvec::GammaDist::theta_value. Referenced by matvec::GammaDist::parameter().
00276 {return theta_value*sgamma(alpha_value);}
|
|
|
Implements matvec::StatDistBase. Definition at line 862 of file statdist.cpp.
00863 {
00864 break;
00865 }
00866 }
00867 return ppt;
00868 }
00869
00870 void GammaDist::sample(Vector<double>& x) const
00871 {
|
|
|
Implements matvec::StatDistBase. Definition at line 855 of file statdist.cpp. References matvec::GammaDist::alpha_value, and matvec::GammaDist::theta_value.
00857 {
00858 bot = ppt;
00859 }
00860 else if (p2 > p) {
|
|
|
Implements matvec::StatDistBase. Definition at line 280 of file statdist.h. References matvec::GammaDist::alpha_value, and matvec::GammaDist::theta_value.
00280 {return alpha_value*theta_value*theta_value;}
|
|
|
Definition at line 264 of file statdist.h. Referenced by matvec::GammaDist::cdf(), matvec::GammaDist::display(), matvec::GammaDist::mean(), parameter(), matvec::GammaDist::parameter(), matvec::GammaDist::pdf(), matvec::GammaDist::sample(), and matvec::GammaDist::variance(). |
|
|
|
Definition at line 264 of file statdist.h. Referenced by matvec::GammaDist::cdf(), display(), matvec::GammaDist::display(), ExponentialDist(), matvec::GammaDist::mean(), parameter(), matvec::GammaDist::parameter(), matvec::GammaDist::pdf(), matvec::GammaDist::sample(), and matvec::GammaDist::variance(). |
1.2.16