LTL  2.0.x
Functions
Robust mean and dispersion using Tukey's biweight

Functions

template<class Expr , int N>
Expr::value_type ltl::robust_sigma (const ExprBase< Expr, N > &a, const bool zero=false)
 
template<class Expr , int N>
Expr::value_type ltl::biweight_mean (const ExprBase< Expr, N > &a, typename Expr::value_type *rsigma=NULL, const int maxit=20)
 

Detailed Description

Function Documentation

template<class Expr , int N>
Expr::value_type ltl::robust_sigma ( const ExprBase< Expr, N > &  a,
const bool  zero = false 
)

Calculate a resistant estimate of the dispersion of a distribution. For an uncontaminated distribution, this is identical to the standard deviation. Use the median absolute deviation as the initial estimate, then weight points using Tukey's Biweight. See, for example, "Understanding Robust and Exploratory Data Analysis," by Hoaglin, Mosteller and Tukey, John Wiley & Sons, 1983.

If zero is true, the dispersion is caluculated around the value 0 instead of the average value. For example, if Expr is a vector of residuals, zero should be set to true.

Returns the dispersion, -1 in case of error.

References ltl::average(), ltl::count(), ltl::ExprBase< Derived_T, N_Dims >::derived(), ltl::median_exact(), and ltl::sum().

Referenced by ltl::biweight_mean().

template<class Expr , int N>
Expr::value_type ltl::biweight_mean ( const ExprBase< Expr, N > &  a,
typename Expr::value_type *  rsigma = NULL,
const int  maxit = 20 
)

Calculate the center and dispersion (like mean and sigma) of a distribution using bisquare weighting (Tukey's bisquare). Optionally control the maximum number of iterations in the parameter maxit.

Return the mean, and optionally the dispersion (stddev) in *rsigma.

References ltl::ExprBase< Derived_T, N_Dims >::derived(), ltl::max(), ltl::median_exact(), ltl::robust_sigma(), and ltl::sum().