Skip to content

Median on Aggregated data

3 messages · Satsangi, Vivek (GE Capital), David Winsemius, William Dunlap

#
On Nov 18, 2009, at 4:55 PM, Satsangi, Vivek (GE Capital) wrote:

            
Not sure and I see no reproducible dataset (that I recognize), but  
Harrell's  Hmisc:::wtd.quantile might be an alternate approach.
#
You could use S+.  Its median function has
a weights argument.  E.g.,
   > median(c(1,2,3,4e4), weights=c(1e8,1e8,1,2e8))
   [1] 3
   > median(c(1,2,3,4e4),  weights=c(1e8,1e8,1,2e8+10))
   [1] 40000
   > median(c(1,2,3,4e4),  weights=c(1e8,1e8,1,2e8+1))
   [1] 20001.5

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com