I have forgotten
my Password

get GPL
this unit 0.50
sub units 0.00


Calculates the absolute deviation of a given set of data.
Controller: CodeCogs




template<class T> doubleavedevintn
T*data )
The absolute deviation of an element of a data set is the absolute difference between that element and a given point. Typically the point from which the deviation is measured is the value of either the median or the mean of the data set.

The average absolute deviation of a data set is the average of the absolute deviations and is a summary statistic of statistical dispersion or variability.

The average absolute deviation of a set \inline {x_1, x_2 ..., x_N} is:

where \inline \overline{x} is the selected value of central tendency of the set about which the average absolute deviation is being measured. In general, the average absolute deviation from the mean is between one and two times the average absolute deviation from the median; it is also less than or equal to the standard deviation.


Wikipedia, http://en.wikipedia.org/wiki/Absolute_deviation

Example 1

#include <codecogs/statistics/moments/avedev.h>
#include <iostream>
int main()
  double x[5] = {3.4 , 7.5 , 8.5 , 0.6 , 3.9};
  double adev = Stats::Moments::avedev<double>(5, x);
  std::cout << "The absolute deviation is: " << adev << std::endl;
  return 0;
The absolute deviation is:2.576


nthe size of the population
datathe actual population data given asa an array


return value the absolute deviation of the given set of data


Anca Filibiu (August 2005)
Source Code

Source code is available when you agree to a GP Licence or buy a Commercial Licence.

Not a member, then Register with CodeCogs. Already a Member, then Login.