Next: Non-Parametric Cdf, categorical variable
Up: Basic classes
Previous: Gaussian Cdf
Subsections
Non_param_cdf<lower_tail_interpol,middle_interpol,upper_tail,T>
A non-parametric cdf of variable Z is a cdf F defined by a discrete set of points
zi, F(zi),
i = 1,..., n,
z1...zn.
As Z is a continuous variable, the points
zi, F(zi) must be interpolated in order to associate a probability to any z-value different from the zi's. Call z an outcome of Z different from zi (for all i).
If z < z1 or z > zn, a function of type lower_tail_interpol or upper_tail_interpol is used to interpolate the cdf and compute F(z). If
z1zzn a function of type middle_interpol is used. Similarly, when computing the inverse of the cdf for a probability p, if p < p1 or p > pn, a function of type lower_tail_interpol or upper_tail_interpol is used to interpolate the cdf and compute F-1(p). If
p1ppn a function of type middle_interpol is used.
In header file <cdf.h>
lower_tail_interpol |
|
the type of the function used to interpolate the lower tail of the distribution |
upper_tail_interpol |
|
the type of the function used to interpolate the upper tail of the distribution |
middle_interpol |
|
the type of the function used to interpolate between two known values zj and zj + 1 |
T |
|
the cdf's type value. It is double by default. |
Non-Parametric Cdf
- lower_tail_interpol and upper_tail_interpol: an object that models these concepts must have two member functions:
- double p(value_type z1, double p1, value_type z)
returns the interpolated value of p given the point (z1,p1) and new value z.
- value_type z(value_type z1, double p1, double p)
returns the interpolated value of z given the point (z1,p1) and new value p.
- middle_interpol : an object that models these concepts must have two member functions:
-
double p(value_type z1, double p1,
value_type z2, double p2, value_type z)
returns the interpolated value of p given the point (z1,p1) and new value z.
-
double z(value_type z1, double p1,
value_type z2, double p2, double p)
returns the interpolated value of z given the point (z1,p1) and new value p.
-
Non_param_cdf::value_type
The type of variable Z. It is set to be double by default.
-
Non_param_cdf::z_iterator
An iterator to the sequence of values
z1...zn. It is a model of Forward Iterator.
-
Non_param_cdf::p_iterator
An iterator to the sequence of values
p1...pn. It is a model of Forward Iterator.
-
Non_param_cdf::Non_param_cdf()
Default constructor.
-
Non_param_cdf::Non_param_cdf(z_iterator z_begin, z_iterator z_end)
Creates a non-parametric cdf. The z-values
z1,..., zn are read from range [z_begin,z_end). The corresponding probabilities are not initialized. The range [z_begin,z_end) must be sorted, in increasing order.
-
Non_param_cdf::Non_param_cdf(z_iterator z_begin, z_iterator z_end,
p_iterator p_begin)
Creates a non-parametric cdf.
The z-values
z1,..., zn are read from range [z_begin,z_end), and the corresponding probabilities are read starting from p_begin. The range [z_begin,z_end) must be sorted, in increasing order.
-
void Non_param_cdf::resize(unsigned int m)
Allocates space for a discretization of size m.
-
void Non_param_cdf::z_set(z_iterator z_begin, z_iterator z_end)
Redefines the discretization
z1,..., zn to the values in range [z_begin,z_end). The range [z_begin,z_end) must be sorted, in increasing order.
The new discretization can contain more values than the previous one. The probability values corresponding to the former discretization are invalidated.
-
z_iterator Non_param_cdf::z_begin()
Returns a model of Forward Iterator to the first element of the discretization
z1,..., zn.
-
z_iterator Non_param_cdf::z_end()
Returns a model of Forward Iterator to the end of the discretization
z1,..., zn.
-
p_iterator Non_param_cdf::p_begin()
Returns a model of Forward Iterator to the first element of the set of probabilities
p1,..., pn.
-
p_iterator Non_param_cdf::p_end()
Returns a model of Forward Iterator to the end of the set of probabilities
p1,..., pn.
-
double Non_param_cdf::prob(value_type z)
Returns the probability
Prob(Zz).
-
value_type Non_param_cdf::inverse(double p)
Returns the value z such that
p = Prob(Zz).
Next: Non-Parametric Cdf, categorical variable
Up: Basic classes
Previous: Gaussian Cdf
nicolas
2002-05-07