Re: Covariance Function in Postgresql??

From: Joe Conway <mail(at)joeconway(dot)com>
To: Jonathan Nichols <jonathan(dot)nichols(at)sbcglobal(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Covariance Function in Postgresql??
Date: 2003-04-08 22:57:09
Message-ID: 3E9353C5.2050404@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Jonathan Nichols wrote:
> I'm looking to take the covariance of two columns in a postgresql
> table. I know there are sum, average, variance and standard deviation
> functions. Is there a covariance function hiding somewhere?

There is no built in aggregate for covariance. In fact, there is no
notion of an aggregate that works across two columns (at least that I'm
aware of). But you could use PL/R to create a function that executes a
sql statement and calculates covariance. For more on PL/R, see:
http://www.joeconway.com/

HTH,

Joe

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2003-04-08 23:24:48 Re: extracting time from a timestamp with time zone field
Previous Message Medi Montaseri 2003-04-08 22:45:44 Re: Cross database reference (databases are on the same