Isis Developer Reference
Isis::StatCumProbDistDynCalc Class Reference

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>

Inheritance diagram for Isis::StatCumProbDistDynCalc:
Inheritance graph
Collaboration diagram for Isis::StatCumProbDistDynCalc:
Collaboration graph

Public Member Functions

 StatCumProbDistDynCalc (unsigned int nodes=20, QObject *parent=0)
 Construtor sets up the class to start recieving data.
 
 StatCumProbDistDynCalc (QXmlStreamReader *xmlReader, QObject *parent=0)
 
void readStatistics (QXmlStreamReader *xmlReader)
 
 StatCumProbDistDynCalc (const StatCumProbDistDynCalc &other)
 
 ~StatCumProbDistDynCalc ()
 Destroys StatCumProbDistDynCalc object.
 
StatCumProbDistDynCalcoperator= (const StatCumProbDistDynCalc &other)
 
void initialize ()
 Inializer, resets the class to start its dynamic calculation anew.
 
void setQuantiles (unsigned int nodes)
 
void validate ()
 
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 save (QXmlStreamWriter &stream, const Project *project) const
 
QDataStream & write (QDataStream &stream) const
 
QDataStream & read (QDataStream &stream)
 

Public Attributes

unsigned int m_numberCells
 The number of cells or histogram bins that are being used to model the probility density function.
 
unsigned int m_numberQuantiles
 The number of quantiles being used to model the probility density function.
 
unsigned int m_numberObservations
 The number of observations, note this is dynamically changing as observations are added.
 
QList< double > m_quantiles
 The target quantiles being modeled, between 0 and 1.
 
QList< double > m_observationValues
 The calculated values of the quantiles, note this is dynamically changing as observations are added.
 
QList< double > m_idealNumObsBelowQuantile
 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.
 
QList< int > m_numObsBelowQuantile
 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.
 

Detailed Description

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 Observations" 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).

Author
2012-03-23 Orrin Thomas

Constructor & Destructor Documentation

◆ StatCumProbDistDynCalc() [1/3]

Isis::StatCumProbDistDynCalc::StatCumProbDistDynCalc ( unsigned int nodes = 20,
QObject * parent = 0 )

Construtor sets up the class to start recieving data.

Parameters
[in]unsignedint nodes – this is the number of specific evenly spaced quantiles that will be dynamically tracked

References initialize(), and setQuantiles().

◆ StatCumProbDistDynCalc() [2/3]

Isis::StatCumProbDistDynCalc::StatCumProbDistDynCalc ( QXmlStreamReader * xmlReader,
QObject * parent = 0 )

References initialize(), and readStatistics().

◆ StatCumProbDistDynCalc() [3/3]

Isis::StatCumProbDistDynCalc::StatCumProbDistDynCalc ( const StatCumProbDistDynCalc & other)

◆ ~StatCumProbDistDynCalc()

Isis::StatCumProbDistDynCalc::~StatCumProbDistDynCalc ( )

Destroys StatCumProbDistDynCalc object.

Member Function Documentation

◆ addObs()

void Isis::StatCumProbDistDynCalc::addObs ( double obs)

Values for the estimated quantile positions are update as observations are added.

Parameters
[in]doubleobs – the individual observation to be used to dynamically readjust the cumulative probility distribution

References m_idealNumObsBelowQuantile, m_numberCells, m_numberObservations, m_numberQuantiles, m_numObsBelowQuantile, m_observationValues, and m_quantiles.

Referenced by Isis::BundleResults::addProbabilityDistributionObservation(), and Isis::BundleResults::addResidualsProbabilityDistributionObservation().

◆ cumProb()

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).

Parameters
[in]value– the upper bound of values considered in the cumlative probility calculation
Returns
double – 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).
Exceptions
IsisProgrammerErrorStatCumProbDistDynCalc will return no data until there has been at least m_numberQuantiles observations added

References m_numberCells, m_numberQuantiles, m_observationValues, m_quantiles, validate(), and value().

Referenced by value().

◆ initialize()

void Isis::StatCumProbDistDynCalc::initialize ( )

Inializer, resets the class to start its dynamic calculation anew.

Parameters
[in]unsignedint nodes – this is the number of specific evenly spaced quantiles that will be dynamically tracked

References m_idealNumObsBelowQuantile, m_numberCells, m_numberObservations, m_numberQuantiles, m_numObsBelowQuantile, m_observationValues, and m_quantiles.

Referenced by setQuantiles(), StatCumProbDistDynCalc(), and StatCumProbDistDynCalc().

◆ max()

double Isis::StatCumProbDistDynCalc::max ( )

Returns the maximum observation so far included in the dynamic calculation.

Returns
double – the maximum observation so far included in the dynamic calculation
Exceptions
IsisProgrammerErrorStatCumProbDistDynCalc will return no data until the number of observations added matches the number of quantiles (i.e. number of nodes) selected.

References m_numberCells, m_observationValues, and validate().

Referenced by Isis::BundleSolutionInfo::outputHeader().

◆ min()

double Isis::StatCumProbDistDynCalc::min ( )

Returns the maximum observation so far included in the dynamic calculation.

Returns
double – the maximum observation so far included in the dynamic calculation
Exceptions
IsisProgrammerErrorStatCumProbDistDynCalc will return no data until the number of observations added matches the number of quantiles (i.e. number of nodes) selected.

References m_observationValues, and validate().

Referenced by Isis::BundleSolutionInfo::outputHeader().

◆ operator=()

◆ read()

QDataStream & Isis::StatCumProbDistDynCalc::read ( QDataStream & stream)

◆ readStatistics()

◆ save()

void Isis::StatCumProbDistDynCalc::save ( QXmlStreamWriter & stream,
const Project * project ) const

◆ setQuantiles()

◆ validate()

void Isis::StatCumProbDistDynCalc::validate ( )

◆ value()

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)

Parameters
[in]cumProb– cumlative probability, domain [0, 1]
Returns
double – the vaule of the variable that has the cumulative probility (according the current estimate of cumulative probility function)
Exceptions
IsisProgrammerErrorStatCumProbDistDynCalc will return no data until the number of observations added matches the number of quantiles (i.e. number of nodes) selected.
IsisProgrammerError– Invalid cumulative probability passed in to StatCumProbDistDynCalc::value(double cumProb). Must be on the domain [0, 1].

References _FILEINFO_, cumProb(), m_numberCells, m_numberQuantiles, m_observationValues, m_quantiles, Isis::IException::Programmer, Isis::toString(), and validate().

Referenced by cumProb(), Isis::BundleSolutionInfo::outputHeader(), and Isis::BundleResults::printMaximumLikelihoodTierInformation().

◆ write()

QDataStream & Isis::StatCumProbDistDynCalc::write ( QDataStream & stream) const

Member Data Documentation

◆ m_idealNumObsBelowQuantile

QList<double> Isis::StatCumProbDistDynCalc::m_idealNumObsBelowQuantile

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.

Referenced by addObs(), initialize(), operator=(), read(), readStatistics(), save(), setQuantiles(), and write().

◆ m_numberCells

unsigned int Isis::StatCumProbDistDynCalc::m_numberCells

The number of cells or histogram bins that are being used to model the probility density function.

Referenced by addObs(), cumProb(), initialize(), max(), operator=(), read(), readStatistics(), save(), setQuantiles(), validate(), value(), and write().

◆ m_numberObservations

unsigned int Isis::StatCumProbDistDynCalc::m_numberObservations

The number of observations, note this is dynamically changing as observations are added.

Referenced by addObs(), initialize(), operator=(), read(), readStatistics(), save(), validate(), and write().

◆ m_numberQuantiles

unsigned int Isis::StatCumProbDistDynCalc::m_numberQuantiles

The number of quantiles being used to model the probility density function.

This value is one more than the number of cells, (i.e. m_numberQuantiles=m_cells+1).

Referenced by addObs(), cumProb(), initialize(), operator=(), read(), readStatistics(), save(), setQuantiles(), validate(), value(), and write().

◆ m_numObsBelowQuantile

QList<int> Isis::StatCumProbDistDynCalc::m_numObsBelowQuantile

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.

Referenced by addObs(), initialize(), operator=(), read(), readStatistics(), save(), setQuantiles(), and write().

◆ m_observationValues

QList<double> Isis::StatCumProbDistDynCalc::m_observationValues

The calculated values of the quantiles, note this is dynamically changing as observations are added.

Referenced by addObs(), cumProb(), initialize(), max(), min(), operator=(), read(), readStatistics(), save(), value(), and write().

◆ m_quantiles

QList<double> Isis::StatCumProbDistDynCalc::m_quantiles

The target quantiles being modeled, between 0 and 1.

Referenced by addObs(), cumProb(), initialize(), operator=(), read(), readStatistics(), save(), setQuantiles(), value(), and write().


The documentation for this class was generated from the following files: