From d723487f67811f1aa3ee13ad8d49a826b6867d41 Mon Sep 17 00:00:00 2001 From: Andy Eschbacher Date: Tue, 25 Aug 2015 23:10:26 -0400 Subject: [PATCH] updated definition --- scripts-available/CDB_Stats.sql | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts-available/CDB_Stats.sql b/scripts-available/CDB_Stats.sql index b9b765b..543b3ee 100644 --- a/scripts-available/CDB_Stats.sql +++ b/scripts-available/CDB_Stats.sql @@ -5,9 +5,10 @@ -- -- Returns: statistical quantity chosen -- +-- References: http://www.itl.nist.gov/div898/handbook/eda/section3/eda35b.htm -- --- Calculate Pearson's moment coefficient of kurtosis +-- Calculate kurtosis CREATE OR REPLACE FUNCTION CDB_Kurtosis ( in_array NUMERIC[] ) RETURNS NUMERIC as $$ DECLARE a numeric; @@ -19,7 +20,7 @@ BEGIN RAISE NOTICE 'avg: %, cnt: %, std: %', a, c, s; - EXECUTE 'SELECT sum(power($1 - e, 4)) / ( $2 * power($3, 4)) + EXECUTE 'SELECT sum(power($1 - e, 4)) / ( $2 * power($3, 4)) - 3 FROM (SELECT unnest($4) e ) x' INTO k USING a, c, s, in_array; @@ -28,7 +29,7 @@ BEGIN END; $$ language plpgsql IMMUTABLE; --- Calculate Pearson's moment coefficient of skewness +-- Calculate skewness CREATE OR REPLACE FUNCTION CDB_Skewness ( in_array NUMERIC[] ) RETURNS NUMERIC as $$ DECLARE a numeric;