FUNCTION
Squared_Deviations
Calculates the sum of squared deviations of a given set of data.
Interface
#include <codecogs/statistics/moments/squared_deviations.h>
using namespace Statistics::Moments;
Returns the sum of squares of deviations of data points from their sample mean. The equation for the sum of squared deviations is:
(1)
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.8Parameters
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
This function's source code is only visible to registered users — documentation and the calculator above are free to use either way. Sign in to see it.