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

Definition at line 450 of file statdist.h.
Public Methods | |
| GeometricDist (const double p) | |
| GeometricDist (const GeometricDist &u) | |
| void | display (void) const |
| void | reset (const double p) |
| 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 | pdf (const long k) const |
| double | cdf (const long k) const |
| double | mgf (const double t) const |
| double | inv (const double p) const |
| double | parameter (const int k) const |
| void | parameter (const int k, const double x) |
| virtual const std::string | name (void) const |
| virtual double | nonct (const double cv, const double p) |
Protected Attributes | |
| double | p_value |
| std::string | distname |
|
|
Definition at line 454 of file statdist.h. References matvec::StatDistBase::distname, and reset().
|
|
|
Definition at line 455 of file statdist.h. References matvec::StatDistBase::distname, and reset().
00455 :StatDistBase() 00456 {distname="GeometricDist"; reset(u.p_value);} |
|
|
Definition at line 1371 of file statdist.cpp. References p_value.
01375 {
01376 if (p <= 0.0 && p >= 1.0) throw exception ("GeometricDist::reset(): bad arg");
01377 p_value = p;
01378 }
|
|
|
Implements matvec::StatDistBase. Definition at line 469 of file statdist.h.
00469 {return cdf(long(x));}
|
|
|
Implements matvec::StatDistBase. Definition at line 458 of file statdist.h. References matvec::StatDistBase::distname, and p_value.
|
|
|
Implements matvec::StatDistBase. Definition at line 473 of file statdist.h.
00474 {std::cerr << " GeometricDist::inv(): not available\n"; return p;}
|
|
|
Implements matvec::StatDistBase. Definition at line 466 of file statdist.h. References p_value.
|
|
|
Implements matvec::StatDistBase. Definition at line 1380 of file statdist.cpp. |
|
|
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;}
|
|
||||||||||||
|
Implements matvec::StatDistBase. Definition at line 1426 of file statdist.cpp. References sample().
01428 {
01429 Vector<double> x(n);
01430 sample(x);
01431 return x;
|
|
|
Implements matvec::StatDistBase. Definition at line 1420 of file statdist.cpp. References matvec::ranf().
01421 {
01422 bot = x[i]; top = &bot[nc];
01423 while (bot < top ) *bot++ = std::floor(std::log(ranf())/tmp);
01424 }
|
|
|
The random variable X has a geometric distribution if its probability density function (pdf) is defined by
Definition at line 1365 of file statdist.cpp.
01367 {
01368 throw exception("PoissonDist::parameter(): bad arg1");
01369 }
|
|
|
Implements matvec::StatDistBase. Definition at line 468 of file statdist.h.
00468 {return pdf(long(x));}
|
|
|
Definition at line 1355 of file statdist.cpp. Referenced by GeometricDist().
01358 {
01359 if (k==1) {
|
|
||||||||||||
|
Implements matvec::StatDistBase. Definition at line 1413 of file statdist.cpp.
01416 {
01417 double tmp = std::log(1.0-p_value);
01418 int nr = x.num_rows();
|
|
|
Implements matvec::StatDistBase. Definition at line 1406 of file statdist.cpp. References matvec::Vector< T >::begin(), matvec::Vector< T >::end(), p_value, and matvec::ranf().
01408 {
01409 double tmp = std::log(1.0-p_value);
01410 double *bot = x.begin();
01411 double *top = x.end();
|
|
|
Implements matvec::StatDistBase. Definition at line 463 of file statdist.h. References p_value, and matvec::ranf(). Referenced by parameter().
|
|
|
Implements matvec::StatDistBase. Definition at line 1394 of file statdist.cpp. References p_value.
01395 {Geometric(p)), over x=0,1,...k}
01396 // *******************************************************
01397 if (k < 0L) throw exception("GeometricDist::cd): arg must be non-negative");
01398 return pow(1.0-p_value,static_cast<double>(k+1));
01399 }
01400
01401 double GeometricDist::mgf(const double t) const
01402 {
01403 if (t >= -std::log(1.0-p_value)) throw exception ("GeometricDist::mgf(): bad arg");
01404 return p_value/(1.0-(1.0-p_value)*std::exp(t));
|
|
|
Implements matvec::StatDistBase. Definition at line 1386 of file statdist.cpp. References p_value.
|
|
|
Implements matvec::StatDistBase. Definition at line 467 of file statdist.h. References p_value.
|
|
|
|
Definition at line 452 of file statdist.h. Referenced by cdf(), display(), mean(), sample(), and variance(). |
1.2.16