Skip to content

sampleSkewness

sampleSkewness(x, biased?): number

Defined in: src/sample_skewness.js:27

Skewness is a measure of the extent to which a probability distribution of a real-valued random variable “leans” to one side of the mean. The skewness value can be positive or negative, or even undefined.

Implementation is based on the adjusted Fisher-Pearson standardized moment coefficient, which is the version found in Excel and several statistical packages including Minitab, SAS and SPSS.

Pass biased to opt into the biased coefficient instead, which is the population moment ratio m3 / m2^(3/2). That is what R reports and what scipy returns by default; the adjusted coefficient above is scipy’s bias=False. The two differ by a factor of sqrt(n * (n - 1)) / (n - 2).

number[]

a sample of 3 or more data points

boolean = false

if true, return the biased coefficient

number

sample skewness

4.1.0

if x has length less than 3

sampleSkewness([2, 4, 6, 3, 1]); // => 0.590128656384365
sampleSkewness([2, 4, 6, 3, 1], true); // => 0.3958703373438167