Isis Developer Reference
Isis::MultivariateStatistics Class Reference

Container of multivariate statistics. More...

#include <MultivariateStatistics.h>

Collaboration diagram for Isis::MultivariateStatistics:
Collaboration graph

Public Member Functions

 MultivariateStatistics ()
 Constructs a Multivariate Statistics object with accumulators and counters set to zero. More...
 
 MultivariateStatistics (const PvlObject &inStats)
 Constructs a MulitvariateStatistics object from a PvlObject. More...
 
 ~MultivariateStatistics ()
 Destructs a MultivariateStatistics object. More...
 
void Reset ()
 Resets all accumulators to zero. More...
 
void AddData (const double *x, const double *y, const unsigned int count)
 Add two arrays of doubles to the accumulators and counters. More...
 
void AddData (double x, double y, unsigned int count=1)
 Add an x,y value to the accumulators and counters count times. More...
 
void RemoveData (const double *x, const double *y, const unsigned int count)
 Remove an array of doubles from the accumulators and counters. More...
 
Isis::Statistics X () const
 Returns a Stats object for all of the X data fed through the AddData method. More...
 
Isis::Statistics Y () const
 Returns a Stats object for all of the Y data fed through the AddData method. More...
 
double SumXY () const
 Returns the sum of x*y for all data given through the AddData method. More...
 
double Covariance () const
 Computes and returns the covariance between the two data sets If there are no valid data (pixels) then NULL8 is returned. More...
 
double Correlation () const
 Computes and returns the coefficient of correlation (between -1.0 and 1.0) of the two data sets. More...
 
void LinearRegression (double &a, double &b) const
 Fits a line. More...
 
BigInt ValidPixels () const
 Returns the number of valid pixels processed. More...
 
BigInt InvalidPixels () const
 Returns the number of invalid pixels encountered. More...
 
BigInt TotalPixels () const
 Returns the total number of pixels processed. More...
 
PvlObject toPvl (QString name="MultivariateStatistics") const
 Serializes a multivariate statistics object as a PvlObject. More...
 

Detailed Description

Container of multivariate statistics.

This class is used to accumulate multivariate statisics on two double arrays. In particular, it is highly useful for obtaining the covariance, correlation, and linear regression analysis on the the data. It ignores input values which are Isis special pixel values. That is, if either co-aligned double value is a special pixel then both values are not used in any statistical computation.

See also
Histogram
Stats
Author
2004-06-08 Jeff Anderson

Constructor & Destructor Documentation

◆ MultivariateStatistics() [1/2]

Isis::MultivariateStatistics::MultivariateStatistics ( )

Constructs a Multivariate Statistics object with accumulators and counters set to zero.

References Reset().

◆ MultivariateStatistics() [2/2]

Isis::MultivariateStatistics::MultivariateStatistics ( const PvlObject inStats)

Constructs a MulitvariateStatistics object from a PvlObject.

Parameters
constPvlObject & - Input multivariate statistics.

References Reset().

◆ ~MultivariateStatistics()

Isis::MultivariateStatistics::~MultivariateStatistics ( )

Destructs a MultivariateStatistics object.

Member Function Documentation

◆ AddData() [1/2]

void Isis::MultivariateStatistics::AddData ( const double *  x,
const double *  y,
const unsigned int  count 
)

Add two arrays of doubles to the accumulators and counters.

This method can be invoked multiple times, for example, once for each line in a cube, before obtaining statistics.

Parameters
xArray of doubles to add.
yArray of doubles to add.
countNumber of doubles to process.

References Isis::Statistics::AddData(), and Isis::IsValidPixel().

Referenced by Isis::MaximumCorrelation::MatchAlgorithm().

◆ AddData() [2/2]

void Isis::MultivariateStatistics::AddData ( double  x,
double  y,
unsigned int  count = 1 
)

Add an x,y value to the accumulators and counters count times.

This method can be invoked multiple times before obtaining statistics.

Parameters
xx value to add
yy value to add
countNumber of times to add this x,y value

References Isis::Statistics::AddData(), and Isis::IsValidPixel().

◆ Correlation()

double Isis::MultivariateStatistics::Correlation ( ) const

Computes and returns the coefficient of correlation (between -1.0 and 1.0) of the two data sets.

This can be used as a goodness-of-fit measurement. The close the correlation is two -1.0 or 1.0 the more likely the data sets are related (and therefore the regression equation is valid).

Returns
The coefficient of correlation. (between -1.0 and 1.0) The closer to 0.0 implies there is less correlation between the data sets. Returns NULL8 if correlation couldn't be computed.

References Covariance(), Isis::NULL8, and Isis::Statistics::StandardDeviation().

Referenced by Isis::MaximumCorrelation::MatchAlgorithm(), and toPvl().

◆ Covariance()

double Isis::MultivariateStatistics::Covariance ( ) const

Computes and returns the covariance between the two data sets If there are no valid data (pixels) then NULL8 is returned.

Returns
Covariance between the two data sets.

References Isis::Statistics::Average(), Isis::NULL8, and Isis::Statistics::Sum().

Referenced by Correlation(), and toPvl().

◆ InvalidPixels()

BigInt Isis::MultivariateStatistics::InvalidPixels ( ) const

Returns the number of invalid pixels encountered.

Returns
The number of invalid (unprocessed) pixels.

Referenced by toPvl().

◆ LinearRegression()

void Isis::MultivariateStatistics::LinearRegression ( double &  a,
double &  b 
) const

Fits a line.

\[ y=A+Bx \]

through the data.

Parameters
aThe additive constant A.
bThe additive constant B.

References _FILEINFO_, Isis::IException::Programmer, Isis::Statistics::Sum(), and Isis::Statistics::SumSquare().

Referenced by toPvl().

◆ RemoveData()

void Isis::MultivariateStatistics::RemoveData ( const double *  x,
const double *  y,
const unsigned int  count 
)

Remove an array of doubles from the accumulators and counters.

Parameters
xPointer to an array of doubles to remove.
yArray of doubles to add.
countNumber of doubles to process.
Returns
(type)return description

References _FILEINFO_, Isis::IsValidPixel(), Isis::IException::Programmer, and Isis::Statistics::RemoveData().

◆ Reset()

void Isis::MultivariateStatistics::Reset ( )

Resets all accumulators to zero.

References Isis::Statistics::Reset().

Referenced by MultivariateStatistics().

◆ SumXY()

double Isis::MultivariateStatistics::SumXY ( ) const

Returns the sum of x*y for all data given through the AddData method.

Returns
The sum of x*y for all data.

Referenced by toPvl().

◆ toPvl()

PvlObject Isis::MultivariateStatistics::toPvl ( QString  name = "MultivariateStatistics") const

Serializes a multivariate statistics object as a PvlObject.

Parameters
QString(Default value is "MultivariateStatistics") - Name of the PvlObject
Returns
PvlObject The serialized multivariate statistics

References Isis::PvlObject::addGroup(), Correlation(), Covariance(), InvalidPixels(), LinearRegression(), SumXY(), Isis::Statistics::toPvl(), Isis::toString(), TotalPixels(), ValidPixels(), X(), and Y().

◆ TotalPixels()

BigInt Isis::MultivariateStatistics::TotalPixels ( ) const

Returns the total number of pixels processed.

Returns
The total number of pixel processed (valid and invalid).

Referenced by toPvl().

◆ ValidPixels()

BigInt Isis::MultivariateStatistics::ValidPixels ( ) const

Returns the number of valid pixels processed.

Only valid pixels are utilized when computing the average, standard deviation, variance, minimum, and maximum.

Returns
The number of valid pixels processed.

Referenced by Isis::Equalization::calculateOverlapStatistics(), Isis::Equalization::fromPvl(), Isis::OverlapStatistics::IsValid(), Isis::MaximumCorrelation::MatchAlgorithm(), and toPvl().

◆ X()

Isis::Statistics Isis::MultivariateStatistics::X ( ) const

Returns a Stats object for all of the X data fed through the AddData method.

Returns
A Stats object for all X data.

Referenced by Isis::Equalization::calculateOverlapStatistics(), Isis::Equalization::fromPvl(), and toPvl().

◆ Y()

Isis::Statistics Isis::MultivariateStatistics::Y ( ) const

Returns a Stats object for all of the Y data fed through the AddData method.

Returns
A Stats object for all Y data.

Referenced by Isis::Equalization::calculateOverlapStatistics(), Isis::Equalization::fromPvl(), and toPvl().


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