Re: computing z-scores

Поиск
Список
Период
Сортировка
От Ron
Тема Re: computing z-scores
Дата
Msg-id a220c1bf-ab2b-d230-7526-442716f3db5f@gmail.com
обсуждение исходный текст
Ответ на computing z-scores  (Martin Mueller <martinmueller@northwestern.edu>)
Ответы Re: computing z-scores  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-general
On 05/24/2018 10:15 AM, Martin Mueller wrote:
> You construct a z-score for a set of values by subtracting the average from the value and dividing the result by the
standarddeviation. I know how to do this in a two-step procedure. First, I compute the average and standard deviation.
Ina 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
goesbeyond my SQL competence.
 

What about this?

SELECT value, (value - AVG(value))/stddev(value) as zvalue
FROM sometable
WHERE some conditions
GROUP by value


-- 
Angular momentum makes the world go 'round.


В списке pgsql-general по дате отправления:

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: computing z-scores
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: computing z-scores