Statistics › Moments ›
Squared Deviations
Calculates the sum of squared deviations of a given set of data.
Controller: CodeCogs
Contents
Dependents
Interface
C++
Devsq
template<class T> doubledevsq( | int | n | |
T* | data | ) |
References:
Example 1
#include <codecogs/statistics/moments/squared_deviations.h> #include <iostream> int main() { int x[5] = {4 , 5 , 8 , 6 , 3}; double sq = Stats::Moments::devsq<int>(5, x); std::cout << "The sum of squared deviations is: " << sq << std::endl; return 0; }
Output:The sum of squared deviations is: 14.8
Parameters
n the size of the population data the actual population data given as an array
Returns
- sum of squared deviations 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.