Statistics › Moments ›
Avedev
Calculates the absolute deviation of a given set of data.
Controller: CodeCogs
Contents
Interface
C++
Avedev
template<class T> doubleavedev( | int | n | |
T* | data | ) |
References:
Wikipedia, http://en.wikipedia.org/wiki/Absolute_deviationExample 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; }
Output:The absolute deviation is:2.576
Parameters
n the size of the population data the actual population data given asa an array
Returns
- return value the absolute deviation of the given set of data
Authors
- 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.