> Mean is just sum(col)/count(col)
You can also just use avg(col).
Either way, be careful because nulls may not be treated as you want for
such calculations.
The stats package R can access Postgres databases, and can be used for
robust statistical analyses of the data.
See:
http://sourceforge
/* On the test stub: */
[snip]
double data[30];
int main(void)
{
size_t i;
size_t size = sizeof(data) / sizeof(data[0]);
for (i = 0; i < size; i++) {
data[i] = rand();
}
for (i = 0; i < size; i++) {
cout << data[i] << end
Mean is just sum(col)/count(col)
Mode can be calculated with having, max, count
Median can be computed by sorting, using a cursor, and going to the
middle.
There are more efficient and better (more accurate) ways to do it, but
those have to be implemented at a low level. Of course, since you have
On Fri, Mar 18, 2005 at 01:37:10PM -0500, Hrishikesh Deshmukh wrote:
> Hi All,
>
> Is there a way to simple statistics like mean/median/mode in
> PostgreSQL. I have tables like PsetID | IntensityValue. I want to
> find out mean (intensityValue) of some PsetID(s)?!
> Any urls/pointers/books would