gpstk::Robust Namespace Reference
[Mathematical algorithms]


Detailed Description

Robust statistics.


Functions

template<typename T>
Median (T *xd, const int nd, bool save_flag=true) throw (Exception)
 Compute median of an array of length nd; array xd is returned sorted, unless save_flag is true.
template<typename T>
void Quartiles (const T *xd, const int nd, T &Q1, T &Q3) throw (Exception)
 Compute the quartiles Q1 and Q3 of an array of length nd.
template<typename T>
MedianAbsoluteDeviation (T *xd, int nd, T &M, bool save_flag=true) throw (Exception)
 Compute the median absolute deviation of a double array of length nd, as well as the median (M = Median(xd,nd)); NB this routine will trash the array xd unless save_flag is true (default).
template<typename T>
MAD (T *xd, int nd, T &M, bool save_flag=true) throw (Exception)
 Compute the median absolute deviation of a double array of length nd; see MedianAbsoluteDeviation().
template<typename T>
MEstimate (const T *xd, int nd, const T &M, const T &MAD, T *w=NULL) throw (Exception)
 Compute the m-estimate.
int RobustPolyFit (double *xd, const double *td, int nd, int n, double *c, double *w=NULL) throw (Exception)
 Fit a polynomial of degree n to data xd, with independent variable td, using robust techniques.
void StemLeafPlot (std::ostream &os, double *xd, long nd, std::string msg=std::string("")) throw (Exception)
 Print 'stem and leaf' plot of the data in the double array xd of length nd, with an optional message, on the given output ostream.
void QuantilePlot (double *yd, long nd, double *xd) throw (Exception)
 Generate data for a quantile-quantile plot.


Function Documentation

T MAD T *  xd,
int  nd,
T &  M,
bool  save_flag = true
throw (Exception)
 

Compute the median absolute deviation of a double array of length nd; see MedianAbsoluteDeviation().

Definition at line 413 of file RobustStats.hpp.

References MedianAbsoluteDeviation().

Referenced by GDCPass::WLsigmaStrip().

T Median T *  xd,
const int  nd,
bool  save_flag = true
throw (Exception)
 

Compute median of an array of length nd; array xd is returned sorted, unless save_flag is true.

Parameters:
xd array of data.
nd length of array xd.
save_flag if true (default) array xd will NOT be changed, otherwise it will be sorted.
Returns:
median of the data in array xd.

Definition at line 287 of file RobustStats.hpp.

References GPSTK_RETHROW, GPSTK_THROW, and gpstk::QSort().

Referenced by MedianAbsoluteDeviation().

T MedianAbsoluteDeviation T *  xd,
int  nd,
T &  M,
bool  save_flag = true
throw (Exception)
 

Compute the median absolute deviation of a double array of length nd, as well as the median (M = Median(xd,nd)); NB this routine will trash the array xd unless save_flag is true (default).

Parameters:
xd array of data (input).
nd length of array xd (input).
M median of data in array xd (output).
save_flag if true (default), array xd will NOT be trashed.
Returns:
median absolute deviation of data in array xd.

Definition at line 367 of file RobustStats.hpp.

References ABSOLUTE, GPSTK_THROW, Median(), gpstk::QSort(), and RobustTuningE.

Referenced by SRIleastSquares::dataUpdate(), and MAD().

T MEstimate const T *  xd,
int  nd,
const T &  M,
const T &  MAD,
T *  w = NULL
throw (Exception)
 

Compute the m-estimate.

Iteratively determine the m-estimate, which is a measure of mean or median, but is less sensitive to outliers. M is the median (M=Median(xd,nd)), and MAD is the median absolute deviation (MAD=MedianAbsoluteDeviation(xd,nd,M)). Optionally, a pointer to an array, which will contain the weights on output, may be provided.

Parameters:
xd input array of data.
nd input length of array xd.
M input median of data in array xd.
MAD input median absolute deviation of data in array xd.
w output array of length nd to contain weights on output.
Returns:
m-estimate of data in array xd.

Definition at line 430 of file RobustStats.hpp.

References ABSOLUTE, GPSTK_RETHROW, GPSTK_THROW, RobustTuningT, and gpstk::sum().

Referenced by GDCPass::WLsigmaStrip().

void QuantilePlot double *  yd,
long  nd,
double *  xd
throw (Exception)
 

Generate data for a quantile-quantile plot.

Given an array of data yd, of length nd (sorted in ascending order), and another array xd of the same length, fill the xd array with data such that (xd,yd) give a quantile-quantile plot. The distribution of yd is a normal distribution to the extent that this plot is a straight line, with y-intercept and slope identified with mean and standard deviation, respectively, of the distribution.

Parameters:
yd array of data, sorted in ascending order.
nd length of array xd.
xd array of length nd containing quantiles of yd on output.

void Quartiles const T *  xd,
const int  nd,
T &  Q1,
T &  Q3
throw (Exception)
 

Compute the quartiles Q1 and Q3 of an array of length nd.

Array is assumed sorted in ascending order. Quartile are values such that one fourth of the samples are larger (smaller) than Q3(Q1).

Parameters:
xd array of data.
nd length of array xd.
Q1 (output) first quartile of data in array xd.
Q3 (output) third quartile of data in array xd.

Definition at line 336 of file RobustStats.hpp.

References GPSTK_THROW.

int RobustPolyFit double *  xd,
const double *  td,
int  nd,
int  n,
double *  c,
double *  w = NULL
throw (Exception)
 

Fit a polynomial of degree n to data xd, with independent variable td, using robust techniques.

The post-fit residuals are returned in the data vector, and the computed weights in the result may be output as well. Specifically, the equation describing the fit is c0 + c[1]*t(j) + c[2]*t(j)*t(j) + ... c[n-1]*pow(t(j),n-1) = xd[j], where the zero-th coefficient and the independent variable are debiased by the first value; i.e. c0 = c[0]+xd[0] and t(j) = td[i]-td[0]. Specifically, to evaluate the polynomial at t, eval = f(t), do the following. xd0 = xd[0]; Robust::RobustPolyFit(xd,td,nd,n,c); eval = xd0+c[0]; tt = 1.0; for(j=1; j<nd; j++) { tt *= (t-td[0]); eval += c[j]*tt; }

Parameters:
xd (input) array of data, of length nd; contains residuals on output.
td (input) array of independent variable, length nd (parallel to xd).
nd (input) length of arrays xd and td.
n (input) degree of polynomial and dimension of coefficient array.
c (output) array of coefficients (dimension n).
w (output, if non-null) array of length nd to contain weights.
Returns:
0 for success, -1 for singular problem, -2 failure to converge.

void StemLeafPlot std::ostream &  os,
double *  xd,
long  nd,
std::string  msg = std::string("")
throw (Exception)
 

Print 'stem and leaf' plot of the data in the double array xd of length nd, with an optional message, on the given output ostream.

It is assumed that the input array xd is sorted in ascending order.

Parameters:
os ostream on which to write output.
xd array of data.
nd length of array xd.
msg string containing optional message for output.


Generated on Wed May 22 03:32:02 2013 for GPS ToolKit Software Library by  doxygen 1.3.9.1