Hello, I'm fairly new at writing a query. I can get the Standard Deviation from my data using
Use ThresholdData go Select STDEV(Threshold) StadDevUnitThres, Stdevp(Threshold) StandDevPopUnitThres From dbo.TotalStats
However, I would also like to be able to have the outliers returned as well. Can someone help me with this query???? Thanks! Lori
Answer by David Wimbush ·
I'm no mathematician but I gather there's no fixed definition of 'outlier'. If you also find the mean Threshold you can use the Threshold, MeanThreshold and StadDevUnitThres to identify rows that are most outside the standard range. The trouble is that even the values most outside the range aren't necessarily far outside the range.
A crude way would be something like:
select top (10) percent * from dbo.TotalStats where Threshold < (MeanThreshold - StadDevUnitThres) order by Threshold asc select top (10) percent * from dbo.TotalStats Threshold > (MeanThreshold + StadDevUnitThres) order by Threshold desc
Answer by RBarryYoung ·
SELECT STDEV(Threshold) AS StadDevUnitThres, STDEVP(Threshold) AS StandDevPopUnitThres, MIN(Threshold) AS MinThres, MAX(Threshold) AS MaxThres, FROM dbo.TotalStats
I assume that you are looking for the kind of values that you would use in a "Box & Whiskers" graph.