theplu::yat::statistics::PearsonDistance Struct Reference

Calculates the Pearson correlation distance between two points given by elements of ranges. More...

#include <yat/statistics/PearsonDistance.h>

List of all members.

Public Member Functions

template<typename Iter1, typename Iter2>
double operator() (Iter1 beg1, Iter1 end1, Iter2 beg2) const
 Calculates the Pearson correlation distance between elements of two ranges.


Detailed Description

Calculates the Pearson correlation distance between two points given by elements of ranges.

This class is modelling the concept Distance.


Member Function Documentation

template<typename Iter1, typename Iter2>
double theplu::yat::statistics::PearsonDistance::operator() ( Iter1  beg1,
Iter1  end1,
Iter2  beg2 
) const [inline]

Calculates the Pearson correlation distance between elements of two ranges.

If elements of both ranges are unweighted the distance is calculated as $ 1-\mbox{C}(x,y) $, where $ x $ and $ y $ are the two points and C is the Pearson correlation.

If elements of one or both of ranges have weights the distance is calculated as $ 1-[\sum w_{x,i}w_{y,i}(x_i-y_i)^2/(\sum w_{x,i}w_{y,i}(x_i-m_x)^2\sum w_{x,i}w_{y,i}(y_i-m_y)^2)] $, where and $ w_x $ and $ w_y $ are weights for the elements of the first and the second range, respectively, and $ m_x=\sum w_{x,i}w_{y,i}x_i/\sum w_{x,i}w_{y,i} $ and correspondingly for $ m_y $. If the elements of one of the two ranges are unweighted, the weights for these elements are set to unity.


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

Generated on Tue Jan 18 02:20:11 2011 for yat by  doxygen 1.5.5