#include <ProbDistr.h>
Inheritance diagram for ProbDistr::

Public Methods | |
| ProbDistr (const ProbDistr_prm &prm) | |
| virtual real | f (real x)=0 |
| virtual real | F (real x)=0 |
| virtual real | Finv (real p)=0 |
| virtual real | expec ()=0 |
| virtual real | stdev ()=0 |
Public Attributes | |
| Handle(ProbDistr_prm) | pm |
Protected Methods | |
| bool | ok (int n) |
NAME: ProbDistr - general base class for probability distributions
DESCRIPTION:
The class enables, together with class "ProbDistr_prm", a unified interface to all probability distribution classes. In a typically subclass, implementing a particular distribution, the density and cumulative distribution functions are static. This base class defines coexisting virtual versions of the density, cumulative and inverse cumulative functions. The user can hence choose the most convenient implementation, either static versions (which behaves like standard C functions and can be represented by simple function pointers) or the virtual versions (which enables object-oriented programming and the use of a ""general"" distribution class, provided that a "ProbDistr_prm" object is supplied at construction time).
In subclasses, the static distribution functions usually reflect a ""normalized"" distribution, with as few parameters as possible. The virtual versions, on the ohter hand, make use of the internal "ProbDistr_prm" object and allows all legal parameters for a distribution to be set. For example, in class "NormalDistr", the static versions return values from the standardized normal distribution (with zero mean and unit variance), while the virtual distribution functions return a normal variate with expectation and standard deviation accoring to "pm(1)" and "pm(2)" in the internal "ProbDistr_prm" object "pm".
A "VecSimplest(Handle(ProbDistr))" class is available for the case where one has a collection of random variables with different distributions.
|
|
|
|
|
returns the value of the cumulative distribution function. Reimplemented in UniformDistr, NormalDistr, LogNormalDistr, and DetermDistr. |
|
|
returns the value of the inverse of the cumulative distribution function. Reimplemented in UniformDistr, NormalDistr, LogNormalDistr, and DetermDistr. |
|
|
returns the expectation (mean). Reimplemented in UniformDistr, NormalDistr, LogNormalDistr, and DetermDistr. |
|
|
returns the value of the density function. Reimplemented in UniformDistr, NormalDistr, LogNormalDistr, and DetermDistr. |
|
|
|
|
|
returns the standard deviation. Reimplemented in UniformDistr, NormalDistr, LogNormalDistr, and DetermDistr. |
|
|
|