Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Statistical function usage

Author  Topic 

ddamico
Yak Posting Veteran

76 Posts

Posted - 2010-11-21 : 08:11:22
Good day, I have a question regarding use of statistical function specifically STDEV vs STDEVP

The code I have been tasked with porting was the following

SQRT((SQUARE(M1-M_AVG) + SQUARE(M2-M_AVG) + SQUARE(M3-M_AVG)) / 2)

I wrote the aggregate using STDEV(Mn-M_AVG) since I have moved my individual M1,M2,...,Mn to separate rows.

What I am really wondering is STDEV correct or should I be using STDEVP. Also, do I even need to calculate the Mn-M_AVG or is it assumed?

Any help would be appreciated.

elwoos
Master Smack Fu Yak Hacker

2052 Posts

Posted - 2010-11-22 : 06:21:02
quote:
Originally posted by ddamico

What I am really wondering is STDEV correct or should I be using STDEVP.



It's a very very long time since I have done any statistics but if I remember rightly this depends on what you data represents. STDEV is used if it is a sample and STDEVP if it is the population. There is some more information here http://social.msdn.microsoft.com/Forums/en/sqlanalysisservices/thread/0d8edea2-f08e-41b7-b120-8ac08855c23b

-----------

I used to think I wasn't a morning person but it never got better in the afternoon
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2010-11-22 : 06:44:27
SQRT(POWER(M1 - M_AVG, 2.E) + POWER(M2 - M_AVG, 2.E) + POWER(M3 - M_AVG, 2.E)) / 2.E)




N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page
   

- Advertisement -