Logo

SKEWNESS_S

Updated 2023-10-24 14:10:39.117000

Syntax

SELECT [westclintech].[wct].[SKEWNESS_S] (
  <@Known_x, float,>)

Description

Use the aggregate function SKEWNESS_S to calculate the sample skewness. The SKEWNESS_S function is an implementation of the EXCEL SKEW function. The formula for SKEWNESS_S is:

 G_1 = \frac{n}{(n-1)(n-2)}\frac{\mu_3}{(\frac{\mu_2}{(n-1)})^{3/2}}

Arguments

@Known_x

the values to be used in the calculation. @Known_x must be of a type float or of a type that implicitly converts to float.

Return Type

float

Remarks

If you want measure the skewness for a population, then use the SKEWNESS_P function.

To calculate the population kurtosis use the KURTOSIS_P function.

To calculate the sample kurtosis use the KURTOSIS_S function.

Examples

SELECT wct.SKEWNESS_S(x) as SKEWNESS_S

FROM

(

    SELECT 30000.0000216303

    UNION ALL

    SELECT 30000.0000565854

    UNION ALL

    SELECT 30000.000038137

    UNION ALL

    SELECT 30000.0000495983

    UNION ALL

    SELECT 30000.0000185861

    UNION ALL

    SELECT 30000.0000863479

    UNION ALL

    SELECT 30000.0000776366

    UNION ALL

    SELECT 30000.0000637985

    UNION ALL

    SELECT 30000.0000939786

    UNION ALL

    SELECT 30000.000031191

    UNION ALL

    SELECT 30000.0000550457

    UNION ALL

    SELECT 30000.0000207558

    UNION ALL

    SELECT 30000.0000805531

    UNION ALL

    SELECT 30000.0000241287

) n(x);

This produces the following result

{"columns":[{"field":"SKEWNESS_S","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"SKEWNESS_S":"0.229491026413433"}]}

In this example, we generate 100 random numbers form the standard normal distribution using the SeiresFloat function and calculate the sample skewness.

SELECT wct.SKEWNESS_S(k.SeriesValue) as SKEWNESS_S

FROM wctMath.wct.SeriesFloat(0, 1, NULL, 100, 'N') k;

This produces the following result (your results will be different).

{"columns":[{"field":"SKEWNESS_S","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"SKEWNESS_S":"-0.153829198515644"}]}