FUNCTION
Skewness
Calculates the skewness of a given set of data.
Interface
#include <codecogs/statistics/moments/skewness.h>
using namespace Statistics::Moments;
Skewness is a measure of symmetry, or more precisely, the lack of symmetry. A distribution, or data set, is symmetric if it looks the same to the left and right of the center point. For univariate data , the formula for skewness is:
(1)
where is the aritmetic mean,
is the standard deviation, and N is the number of data points.
The skewness for a normal distribution is zero, and any symmetric data should have a skewness near zero. Negative values for the skewness indicate data that are skewed left and positive values for the skewness indicate data that are skewed right.
Example 1
#include <codecogs/statistics/moments/skewness.h>
#include <iostream>
int main()
{
float x[5] = {3.4 , 7.1 , 1.5 , 8.6 , 4.9};
double skew = Stats::Moments::skewness<float>(5, x);
std::cout << "The population skewness is: " << skew << std::endl;
return 0;
}Output:
The population skewness is:-0.0107687Parameters
n
the size of the population
data
the actual population data given as an array
Returns
the skewness 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.