March 11, 2010 at 6:46 am
I have run across a stored procedure that makes a calculation and returns the value in a column called rate. There are multiple rows of data being analyzed. Each row has a denominator column (which is the count of something) and a Median Column (the median value of something). The "rate" is calculated by the following formula in T-SQL: SUM(denominator * median) / SUM(denominator).
I have been unsuccessful in determining exactly what this formula is attempting to communicate. Does anyone recognize this?
March 11, 2010 at 7:41 am
It looks like some sort of weighted average. Not sure. The denominator label throws me off. You really have
sum (count * average) / sum ( count)
March 11, 2010 at 10:16 am
Steve Jones - Editor (3/11/2010)
It looks like some sort of weighted average. Not sure. The denominator label throws me off. You really havesum (count * average) / sum ( count)
Here are the details. I think you are right about this being some sort of weighted average.
Pre-aggregated data (1 row per episode)
ID - identifier
Date
Value - a number of representing some value
Aggregated data (1 row per month)
Month
Denominator = Count of ID's in that Month
Median = the Median value of Values in the given month
Report using Aggregated data for the Quarter
Quarter - the Quarter reporting on (3 months of data)
Rate = SUM(Denominator * Median) / SUM(Denominator)
March 11, 2010 at 2:11 pm
Steve Jones - Editor (3/11/2010)
It looks like some sort of weighted average. Not sure. The denominator label throws me off. You really havesum (count * average) / sum ( count)
It's what you call the "average median". (technically this is a "weighted average median").
Think Census terms like "the average median household income"
----------------------------------------------------------------------------------
Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply