Loading...
Searching...
No Matches
casacore::BiweightStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator > Class Template Reference

The biweight algorithm is a robust iterative algorithm that computes two quantities called the "location" and the "scale", which are analogous to the mean and the standard deviation. More...

`#include <BiweightStatistics.h>`

## Public Member Functions

| BiweightStatistics (Int maxNiter=3, Double c=6.0)
| BiweightStatistics (const BiweightStatistics< CASA_STATP > &other)
| copy semantics
virtual | ~BiweightStatistics ()
BiweightStatistics< CASA_STATP > & | operator= (const BiweightStatistics< CASA_STATP > &other)
| copy semantics
virtual StatisticsData::ALGORITHM | algorithm () const
| get the algorithm that this object uses for computing stats
virtual StatisticsAlgorithm< CASA_STATP > * | clone () const
| Clone this instance.
virtual AccumType | getMedian (std::shared_ptr< uInt64 > knownNpts=nullptr, std::shared_ptr< AccumType > knownMin=nullptr, std::shared_ptr< AccumType > knownMax=nullptr, uInt binningThreshholdSizeBytes=4096 *4096, Bool persistSortedArray=False, uInt nBins=10000)
| these statistics are not supported.
virtual AccumType | getMedianAndQuantiles (std::map< Double, AccumType > &quantileToValue, const std::set< Double > &quantiles, std::shared_ptr< uInt64 > knownNpts=nullptr, std::shared_ptr< AccumType > knownMin=nullptr, std::shared_ptr< AccumType > knownMax=nullptr, uInt binningThreshholdSizeBytes=4096 *4096, Bool persistSortedArray=False, uInt nBins=10000)
virtual AccumType | getMedianAbsDevMed (std::shared_ptr< uInt64 > knownNpts=nullptr, std::shared_ptr< AccumType > knownMin=nullptr, std::shared_ptr< AccumType > knownMax=nullptr, uInt binningThreshholdSizeBytes=4096 *4096, Bool persistSortedArray=False, uInt nBins=10000)
virtual std::map< Double, AccumType > | getQuantiles (const std::set< Double > &quantiles, std::shared_ptr< uInt64 > npts=nullptr, std::shared_ptr< AccumType > min=nullptr, std::shared_ptr< AccumType > max=nullptr, uInt binningThreshholdSizeBytes=4096 *4096, Bool persistSortedArray=False, uInt nBins=10000)
virtual std::pair< Int64, Int64 > | getStatisticIndex (StatisticsData::STATS stat)
| see base class description
Int | getNiter () const
| returns the number of iterations performed to compute the current location and scale values
virtual void | reset ()
| reset object to initial state.
virtual void | setCalculateAsAdded (Bool c)
| If c is True, an exception is thrown; this algorithm does not support computing stats as data are added.
virtual void | setStatsToCalculate (std::set< StatisticsData::STATS > &stats)
| Provide guidance to algorithms by specifying a priori which statistics the caller would like calculated.
Public Member Functions inherited from casacore::ClassicalStatistics< CASA_STATP >
| ClassicalStatistics ()
virtual | ~ClassicalStatistics ()
ClassicalStatistics & | operator= (const ClassicalStatistics &other)
| copy semantics
virtual CASA_STATP | getMedian (std::shared_ptr< uInt64 > knownNpts=nullptr, std::shared_ptr< CASA_STATP > knownMin=nullptr, std::shared_ptr< CASA_STATP > knownMax=nullptr, uInt binningThreshholdSizeBytes=4096 *4096, Bool persistSortedArray=False, uInt nBins=10000)
| In the following group of methods, if the size of the composite dataset is smaller than binningThreshholdSizeBytes, the composite dataset will be (perhaps partially) sorted and persisted in memory during the call.
virtual CASA_STATP | getMedianAndQuantiles (std::map< Double, CASA_STATP > &quantiles, const std::set< Double > &fractions, std::shared_ptr< uInt64 > knownNpts=nullptr, std::shared_ptr< CASA_STATP > knownMin=nullptr, std::shared_ptr< CASA_STATP > knownMax=nullptr, uInt binningThreshholdSizeBytes=4096 *4096, Bool persistSortedArray=False, uInt nBins=10000)
| If one needs to compute both the median and quantile values, it is better to call getMedianAndQuantiles() rather than getMedian() and getQuantiles() separately, as the first will scan large data sets fewer times than calling the separate methods.
virtual CASA_STATP | getMedianAbsDevMed (std::shared_ptr< uInt64 > knownNpts=nullptr, std::shared_ptr< CASA_STATP > knownMin=nullptr, std::shared_ptr< CASA_STATP > knownMax=nullptr, uInt binningThreshholdSizeBytes=4096 *4096, Bool persistSortedArray=False, uInt nBins=10000)
| get the median of the absolute deviation about the median of the data.
virtual std::map< Double, CASA_STATP > | getQuantiles (const std::set< Double > &fractions, std::shared_ptr< uInt64 > knownNpts=nullptr, std::shared_ptr< CASA_STATP > knownMin=nullptr, std::shared_ptr< CASA_STATP > knownMax=nullptr, uInt binningThreshholdSizeBytes=4096 *4096, Bool persistSortedArray=False, uInt nBins=10000)
| Get the specified quantiles.
virtual void | getMinMax (CASA_STATP &mymin, CASA_STATP &mymax)
| scan the dataset(s) that have been added, and find the min and max.
virtual void | getMinMaxNpts (uInt64 &npts, CASA_STATP &mymin, CASA_STATP &mymax)
virtual uInt64 | getNPts ()
| scan the dataset(s) that have been added, and find the number of good points.
virtual void | setDataProvider (StatsDataProvider< CASA_STATP > *dataProvider)
| An exception will be thrown if setCalculateAsAdded(True) has been called.
void | setQuantileComputer (std::shared_ptr< ClassicalQuantileComputer< CASA_STATP > > qc)
| Allow derived objects to set the quantile computer object.
Public Member Functions inherited from casacore::StatisticsAlgorithm< CASA_STATP >
virtual | ~StatisticsAlgorithm ()
void | addData (const DataIterator &first, uInt nr, uInt dataStride=1, Bool nrAccountsForStride=False)
| Add a dataset to an existing set of datasets on which statistics are to be calculated.
CASA_STATP | getQuantile (Double quantile, std::shared_ptr< uInt64 > knownNpts=nullptr, std::shared_ptr< CASA_STATP > knownMin=nullptr, std::shared_ptr< CASA_STATP > knownMax=nullptr, uInt binningThreshholdSizeBytes=4096 *4096, Bool persistSortedArray=False, uInt nBins=10000)
| Purposefully not virtual.
CASA_STATP | getStatistic (StatisticsData::STATS stat)
| get the value of the specified statistic.
StatsData< CASA_STATP > | getStatistics ()
| Return statistics.
void | setData (const DataIterator &first, uInt nr, uInt dataStride=1, Bool nrAccountsForStride=False)
| setdata() clears any current datasets or data provider and then adds the specified data set as the first dataset in the (possibly new) set of data sets for which statistics are to be calculated.

## Protected Member Functions

void | _computeStats ()
virtual StatsData< AccumType > | _getStatistics ()
Protected Member Functions inherited from casacore::ClassicalStatistics< CASA_STATP >
virtual void | _accumNpts (uInt64 &npts, const DataIterator &dataBegin, uInt64 nr, uInt dataStride) const
| scan through the data set to determine the number of good (unmasked, weight > 0, within range) points.
void | _accumulate (StatsData< CASA_STATP > &stats, const CASA_STATP &datum, const LocationType &location)
void | _addData ()
| Allows derived classes to do things after data is set or added.
void | _clearStats ()
Bool | _getDoMaxMin () const
virtual StatsData< CASA_STATP > | _getInitialStats () const
virtual CASA_STATP | _getStatistic (StatisticsData::STATS stat)
virtual StatsData< CASA_STATP > & | _getStatsData ()
| Retrieve stats structure.
virtual void | _minMax (std::shared_ptr< CASA_STATP > &mymin, std::shared_ptr< CASA_STATP > &mymax, const DataIterator &dataBegin, uInt64 nr, uInt dataStride) const
virtual void | _minMaxNpts (uInt64 &npts, std::shared_ptr< CASA_STATP > &mymin, std::shared_ptr< CASA_STATP > &mymax, const DataIterator &dataBegin, uInt64 nr, uInt dataStride) const
| Sometimes we want the min, max, and npts all in one scan.
std::shared_ptr< StatisticsAlgorithmQuantileComputer< CASA_STATP > > | _getQuantileComputer ()
virtual void | _unweightedStats (StatsData< CASA_STATP > &stats, uInt64 &ngood, LocationType &location, const DataIterator &dataBegin, uInt64 nr, uInt dataStride)
| no weights, no mask, no ranges
virtual void | _updateDataProviderMaxMin (const StatsData< CASA_STATP > &threadStats)
virtual void | _weightedStats (StatsData< CASA_STATP > &stats, LocationType &location, const DataIterator &dataBegin, const DataIterator &weightsBegin, uInt64 nr, uInt dataStride)
| has weights, but no mask, no ranges
Protected Member Functions inherited from casacore::StatisticsAlgorithm< CASA_STATP >
| StatisticsAlgorithm ()
StatisticsAlgorithm & | operator= (const StatisticsAlgorithm &other)
| use copy semantics, except for the data provider which uses reference semantics
const StatisticsDataset< CASA_STATP > & | _getDataset () const
| These methods are purposefully not virtual.
const std::set< StatisticsData::STATS > | _getStatsToCalculate () const
virtual const std::set< StatisticsData::STATS > & | _getUnsupportedStatistics () const
void | _setUnsupportedStatistics (const std::set< StatisticsData::STATS > &stats)
| Derived classes should normally call this in their constructors, if applicable.

## Private Member Functions

void | _computeLocationAndScaleSums (AccumType &sxw2, AccumType &sw2, AccumType &sx_M2w4, AccumType &ww_4u2, DataIterator dataIter, MaskIterator maskIter, WeightsIterator weightsIter, uInt64 dataCount, const typename StatisticsDataset< CASA_STATP >::ChunkData &chunk)
void | _computeLocationSums (AccumType &sxw2, AccumType &sw2, DataIterator dataIter, MaskIterator maskIter, WeightsIterator weightsIter, uInt64 dataCount, const typename StatisticsDataset< CASA_STATP >::ChunkData &chunk)
void | _computeScaleSums (AccumType &sx_M2w4, AccumType &ww_4u2, DataIterator dataIter, MaskIterator maskIter, WeightsIterator weightsIter, uInt64 dataCount, const typename StatisticsDataset< CASA_STATP >::ChunkData &chunk) const
void | _doLocationAndScale ()
void | _doLocation ()
void | _doScale ()
void | _locationAndScaleSums (AccumType &sxw2, AccumType &sw2, AccumType &sx_M2w4, AccumType &ww_4u2, const DataIterator &dataBegin, uInt64 nr, uInt dataStride) const
| sxw2 = sum(x_i*(1 - u_i^2)^2) sw2 = sum((1-u_i^2)^2) sx_M2w4 = sum((x_i - _location)^2 * (1 - u_i^2)^4) = sum((x_i - _location)^2 * w_i^4) ww_4u2 = sum((1 - u_i^2) * (1 - 5*u_i^2)) = sum(w_i * (w_i - 4*u_i^2))
void | _locationAndScaleSums (AccumType &sxw2, AccumType &sw2, AccumType &sx_M2w4, AccumType &ww_4u2, const DataIterator &dataBegin, uInt64 nr, uInt dataStride, const DataRanges &ranges, Bool isInclude) const
void | _locationAndScaleSums (AccumType &sxw2, AccumType &sw2, AccumType &sx_M2w4, AccumType &ww_4u2, const DataIterator &dataBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride) const
void | _locationAndScaleSums (AccumType &sxw2, AccumType &sw2, AccumType &sx_M2w4, AccumType &ww_4u2, const DataIterator &dataBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride, const DataRanges &ranges, Bool isInclude) const
void | _locationAndScaleSums (AccumType &sxw2, AccumType &sw2, AccumType &sx_M2w4, AccumType &ww_4u2, const DataIterator &dataBegin, const WeightsIterator &weightsBegin, uInt64 nr, uInt dataStride) const
void | _locationAndScaleSums (AccumType &sxw2, AccumType &sw2, AccumType &sx_M2w4, AccumType &ww_4u2, const DataIterator &dataBegin, const WeightsIterator &weightsBegin, uInt64 nr, uInt dataStride, const DataRanges &ranges, Bool isInclude) const
void | _locationAndScaleSums (AccumType &sxw2, AccumType &sw2, AccumType &sx_M2w4, AccumType &ww_4u2, const DataIterator &dataBegin, const WeightsIterator &weightsBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride, const DataRanges &ranges, Bool isInclude) const
void | _locationAndScaleSums (AccumType &sxw2, AccumType &sw2, AccumType &sx_M2w4, AccumType &ww_4u2, const DataIterator &dataBegin, const WeightsIterator &weightBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride) const
void | _locationSums (AccumType &sxw2, AccumType &sw2, const DataIterator &dataBegin, uInt64 nr, uInt dataStride) const
| sxw2 = sum(x_i*(1 - u_i^2)^2) sw2 = sum((1-u_i^2)^2)
void | _locationSums (AccumType &sxw2, AccumType &sw2, const DataIterator &dataBegin, uInt64 nr, uInt dataStride, const DataRanges &ranges, Bool isInclude) const
void | _locationSums (AccumType &sxw2, AccumType &sw2, const DataIterator &dataBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride) const
void | _locationSums (AccumType &sxw2, AccumType &sw2, const DataIterator &dataBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride, const DataRanges &ranges, Bool isInclude) const
void | _locationSums (AccumType &sxw2, AccumType &sw2, const DataIterator &dataBegin, const WeightsIterator &weightsBegin, uInt64 nr, uInt dataStride) const
void | _locationSums (AccumType &sxw2, AccumType &sw2, const DataIterator &dataBegin, const WeightsIterator &weightsBegin, uInt64 nr, uInt dataStride, const DataRanges &ranges, Bool isInclude) const
void | _locationSums (AccumType &sxw2, AccumType &sw2, const DataIterator &dataBegin, const WeightsIterator &weightsBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride, const DataRanges &ranges, Bool isInclude) const
void | _locationSums (AccumType &sxw2, AccumType &sw2, const DataIterator &dataBegin, const WeightsIterator &weightBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride) const
void | _scaleSums (AccumType &sx_M2w4, AccumType &ww_4u2, const DataIterator &dataBegin, uInt64 nr, uInt dataStride) const
| sx_M2w4 = sum((x_i - _location)^2 * (1 - u_i^2)^4) = sum((x_i - _location)^2 * w_i^4) ww_4u2 = sum((1 - u_i^2) * (1 - 5*u_i^2)) = sum(w_i * (w_i - 4*u_i^2))
void | _scaleSums (AccumType &sx_M2w4, AccumType &ww_4u2, const DataIterator &dataBegin, uInt64 nr, uInt dataStride, const DataRanges &ranges, Bool isInclude) const
void | _scaleSums (AccumType &sx_M2w4, AccumType &ww_4u2, const DataIterator &dataBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride) const
void | _scaleSums (AccumType &sx_M2w4, AccumType &ww_4u2, const DataIterator &dataBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride, const DataRanges &ranges, Bool isInclude) const
void | _scaleSums (AccumType &sx_M2w4, AccumType &ww_4u2, const DataIterator &dataBegin, const WeightsIterator &weightsBegin, uInt64 nr, uInt dataStride) const
void | _scaleSums (AccumType &sx_M2w4, AccumType &ww_4u2, const DataIterator &dataBegin, const WeightsIterator &weightsBegin, uInt64 nr, uInt dataStride, const DataRanges &ranges, Bool isInclude) const
void | _scaleSums (AccumType &sx_M2w4, AccumType &ww_4u2, const DataIterator &dataBegin, const WeightsIterator &weightsBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride, const DataRanges &ranges, Bool isInclude) const
void | _scaleSums (AccumType &sx_M2w4, AccumType &ww_4u2, const DataIterator &dataBegin, const WeightsIterator &weightBegin, uInt64 nr, uInt dataStride, const MaskIterator &maskBegin, uInt maskStride) const

## Private Attributes

Double | _c
Int | _niter
Int | _maxNiter
AccumType | _location
AccumType | _scale
std::pair< AccumType, AccumType > | _range
uInt64 | _npts
| _npts is the number of points computed using ClassicalStatistics

## Static Private Attributes

static const AccumType | FOUR
| because the compiler gets confused if these aren't explicitly typed
static const AccumType | FIVE

## Detailed Description

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>
class casacore::BiweightStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >

The biweight algorithm is a robust iterative algorithm that computes two quantities called the "location" and the "scale", which are analogous to the mean and the standard deviation.

Important equations are

A. How to compute u_i values, which are related to the weights, w_i = (1 - u_i*u_i) if abs(u_i) < 1, 0 otherwise, using the equation

u_i = (x_i - c_bi)/(c*s_bi) (1)

where x_i are the data values, c_bi is the biweight location, c is a configurable constant, and s_bi is the biweight scale. For the initial computation of the u_i values, c_bi is set equal to the median of the distribution and s_bi is set equal to the normalized median of the absolute deviation about the median (that is the median of the absolute deviation about the median multiplied by the value of the probit function at 0.75). B The location, c_bi, is computed from

c_bi = sum(x_i * w_i^2)/sum(w_i^2) (2)

where only values of u_i which satisfy abs(u_i) < 1 (w_i > 0) are used in the sums. C. The scale value is computed using

n * sum((x_i - c_bi)^2 * w_i^4) s_bi^2 = _______________________________ (3) p * max(1, p - 1)

where n is the number of points for the entire distribution (which includes all the data for which abs(u_i) >= 1) and p is given by

p = abs(sum((w_i) * (w_i - 4*u_i^2)))

Again, the sums include only data for which abs(u_i) < 1.

The algorithm proceeds as follows.

1. Compute initial u_i values from equation (1), setting c_bi equal to the median of the distribution and s_bi equal to the normalized median of the absolute deviation about the median.
2. Compute the initial value of the scale using the u_i values computed in step 1. using equation 3.
3. Recompute u_i values using the most recent previous scale and location values.
4. Compute the location using the u_i values from step 3 and equation (2).
5. Recompute u_i values using the most recent previous scale and location values.
6. Compute the new scale value using the the u_i values computed in step 5 and the value of the location computed in step 4.
7. Steps 3. - 6. are repeated until convergence occurs or the maximum number of iterations (a configurable parameter) is reached. The convergence criterion is given by

abs(1 - s_bi/s_bi,prev) < 0.03 * sqrt(0.5/(n - 1))

where s_bi,prev is the value of the scale computed in the previous iteration.

SPECIAL CASE TO FACILITATE SPEED

In the special case where maxNiter is specified to be negative, the algorithm proceeds as follows

1. Compute u_i values using the median for the location and the normalized median of the absolute deviation about the median as the scale
2. Compute the location and scale (which can be carried out simultaneously) using the u_i values computed in step 1. The value of the location is just the median that is used in equation (3) to compute the scale

IMPORTANT NOTE REGARDING USER SPECIFIED WEIGHTS

Although user-specified weights can be supplied, they are effectively ignored by this algorithm, except for data which have weights of zero, which are ignored.

This is a derived class of ClassicalStatistics, rather than ConstrainedRangeStatistics, because if behaves differently from ConstrainedRangeStatistics and does not need to use any methods in that class, so making it a specialization of the higher level ClassicalStatistics seems the better choice.

Definition at line 121 of file BiweightStatistics.h.

## Constructor & Destructor Documentation

## BiweightStatistics() [1/2]

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>

casacore::BiweightStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::BiweightStatistics | ( | Int | maxNiter = 3,
|  | Double | c = 6.0 )

Referenced by BiweightStatistics(), and operator=().

## BiweightStatistics() [2/2]

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>

casacore::BiweightStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::BiweightStatistics | ( | const BiweightStatistics< CASA_STATP > & | other | ) |

copy semantics

References BiweightStatistics().

## ~BiweightStatistics()

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>

virtual casacore::BiweightStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::~BiweightStatistics | ( |  | ) |

virtual

## Member Function Documentation

## _computeLocationAndScaleSums()

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>

void casacore::BiweightStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_computeLocationAndScaleSums | ( | AccumType & | sxw2,
|  | AccumType & | sw2,
|  | AccumType & | sx_M2w4,
|  | AccumType & | ww_4u2,
|  | DataIterator | dataIter,
|  | MaskIterator | maskIter,
|  | WeightsIterator | weightsIter,
|  | uInt64 | dataCount,
|  | const typename StatisticsDataset< CASA_STATP >::ChunkData & | chunk )

private

## _computeLocationSums()

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>

void casacore::BiweightStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_computeLocationSums | ( | AccumType & | sxw2,
|  | AccumType & | sw2,
|  | DataIterator | dataIter,
|  | MaskIterator | maskIter,
|  | WeightsIterator | weightsIter,
|  | uInt64 | dataCount,
|  | const typename StatisticsDataset< CASA_STATP >::ChunkData & | chunk )

private

## _computeScaleSums()

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>

void casacore::BiweightStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_computeScaleSums | ( | AccumType & | sx_M2w4,
|  | AccumType & | ww_4u2,
|  | DataIterator | dataIter,
|  | MaskIterator | maskIter,
|  | WeightsIterator | weightsIter,
|  | uInt64 | dataCount,
|  | const typename StatisticsDataset< CASA_STATP >::ChunkData & | chunk ) const

private

## _computeStats()

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>

void casacore::BiweightStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_computeStats | ( |  | ) |

protected

## _doLocation()

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>

void casacore::BiweightStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_doLocation | ( |  | ) |

private

## _doLocationAndScale()

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>

void casacore::BiweightStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_doLocationAndScale | ( |  | ) |

private

## _doScale()

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>

void casacore::BiweightStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_doScale | ( |  | ) |

private

## _getStatistics()

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>

virtual StatsData< AccumType > casacore::BiweightStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_getStatistics | ( |  | ) |

protected virtual

Reimplemented from casacore::ClassicalStatistics< CASA_STATP >.

## _locationAndScaleSums() [1/8]

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>

void casacore::BiweightStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_locationAndScaleSums | ( | AccumType & | sxw2,
|  | AccumType & | sw2,
|  | AccumType & | sx_M2w4,
|  | AccumType & | ww_4u2,
|  | const DataIterator & | dataBegin,
|  | const WeightsIterator & | weightBegin,
|  | uInt64 | nr,
|  | uInt | dataStride,
|  | const MaskIterator & | maskBegin,
|  | uInt | maskStride ) const

private

## _locationAndScaleSums() [2/8]

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>

void casacore::BiweightStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_locationAndScaleSums | ( | AccumType & | sxw2,
|  | AccumType & | sw2,
|  | AccumType & | sx_M2w4,
|  | AccumType & | ww_4u2,
|  | const DataIterator & | dataBegin,
|  | const WeightsIterator & | weightsBegin,
|  | uInt64 | nr,
|  | uInt | dataStride ) const

private

## _locationAndScaleSums() [3/8]

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>

void casacore::BiweightStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_locationAndScaleSums | ( | AccumType & | sxw2,
|  | AccumType & | sw2,
|  | AccumType & | sx_M2w4,
|  | AccumType & | ww_4u2,
|  | const DataIterator & | dataBegin,
|  | const WeightsIterator & | weightsBegin,
|  | uInt64 | nr,
|  | uInt | dataStride,
|  | const DataRanges & | ranges,
|  | Bool | isInclude ) const

private

References DataRanges.

## _locationAndScaleSums() [4/8]

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>

void casacore::BiweightStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_locationAndScaleSums | ( | AccumType & | sxw2,
|  | AccumType & | sw2,
|  | AccumType & | sx_M2w4,
|  | AccumType & | ww_4u2,
|  | const DataIterator & | dataBegin,
|  | const WeightsIterator & | weightsBegin,
|  | uInt64 | nr,
|  | uInt | dataStride,
|  | const MaskIterator & | maskBegin,
|  | uInt | maskStride,
|  | const DataRanges & | ranges,
|  | Bool | isInclude ) const

private

References DataRanges.

## _locationAndScaleSums() [5/8]

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>

void casacore::BiweightStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_locationAndScaleSums | ( | AccumType & | sxw2,
|  | AccumType & | sw2,
|  | AccumType & | sx_M2w4,
|  | AccumType & | ww_4u2,
|  | const DataIterator & | dataBegin,
|  | uInt64 | nr,
|  | uInt | dataStride ) const

private

sxw2 = sum(x_i*(1 - u_i^2)^2) sw2 = sum((1-u_i^2)^2) sx_M2w4 = sum((x_i - _location)^2 * (1 - u_i^2)^4) = sum((x_i - _location)^2 * w_i^4) ww_4u2 = sum((1 - u_i^2) * (1 - 5*u_i^2)) = sum(w_i * (w_i - 4*u_i^2))

## _locationAndScaleSums() [6/8]

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>

void casacore::BiweightStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_locationAndScaleSums | ( | AccumType & | sxw2,
|  | AccumType & | sw2,
|  | AccumType & | sx_M2w4,
|  | AccumType & | ww_4u2,
|  | const DataIterator & | dataBegin,
|  | uInt64 | nr,
|  | uInt | dataStride,
|  | const DataRanges & | ranges,
|  | Bool | isInclude ) const

private

References DataRanges.

## _locationAndScaleSums() [7/8]

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>

void casacore::BiweightStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_locationAndScaleSums | ( | AccumType & | sxw2,
|  | AccumType & | sw2,
|  | AccumType & | sx_M2w4,
|  | AccumType & | ww_4u2,
|  | const DataIterator & | dataBegin,
|  | uInt64 | nr,
|  | uInt | dataStride,
|  | const MaskIterator & | maskBegin,
|  | uInt | maskStride ) const

private

## _locationAndScaleSums() [8/8]

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>

void casacore::BiweightStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_locationAndScaleSums | ( | AccumType & | sxw2,
|  | AccumType & | sw2,
|  | AccumType & | sx_M2w4,
|  | AccumType & | ww_4u2,
|  | const DataIterator & | dataBegin,
|  | uInt64 | nr,
|  | uInt | dataStride,
|  | const MaskIterator & | maskBegin,
|  | uInt | maskStride,
|  | const DataRanges & | ranges,
|  | Bool | isInclude ) const

private

References DataRanges.

## _locationSums() [1/8]

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>

void casacore::BiweightStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_locationSums | ( | AccumType & | sxw2,
|  | AccumType & | sw2,
|  | const DataIterator & | dataBegin,
|  | const WeightsIterator & | weightBegin,
|  | uInt64 | nr,
|  | uInt | dataStride,
|  | const MaskIterator & | maskBegin,
|  | uInt | maskStride ) const

private

## _locationSums() [2/8]

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>

void casacore::BiweightStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_locationSums | ( | AccumType & | sxw2,
|  | AccumType & | sw2,
|  | const DataIterator & | dataBegin,
|  | const WeightsIterator & | weightsBegin,
|  | uInt64 | nr,
|  | uInt | dataStride ) const

private

## _locationSums() [3/8]

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>

void casacore::BiweightStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_locationSums | ( | AccumType & | sxw2,
|  | AccumType & | sw2,
|  | const DataIterator & | dataBegin,
|  | const WeightsIterator & | weightsBegin,
|  | uInt64 | nr,
|  | uInt | dataStride,
|  | const DataRanges & | ranges,
|  | Bool | isInclude ) const

private

References DataRanges.

## _locationSums() [4/8]

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>

void casacore::BiweightStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_locationSums | ( | AccumType & | sxw2,
|  | AccumType & | sw2,
|  | const DataIterator & | dataBegin,
|  | const WeightsIterator & | weightsBegin,
|  | uInt64 | nr,
|  | uInt | dataStride,
|  | const MaskIterator & | maskBegin,
|  | uInt | maskStride,
|  | const DataRanges & | ranges,
|  | Bool | isInclude ) const

private

References DataRanges.

## _locationSums() [5/8]

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>

void casacore::BiweightStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_locationSums | ( | AccumType & | sxw2,
|  | AccumType & | sw2,
|  | const DataIterator & | dataBegin,
|  | uInt64 | nr,
|  | uInt | dataStride ) const

private

sxw2 = sum(x_i*(1 - u_i^2)^2) sw2 = sum((1-u_i^2)^2)

## _locationSums() [6/8]

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>

void casacore::BiweightStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_locationSums | ( | AccumType & | sxw2,
|  | AccumType & | sw2,
|  | const DataIterator & | dataBegin,
|  | uInt64 | nr,
|  | uInt | dataStride,
|  | const DataRanges & | ranges,
|  | Bool | isInclude ) const

private

References DataRanges.

## _locationSums() [7/8]

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>

void casacore::BiweightStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_locationSums | ( | AccumType & | sxw2,
|  | AccumType & | sw2,
|  | const DataIterator & | dataBegin,
|  | uInt64 | nr,
|  | uInt | dataStride,
|  | const MaskIterator & | maskBegin,
|  | uInt | maskStride ) const

private

## _locationSums() [8/8]

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>

void casacore::BiweightStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_locationSums | ( | AccumType & | sxw2,
|  | AccumType & | sw2,
|  | const DataIterator & | dataBegin,
|  | uInt64 | nr,
|  | uInt | dataStride,
|  | const MaskIterator & | maskBegin,
|  | uInt | maskStride,
|  | const DataRanges & | ranges,
|  | Bool | isInclude ) const

private

References DataRanges.

## _scaleSums() [1/8]

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>

void casacore::BiweightStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_scaleSums | ( | AccumType & | sx_M2w4,
|  | AccumType & | ww_4u2,
|  | const DataIterator & | dataBegin,
|  | const WeightsIterator & | weightBegin,
|  | uInt64 | nr,
|  | uInt | dataStride,
|  | const MaskIterator & | maskBegin,
|  | uInt | maskStride ) const

private

## _scaleSums() [2/8]

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>

void casacore::BiweightStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_scaleSums | ( | AccumType & | sx_M2w4,
|  | AccumType & | ww_4u2,
|  | const DataIterator & | dataBegin,
|  | const WeightsIterator & | weightsBegin,
|  | uInt64 | nr,
|  | uInt | dataStride ) const

private

## _scaleSums() [3/8]

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>

void casacore::BiweightStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_scaleSums | ( | AccumType & | sx_M2w4,
|  | AccumType & | ww_4u2,
|  | const DataIterator & | dataBegin,
|  | const WeightsIterator & | weightsBegin,
|  | uInt64 | nr,
|  | uInt | dataStride,
|  | const DataRanges & | ranges,
|  | Bool | isInclude ) const

private

References DataRanges.

## _scaleSums() [4/8]

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>

void casacore::BiweightStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_scaleSums | ( | AccumType & | sx_M2w4,
|  | AccumType & | ww_4u2,
|  | const DataIterator & | dataBegin,
|  | const WeightsIterator & | weightsBegin,
|  | uInt64 | nr,
|  | uInt | dataStride,
|  | const MaskIterator & | maskBegin,
|  | uInt | maskStride,
|  | const DataRanges & | ranges,
|  | Bool | isInclude ) const

private

References DataRanges.

## _scaleSums() [5/8]

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>

void casacore::BiweightStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_scaleSums | ( | AccumType & | sx_M2w4,
|  | AccumType & | ww_4u2,
|  | const DataIterator & | dataBegin,
|  | uInt64 | nr,
|  | uInt | dataStride ) const

private

sx_M2w4 = sum((x_i - _location)^2 * (1 - u_i^2)^4) = sum((x_i - _location)^2 * w_i^4) ww_4u2 = sum((1 - u_i^2) * (1 - 5*u_i^2)) = sum(w_i * (w_i - 4*u_i^2))

## _scaleSums() [6/8]

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>

void casacore::BiweightStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_scaleSums | ( | AccumType & | sx_M2w4,
|  | AccumType & | ww_4u2,
|  | const DataIterator & | dataBegin,
|  | uInt64 | nr,
|  | uInt | dataStride,
|  | const DataRanges & | ranges,
|  | Bool | isInclude ) const

private

References DataRanges.

## _scaleSums() [7/8]

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>

void casacore::BiweightStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_scaleSums | ( | AccumType & | sx_M2w4,
|  | AccumType & | ww_4u2,
|  | const DataIterator & | dataBegin,
|  | uInt64 | nr,
|  | uInt | dataStride,
|  | const MaskIterator & | maskBegin,
|  | uInt | maskStride ) const

private

## _scaleSums() [8/8]

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>

void casacore::BiweightStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_scaleSums | ( | AccumType & | sx_M2w4,
|  | AccumType & | ww_4u2,
|  | const DataIterator & | dataBegin,
|  | uInt64 | nr,
|  | uInt | dataStride,
|  | const MaskIterator & | maskBegin,
|  | uInt | maskStride,
|  | const DataRanges & | ranges,
|  | Bool | isInclude ) const

private

References DataRanges.

## algorithm()

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>

virtual StatisticsData::ALGORITHM casacore::BiweightStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::algorithm | ( |  | ) | const

virtual

get the algorithm that this object uses for computing stats

Reimplemented from casacore::ClassicalStatistics< CASA_STATP >.

## clone()

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>

virtual StatisticsAlgorithm< CASA_STATP > * casacore::BiweightStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::clone | ( |  | ) | const

virtual

Clone this instance.

Reimplemented from casacore::ClassicalStatistics< CASA_STATP >.

## getMedian()

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>

virtual AccumType casacore::BiweightStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::getMedian | ( | std::shared_ptr< uInt64 > | knownNpts = nullptr,
|  | std::shared_ptr< AccumType > | knownMin = nullptr,
|  | std::shared_ptr< AccumType > | knownMax = nullptr,
|  | uInt | binningThreshholdSizeBytes = 4096 *4096,
|  | Bool | persistSortedArray = False,
|  | uInt | nBins = 10000 )

virtual

these statistics are not supported.

The methods, which override the virtual ancestor versions, throw exceptions.

References casacore::False.

## getMedianAbsDevMed()

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>

virtual AccumType casacore::BiweightStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::getMedianAbsDevMed | ( | std::shared_ptr< uInt64 > | knownNpts = nullptr,
|  | std::shared_ptr< AccumType > | knownMin = nullptr,
|  | std::shared_ptr< AccumType > | knownMax = nullptr,
|  | uInt | binningThreshholdSizeBytes = 4096 *4096,
|  | Bool | persistSortedArray = False,
|  | uInt | nBins = 10000 )

virtual

References casacore::False.

## getMedianAndQuantiles()

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>

virtual AccumType casacore::BiweightStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::getMedianAndQuantiles | ( | std::map< Double, AccumType > & | quantileToValue,
|  | const std::set< Double > & | quantiles,
|  | std::shared_ptr< uInt64 > | knownNpts = nullptr,
|  | std::shared_ptr< AccumType > | knownMin = nullptr,
|  | std::shared_ptr< AccumType > | knownMax = nullptr,
|  | uInt | binningThreshholdSizeBytes = 4096 *4096,
|  | Bool | persistSortedArray = False,
|  | uInt | nBins = 10000 )

virtual

References casacore::False.

## getNiter()

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>

Int casacore::BiweightStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::getNiter | ( |  | ) | const

returns the number of iterations performed to compute the current location and scale values

## getQuantiles()

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>

virtual std::map< Double, AccumType > casacore::BiweightStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::getQuantiles | ( | const std::set< Double > & | quantiles,
|  | std::shared_ptr< uInt64 > | npts = nullptr,
|  | std::shared_ptr< AccumType > | min = nullptr,
|  | std::shared_ptr< AccumType > | max = nullptr,
|  | uInt | binningThreshholdSizeBytes = 4096 *4096,
|  | Bool | persistSortedArray = False,
|  | uInt | nBins = 10000 )

virtual

References casacore::False, casacore::max(), and casacore::min().

## getStatisticIndex()

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>

virtual std::pair< Int64, Int64 > casacore::BiweightStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::getStatisticIndex | ( | StatisticsData::STATS | stat | ) |

virtual

see base class description

Reimplemented from casacore::ClassicalStatistics< CASA_STATP >.

## operator=()

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>

BiweightStatistics< CASA_STATP > & casacore::BiweightStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::operator= | ( | const BiweightStatistics< CASA_STATP > & | other | ) |

copy semantics

References BiweightStatistics().

## reset()

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>

virtual void casacore::BiweightStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::reset | ( |  | ) |

virtual

reset object to initial state.

Clears all private fields including data, accumulators, etc.

Reimplemented from casacore::ClassicalStatistics< CASA_STATP >.

## setCalculateAsAdded()

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>

virtual void casacore::BiweightStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::setCalculateAsAdded | ( | Bool | c | ) |

virtual

If c is True, an exception is thrown; this algorithm does not support computing stats as data are added.

Reimplemented from casacore::ClassicalStatistics< CASA_STATP >.

## setStatsToCalculate()

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>

virtual void casacore::BiweightStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::setStatsToCalculate | ( | std::set< StatisticsData::STATS > & | stats | ) |

virtual

Provide guidance to algorithms by specifying a priori which statistics the caller would like calculated.

This algorithm always needs to compute the location (MEAN) and the scale (STDDEV) so these statistics are always added to the input set, which is why this method overrides the base class version.

Reimplemented from casacore::ClassicalStatistics< CASA_STATP >.

## Member Data Documentation

## _c

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>

Double casacore::BiweightStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_c

private

Definition at line 208 of file BiweightStatistics.h.

## _location

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>

AccumType casacore::BiweightStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_location

private

Definition at line 210 of file BiweightStatistics.h.

## _maxNiter

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>

Int casacore::BiweightStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_maxNiter

private

Definition at line 209 of file BiweightStatistics.h.

## _niter

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>

Int casacore::BiweightStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_niter

private

Definition at line 209 of file BiweightStatistics.h.

## _npts

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>

uInt64 casacore::BiweightStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_npts

private

_npts is the number of points computed using ClassicalStatistics

Definition at line 213 of file BiweightStatistics.h.

## _range

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>

std::pair<AccumType, AccumType> casacore::BiweightStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_range

private

Definition at line 211 of file BiweightStatistics.h.

## _scale

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>

AccumType casacore::BiweightStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::_scale

private

Definition at line 210 of file BiweightStatistics.h.

## FIVE

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>

const AccumType casacore::BiweightStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::FIVE

static private

Definition at line 217 of file BiweightStatistics.h.

## FOUR

template<class AccumType, class DataIterator, class MaskIterator = const Bool*, class WeightsIterator = DataIterator>

const AccumType casacore::BiweightStatistics< AccumType, DataIterator, MaskIterator, WeightsIterator >::FOUR

static private

because the compiler gets confused if these aren't explicitly typed

Definition at line 216 of file BiweightStatistics.h.

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

- scimath/StatsFramework/BiweightStatistics.h