skew#

swordfish.function.skew()#

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

The calculation uses the following formulas in different cases:

  • When biased=true:

\[\begin{align*} \operatorname{skew}(x) &= \frac{\tfrac{1}{n}\sum_{i=1}^n \bigl(x_i-\overline{x}\bigr)^3}{\Bigl(\sqrt{\tfrac{1}{n}\sum_{i=1}^n \bigl(x_i-\overline{x}\bigr)^2}\Bigr)^3} \end{align*}\]
  • When biased=false:

\[\begin{align*} \operatorname{skew}(x) &= \frac{\sqrt{n(n-1)}}{\,n-2\,}\cdot \frac{\displaystyle\frac{1}{n}\sum_{i=1}^n (x_i-\bar{x})^3} {\left(\displaystyle\sqrt{\frac{1}{n}\sum_{i=1}^n (x_i-\bar{x})^2}\right)^3} \end{align*}\]

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

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

The skew function also supports querying partitioned tables and distributed tables with bias correction.

Parameters:
  • X (Constant) – A vector/matrix.

  • biased (Constant, optional) – A Boolean value indicating whether the result is biased, by default DFLT.