Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How To: Get a better average
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2000
Divers
Thread ID:
01447163
Message ID:
01447208
Vues:
27
IOW we are not talking about a scientific sample at all. No offense, and I recognize you have no control over it. It's been an interesting conversation anyway. I like it when UT discussions veer off unexpectedly in scholarly directions <g>.

>Bruce
>
>
>>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.
>
>The number used is set by the user, most users have it set to 10, and 3 is the minimum we allow in the application setup. Now looking at the doctor who sent in the request, increasing the number of cases used in the average also increased the returned average time..just his example. I'm making a guess that the doctor is not happy about what time the system is saying is his average and was hoping for a lower number. In his case, the average is 44 for a specific procedure, when I increased it to 30, it went up to 49. Use the mode average, it returned 34.
>
>> 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.
>
>Correct on how the numbers work. We are leaning that the median solution might be a viable option.
>
>The interesting thing as we have reviewed their data, is that the scheduled time (duration based off our calculation) is within 4% of their actual time on the cases. So overall we feel we're pretty close.
>
>
>>>
>>>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
>>>
>>>
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform