computing z-scores

From: Martin Mueller <martinmueller(at)northwestern(dot)edu>
To: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: computing z-scores
Date: 2018-05-24 15:15:59
Message-ID: 2CC1AFF5-BB3A-499D-8969-C5B3388ED534@northwestern.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

You construct a z-score for a set of values by subtracting the average from the value and dividing the result by the standard deviation. I know how to do this in a two-step procedure. First, I compute the average and standard deviation. In a second run I use the formula and apply it to each value.

Is there a way of doing this in a single-step procedure or can you chain the two parts together in one query? This goes beyond my SQL competence.

Martin Mueller

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Maxim Boguk 2018-05-24 15:19:48 Re: found xmin from before relfrozenxid on pg_catalog.pg_authid
Previous Message Adrian Klaver 2018-05-24 14:33:50 Re: Extension/Language of plPerl in PostgreSQL

Browse pgsql-hackers by date

  From Date Subject
Next Message Maxim Boguk 2018-05-24 15:19:48 Re: found xmin from before relfrozenxid on pg_catalog.pg_authid
Previous Message Chris Bandy 2018-05-24 15:14:06 Unexpected casts while using date_trunc()