skew

Syntax

skew(X, [biased=true])

Arguments

X is a vector/matrix.

biased is a Boolean value indicating whether the result is biased. The default value is true, meaning the bias is not corrected.

Details

Return the skewness of X. The calculation skips NULL values.

The calculation uses the following formula when biased=true:

\(skew(x)=\dfrac{\dfrac{1}{n} {\sum\limits_{i = 1}^{n} (x_i - \bar{x})^3}} {\left(\sqrt{\dfrac{1}{n} {\sum\limits_{i = 1}^{n} (x_i - \bar{x})^2}}\right)^3}\)

If X is a matrix, calculate the skewness of each column of X and return a vector.

Examples

Please note that as the example below uses a random number generator, the result is slightly different each time it is executed.

$ x=norm(0, 1, 1000000);
$ skew(x);
-0.00124

$ x[0]=100;
$ skew(x);
0.983656

$ m=matrix(1..10, 1 2 3 4 5 6 7 8 9 100);
$ m;

#0

#1

1

1

2

2

3

3

4

4

5

5

6

6

7

7

8

8

9

9

10

100

$ skew(m);
[0,2.630083823883674]