Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How To: Get a better average
Message
From
02/02/2010 17:00:21
 
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2000
Miscellaneous
Thread ID:
01447163
Message ID:
01447191
Views:
34
I haven't read the entire thread, but I will throw out a couple of other thoughts.

Why are you using only the previous 10 cases? Could you use more? Generally a minimum of 30 samples provides a better estimate, and that is in the case of a normal distribution. I would guess that you have a positively skewed distribution (a case time can't be < 0, however it can be some arbitrarily large number). In that situation, median is probably a better estimate of "central tendency" than average.

>Right now, when cases are being entered, the estimated procedure time is based on the average, or mean, of the durations of the previous 10 cases. Because averages include outlying very short as well as very long cases, this often leads to inaccurate estimates which have to be overridden by the person entering the new case. Below is the query I currently use. I'm wondering if there is a better way to calculate the average time, rather than using the straight AVG() function. One of the users of our system suggested using the 90th percentile method...but I don't really know (or couldn't find) what that would produce or be implemented. So I turn to all the math guru's here at UT and ask for your help and insight.
>
>Thanks in advance.
>Kirk
>
>
>declare @tiPerID int
>declare @tiProcID int
>set @tiPerID=1135
>set @tiProcID = 14161
>
>SELECT
>	avg(det.ortime) as AvgORMinutes
>	FROM (select top 10
>		dbo.meetings.enteror, dbo.meetings.exitor,
>		datediff(mi,enteror,exitor) as ORTime,meetproc.procid
>	      FROM   dbo.meetings (nolock) INNER JOIN
>		dbo.meetproc (nolock) ON dbo.meetings.meetingnumber = dbo.meetproc.meetingnumber
>	      WHERE  (dbo.meetproc.coperid = @tiPerID) AND (dbo.meetings.iscompleted = 1)
>		  AND  (dbo.meetproc.procid=@tiProcID)
>                  ------------------------------------------------
>                  -- Filter so we only include cases where this
>                  -- was the only procedure included on the case
>                  ------------------------------------------------
>		  AND (SELECT COUNT(*) 
>			FROM dbo.meetproc mp (nolock) 
>			WHERE dbo.meetings.meetingnumber = mp.meetingnumber
>			AND (dbo.meetproc.coperid = @tiPerID) 
>			AND  (dbo.meetproc.procid=@tiProcID)) = 1 
>	      ORDER BY endtime desc )det
>group by det.procid
>
>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform