I have forgotten
my Password

Or login with:

  • Facebookhttp://facebook.com/
  • Googlehttps://www.google.com/accounts/o8/id
  • Yahoohttps://me.yahoo.com
get GPL
COST (GBP)
this unit 0.30
sub units 0.50
+
0

Squared Deviations

Calculates the sum of squared deviations of a given set of data.
Controller: CodeCogs

get GPL add to cart

Dependents

Info

Interface

C++

Devsq

 
template<class T> doubledevsqintn
T*data )
Returns the sum of squares of deviations of data points from their sample mean. The equation for the sum of squared deviations is:

where: {x_1, x_2 ..., x_N} is a set of data and \overline{x} is the arithmetic mean.

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

nthe size of the population
datathe 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.