Isis 3.0 Object Programmers' Reference |
Home |
This class is used to approximate cumulative probibility distributions of a stream of observations without storing the observations or having any apriori knowlege of the range of the data. More...
#include <StatCumProbDistDynCalc.h>
Public Member Functions | |
StatCumProbDistDynCalc (unsigned int nodes=20) | |
Construtor sets up the class to start recieving data. | |
void | addObs (double obs) |
Values for the estimated quantile positions are update as observations are added. | |
double | cumProb (double value) |
Provides the cumulative probility, that is, the proportion of the distribution that is less than or equal to the value given (according the current estimate of cumulative probility function). | |
double | value (double cumProb) |
Provides the value of the variable that has the given cumulative probility (according the current estimate of cumulative probility function) | |
double | max () |
Returns the maximum observation so far included in the dynamic calculation. | |
double | min () |
Returns the maximum observation so far included in the dynamic calculation. | |
void | initialize (unsigned int nodes=20) |
Inializer, resets the class to start its dynamic calculation anew. | |
Private Attributes | |
unsigned int | m_nCells |
The number of cells or bins that being used to model the probility density function. | |
unsigned int | m_nQuan |
The number of quantiles being used to model the probility density function This is one more than the number of cells. | |
std::vector< double > | m_quan |
the quantiles being modeled begining at 0 and going to 1 | |
std::vector< double > | m_nIdeal |
The ideal number of observations that should be less than or equal to the value of the corresponding quantiles, note this is dynamically changing as observations are added. | |
std::vector< int > | m_n |
The actual number of observations that are less than or equal to the value of the corresponding quantiles, note this is dynamically changing as observations are added. | |
std::vector< double > | m_q |
The calculated values of the quantiles, note this is dynamically changing as observations are added. | |
unsigned int | m_nObs |
The number of observations, note this is dynamically changing as observations are added. | |
This class is used to approximate cumulative probibility distributions of a stream of observations without storing the observations or having any apriori knowlege of the range of the data.
This class is used to approximate cumulative probibility distributions of a stream of observations without storing the observations or having any apriori knowlege of the range of the data. "The P^2 algorithim for dynamic calculation of Quantiles and Histograms without storing Obswervations" Raj Jain and Imrich Chlamtac, Communication of the ACM Oct 1985, is used. A finite set of evenly spaced qunatiles are dynamically updated as more observations are added. The number of quantiles is set in the construtor, and has a defualt of 20. After sufficient data points (number of observations >> number of quantiles to track) the class provides cumulative probility as a function of value or vice versa. Thus it can be used to build histograms or find any number of discrete quantiles. Specific points on the function are evaluated by fiting piece wise parabolic functions to the three nearest adjacent nodes. Preformance of algorithim is within a few percent error for most of the distribution (given sufficient data), however care should be taken if the points to be querried are within 200/(numberOfQuantiles-1)% of the edges of the distributions. Near the edges the individual quantiles are still well calculated, but the piece wise parabolic function doesn't always fit the tails well, so interpolated points are more unrealiable. Developement note: Two possible ways to improve the fitting of the tails: caculate more densely place quantiles near the edges, use exponential regression (or some other alternative–perhaps adaptively selected).
Definition at line 49 of file StatCumProbDistDynCalc.h.
Isis::StatCumProbDistDynCalc::StatCumProbDistDynCalc | ( | unsigned int | nodes = 20 | ) |
Construtor sets up the class to start recieving data.
[in] | unsigned | int nodes – this is the number of specific evenly spaced quantiles that will be dynamically tracked |
Definition at line 35 of file StatCumProbDistDynCalc.cpp.
References initialize().
void Isis::StatCumProbDistDynCalc::addObs | ( | double | obs | ) |
Values for the estimated quantile positions are update as observations are added.
[in] | double | obs – the individual observation to be used to dynamically readjust the cumulative probility distribution |
Definition at line 293 of file StatCumProbDistDynCalc.cpp.
References m_n, m_nCells, m_nIdeal, m_nObs, m_nQuan, m_q, and m_quan.
double Isis::StatCumProbDistDynCalc::cumProb | ( | double | value | ) |
Provides the cumulative probility, that is, the proportion of the distribution that is less than or equal to the value given (according the current estimate of cumulative probility function).
[in] | double | – value, the upper bound of values considered in the cumlative probility calculation |
IsisProgrammerError | – StatCumDistDynCalc will return no data until there has been at least m_nQuan observations added |
Definition at line 211 of file StatCumProbDistDynCalc.cpp.
References _FILEINFO_, m_nCells, m_nObs, m_nQuan, m_q, m_quan, Isis::IException::Programmer, and value().
Referenced by value().
void Isis::StatCumProbDistDynCalc::initialize | ( | unsigned int | nodes = 20 | ) |
Inializer, resets the class to start its dynamic calculation anew.
[in] | unsigned | int nodes – this is the number of specific evenly spaced quantiles that will be dynamically tracked |
Definition at line 44 of file StatCumProbDistDynCalc.cpp.
References m_n, m_nCells, m_nIdeal, m_nObs, m_nQuan, m_q, and m_quan.
Referenced by Isis::BundleAdjust::maximumLikelihoodSetup(), and StatCumProbDistDynCalc().
double Isis::StatCumProbDistDynCalc::max | ( | ) |
Returns the maximum observation so far included in the dynamic calculation.
IsisProgrammerError | – StatCumDistDynCalc will return no data until there has been at least m_nQuan observations added |
Definition at line 77 of file StatCumProbDistDynCalc.cpp.
References _FILEINFO_, m_nCells, m_nObs, m_nQuan, m_q, and Isis::IException::Programmer.
double Isis::StatCumProbDistDynCalc::min | ( | ) |
Returns the maximum observation so far included in the dynamic calculation.
IsisProgrammerError | – StatCumDistDynCalc will return no data until there has been at least m_nQuan observations added |
Definition at line 95 of file StatCumProbDistDynCalc.cpp.
References _FILEINFO_, m_nObs, m_nQuan, m_q, and Isis::IException::Programmer.
double Isis::StatCumProbDistDynCalc::value | ( | double | cumProb | ) |
Provides the value of the variable that has the given cumulative probility (according the current estimate of cumulative probility function)
[in] | double | – cumlative probability domain [0.1] |
IsisProgrammerError | – StatCumDistDynCalc will return no data until there has been at least m_nQuan observations added |
IsisProgrammerError | – Argument to StatCumProbDistDynCalc::value(double cumProb) must be on the domain [0.1] |
Definition at line 115 of file StatCumProbDistDynCalc.cpp.
References _FILEINFO_, cumProb(), m_nCells, m_nObs, m_nQuan, m_q, m_quan, and Isis::IException::Programmer.
Referenced by cumProb().
|
private |
The actual number of observations that are less than or equal to the value of the corresponding quantiles, note this is dynamically changing as observations are added.
Definition at line 92 of file StatCumProbDistDynCalc.h.
Referenced by addObs(), and initialize().
|
private |
The number of cells or bins that being used to model the probility density function.
Definition at line 68 of file StatCumProbDistDynCalc.h.
Referenced by addObs(), cumProb(), initialize(), max(), and value().
|
private |
The ideal number of observations that should be less than or equal to the value of the corresponding quantiles, note this is dynamically changing as observations are added.
Definition at line 86 of file StatCumProbDistDynCalc.h.
Referenced by addObs(), and initialize().
|
private |
The number of observations, note this is dynamically changing as observations are added.
Definition at line 104 of file StatCumProbDistDynCalc.h.
Referenced by addObs(), cumProb(), initialize(), max(), min(), and value().
|
private |
The number of quantiles being used to model the probility density function This is one more than the number of cells.
Definition at line 74 of file StatCumProbDistDynCalc.h.
Referenced by addObs(), cumProb(), initialize(), max(), min(), and value().
|
private |
The calculated values of the quantiles, note this is dynamically changing as observations are added.
Definition at line 98 of file StatCumProbDistDynCalc.h.
Referenced by addObs(), cumProb(), initialize(), max(), min(), and value().
|
private |
the quantiles being modeled begining at 0 and going to 1
Definition at line 80 of file StatCumProbDistDynCalc.h.
Referenced by addObs(), cumProb(), initialize(), and value().