I have forgotten

• https://me.yahoo.com
COST (GBP)
0.30
0.50
0

# Squared Deviations

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

C++

## Devsq

 template doubledevsq( int n 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:  is a set of data and  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

 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.