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

Definition at line 416 of file statdist.h.
Public Methods | |
| PoissonDist (const double l) | |
| PoissonDist (const PoissonDist &u) | |
| void | display (void) const |
| void | reset (const double l) |
| 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 | lambda_value |
| std::string | distname |
|
|
Definition at line 420 of file statdist.h. References matvec::StatDistBase::distname, and reset().
|
|
|
Definition at line 421 of file statdist.h. References matvec::StatDistBase::distname, and reset().
00421 :StatDistBase() 00422 {distname="PoissonDist";reset(u.lambda_value);} |
|
|
Definition at line 1282 of file statdist.cpp. References lambda_value.
01284 {
01285 if (l < 0.0) throw exception("PoissonDist::reset(): bad arg, nonnegative expected");
01286 lambda_value = l;
01287 }
01288
01289 /*!
01290 The random variable <EM>X</EM> has a Poisson distribution if its probability density function (pdf) is defined by
01291 \f[
01292 f(x) = \frac{\lambda^xe^{-\lambda}}{x!}, \quad x = 0,1,2,\ldots,
01293 \f]
01294 */
01295 double PoissonDist::pdf(const long k) const
01296 {
01297 if (k < 0L) throw exception ("PoissonDist::pdf(): out of range");
01298 return std::pow(lambda_value,static_cast<double>(k))/(std::exp(lambda_value)*factrl(k));
|
|
|
Implements matvec::StatDistBase. Definition at line 435 of file statdist.h.
00435 {return cdf(long(x));}
|
|
|
Implements matvec::StatDistBase. Definition at line 424 of file statdist.h. References matvec::StatDistBase::distname, and lambda_value.
00424 {std::cout << "\t" << distname << "("
00425 << lambda_value << ")\n"; return;}
|
|
|
Implements matvec::StatDistBase. Definition at line 440 of file statdist.h.
00441 {std::cerr << " PoissonDist::inv(): not available\n"; return p;}
|
|
|
Implements matvec::StatDistBase. Definition at line 432 of file statdist.h. References lambda_value.
00432 {return lambda_value;}
|
|
|
Implements matvec::StatDistBase. Definition at line 438 of file statdist.h. References lambda_value.
00439 {return std::exp(lambda_value*(std::exp(t)-1.0));}
|
|
|
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 1338 of file statdist.cpp. References sample().
01338 {
01339 Vector<double> x(n);
01340 sample(x);
01341 return x;
01342 }
01343
01344 doubleMatrix PoissonDist::sample(unsigned m,unsigned n) const
01345 {
01346 doubleMatrix x(m,n);
01347 sample(x);
01348 return x;
01349 }
01350
01351 double PoissonDist::parameter(const int k) const
|
|
|
Implements matvec::StatDistBase. Definition at line 1332 of file statdist.cpp. References lambda_value. |
|
|
The random variable X has a Poisson distribution if its probability density function (pdf) is defined by
Definition at line 1276 of file statdist.cpp.
01276 {
01277 throw exception("BinomialDist::parameter(): bad arg1");
01278 }
01279 }
01280
|
|
|
Implements matvec::StatDistBase. Definition at line 434 of file statdist.h.
00434 {return pdf(long(x));}
|
|
|
Definition at line 1266 of file statdist.cpp. References matvec::BinomialDist::n_value. Referenced by PoissonDist().
01268 {
01269 if (x >= 0.0 && x <= 1.0) {
01270 p_value = x;
|
|
||||||||||||
|
Implements matvec::StatDistBase. Definition at line 1325 of file statdist.cpp. References matvec::Matrix< double >::num_cols(), and matvec::Matrix< double >::num_rows().
01327 {
01328 int nr = x.num_rows();
01329 int nc = x.num_cols();
01330 double *bot,*top;
|
|
|
Implements matvec::StatDistBase. Definition at line 1318 of file statdist.cpp. References matvec::Vector< T >::begin(), matvec::Vector< T >::end(), matvec::ignpoi(), and lambda_value.
01320 {
01321 double *bot = x.begin();
01322 double *top = x.end();
01323 while (bot < top ) *bot++ = static_cast<double>(ignpoi(lambda_value));
|
|
|
Implements matvec::StatDistBase. Definition at line 429 of file statdist.h. References matvec::ignpoi(), and lambda_value. Referenced by parameter().
00429 {return double(ignpoi(lambda_value));}
|
|
|
Implements matvec::StatDistBase. Definition at line 1307 of file statdist.cpp. References matvec::gammin(), and lambda_value.
01307 {
01308 retval = 1.0 - gammin(lambda_value,k+1);
01309 }
01310 else if (k == 0L) {
01311 retval = std::exp(-lambda_value);
01312 }
01313 else {
01314 retval = 0.0;
01315 }
01316 return retval;
|
|
|
Implements matvec::StatDistBase. Definition at line 1300 of file statdist.cpp.
01302 {
01303 // ********************************************************
01304 // Pr(X <= k) = sum{Poisson(lambda)), over x=0,1,...k}
01305 // *******************************************************
|
|
|
Implements matvec::StatDistBase. Definition at line 433 of file statdist.h. References lambda_value.
00433 {return lambda_value;}
|
|
|
|
Definition at line 418 of file statdist.h. Referenced by cdf(), display(), mean(), mgf(), parameter(), sample(), and variance(). |
1.2.16