I need to calculate weighted median return for a portfolio (using MATLAB). There is information available online: MATLAB Central/rates&weights and Excel/note 4+4+4+7+7/5 logic
How would you calculate weighted median for following portfolios with given weights and returns?
Much of online help is about returns with frequencies. I think the Matlab code in the solution above does not account for ties correctly.
Eg. A portfolio has 6 investments with the following returns:
A B C D E F
weights: 0.1 0.1 0.1 0.2 0.1 0.4
returns: 10% 20% 30% 1% 2% 1%
weighted mean = *easy!*
weighted median = 1%??
A B C D E F G H
weights: 0.15 0.1 0.15 0.09 0.01 0.01 0.14 0.35
returns: 0.05% 1% 1% 1% 1% 2% 2% 5%
weighted mean = *easy!*
weighted median = 1.5%?? <or should it be (1+1+1+1+2+2)/6??>