SKEW_q
Updated 2023-10-24 13:59:07.690000
Syntax
SELECT [westclintech].[wct].[SKEW_q] (
<@Values_RangeQuery, nvarchar(4000),>)
Description
Use SKEW_q to return the degree of asymmetry of a distribution. If the distribution has a longer tail less than the maximum, the function has negative skewness. Otherwise it has positive skewness. The equation for skewness is:
\frac{n}{(n-1)(n-2)}\sum_{j=1}^n[\frac{x_j-\bar{x}}{\sigma}]^3
Arguments
@Values_RangeQuery
the select statement, as text, used to determine the values to be used in the SKEW_q calculation.
Return Type
float
Remarks
If there are fewer than three rows in the dataset, then SKEW_q returns an error.
If the sample standard deviation is zero, then SKEW_q returns an error.
For simpler queries use SKEW.
No GROUP BY is required for this function even though it produces aggregated results.
Examples
CREATE TABLE #k1
(
[num] [float] NOT NULL
);
INSERT INTO #k1
VALUES
(91.3698);
INSERT INTO #k1
VALUES
(76.3382);
INSERT INTO #k1
VALUES
(74.5692);
INSERT INTO #k1
VALUES
(85.2957);
INSERT INTO #k1
VALUES
(99.0112);
INSERT INTO #k1
VALUES
(86.99);
INSERT INTO #k1
VALUES
(70.7837);
INSERT INTO #k1
VALUES
(72.834);
INSERT INTO #k1
VALUES
(78.1644);
INSERT INTO #k1
VALUES
(77.7472);
INSERT INTO #k1
VALUES
(66.0627);
INSERT INTO #k1
VALUES
(59.781);
INSERT INTO #k1
VALUES
(68.4793);
INSERT INTO #k1
VALUES
(78.6103);
INSERT INTO #k1
VALUES
(59.8621);
select wct.SKEW_q('Select num from #k1');
This produces the following result
{"columns":[{"field":"column 1","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"column 1":"0.363338937261944"}]}