MAKE A MEME View Large Image Weighted median.svg en Two charts showing the difference between an ordinary median and a weighted median The weight of the element in the list is are indicated by the widths of the boxes and the value by height The median element is shown ...
View Original:Weighted median.svg (306x412)
Download: Original    Medium    Small Thumb
Courtesy of:commons.wikimedia.org More Like This
Keywords: Weighted median.svg en Two charts showing the difference between an ordinary median and a weighted median The weight of the element in the list is are indicated by the widths of the boxes and the value by height The median element is shown in red 2013-12-02 21 17 28 own Bscan <source lang 'matlab'> Python code shown below This code is issued under the Creative Commons CC0 License from pylab import Arbitrary values that result in a good illustrative example data array 1 3 4 5 8 8 5 9 10 5 11 weights array 0 24 0 60 0 33 0 28 0 2 0 39 0 2 0 1 0 18 bar_spacing 0 02 Distance between adjacent bars Non-medians are blue and the median is red colors 'b' 'b' 'b' 'b' 'r' 'b' 'b' 'b' 'b' colorsw 'b' 'b' 'b' 'r' 'b' 'b' 'b' 'b' 'b' normalize the weights only needed to get the two plots to line up weights weights / sum weights unweights ones data __len__ /data __len__ Equal weighting The locations start at zero and are spaced by the width locations concatenate array 0 cumsum bar_spacing + unweights -1 locations_w concatenate array 0 cumsum bar_spacing + weights -1 figure subplot 2 1 1 bar locations data width unweights color colors ylabel 'Value' tick_params axis 'x' which 'both' bottom 'off' top 'off' labelbottom 'off' xlim -0 02 sum unweights+0 02 grid xticks subplot 2 1 2 bar locations_w data width weights color colorsw ylabel 'Value' tick_params axis 'x' which 'both' bottom 'off' top 'off' labelbottom 'off' xlim -0 02 sum weights+0 02 grid xticks </source> cc-zero Uploaded with UploadWizard Statistical charts
Terms of Use   Search of the Day