Definition
Median,alsoknownasmidpoint,median.Themedianisthenumberinthemiddleofagroupofdataarrangedinorder,thatis,inthisgroupofdata,halfofthedataislargerthanhim,andhalfofthedataissmallerthanhim.HereweuseTorepresentthemedian.(Note:Themedianisdifferentfromthemode.Themodereferstothelargestnumber.Sometimesthereismorethanonemode,andtherecanonlybeonemedian.)
Thereisasetofdata:
Sortitfromsmallesttolargestasfollows:
WhenNisanoddnumber,;WhenNisanevennumber,.
Atmosthalfofthevaluesinanumbersetarelessthanthemedian,andatmosthalfofthevaluesaregreaterthanthemedian.Ifthenumberofvaluesgreaterthanandlessthanthemedianislessthanhalf,thentheremustbeseveralvaluesinthenumbersetequaltothemedian.
SupposethedistributionfunctionofthecontinuousrandomvariableXis,thenthenumberthatmeetstheconditioniscalledthemedianofXordistributionF.
Features
1)Themedianistherepresentativevalueofthetotalunitmarkvaluedeterminedbyitspositioninallthemarkvalues,andisnotsubjecttothemaximumormaximumvalueofthedistributionsequence.Theinfluenceoftheminimumvalueincreasestherepresentativenessofthemediantothedistributionsequencetoacertainextent.
2)Forsomediscretevariablemonomialseries,whenthefrequencydistributionisskewed,therepresentativenessofthemedianwillbeaffected.
3)Tendtothemiddlepositionofasetofordereddata
Calculationexample
Forasetoffinitenumberofdata,theirmedianAnumberisanumber:halfofthedatainthisgroupofdataislargerthanit,andtheotherhalfofthedataissmallerthanit.Themethodofcalculatingthemedianofafinitenumberofdataistoarrangeallsimilardatainorderofsize.Ifthenumberofdataisodd,themiddledataisthemedianofthisgroupofdata;ifthenumberofdataiseven,thearithmeticaverageofthemiddletwodataisthemedianofthisgroupofdata.
Median:Thatis,thenumberinthemiddleisselected,whichisameasureofcentraltendency.
Example1
Findthemedianofthissetofdata:23,29,20,32,23,21,33,25.
Solution:
Firstarrangethesetofdata(hereinascendingorder),get:
20,21,23,23,25,29,32,33
Becausethissetofdataconsistsof8dataintotal,thatis,nisanevennumber,soaccordingtothemediancalculationmethod,themedian,Whichistheaverageofthefourthandfifthnumbers.
Example2
Findthemedianofthissetofdata:10,20,20,20,30.
Solution:
Firstarrangethesetofdata(hereinascendingorder),get:
10,20,20,20,30
Becausethissetofdataconsistsof5data,thatis,nisanoddnumber,soaccordingtothemediancalculationmethod,themedianis20,whichisthethirdnumber.
Matlabfunction
InMatlab,themedian()functionisabuilt-infunctionforobtainingthemedianofasetofdata.Theusagerulesareasfollows:
M=median(A)
M=median(A,dim)
M=median(___,nanflag)
Example:
Foldall
Themedianofthematrixcolumns
Definea4×3matrix.
A=[011;232;132;422]
A=4×3
011
232
132
422
Calculatethemedianvalueofeachcolumn.
M=median(A)
M=1×3
1.50002.50002.0000
Foreachcolumn,themedianvalueisThemeanvalueofthetwovaluesinthemiddleofthearrangementorder.
Themedianoftherowsofthematrix
Definea2×3matrix.
A=[011;232]
A=2×3
011
232
Calculatethemedianvalueofeachrow.
M=median(A,2)
M=2×1
1
2
Foreachrow,themedianvalueisthevalueinthemiddleofthesortorder.
Differentiationandconnection
1)Theaverageisobtainedbycalculation,soitwillvarywitheachdatachange.
2)Themedianisobtainedbysorting,anditisnotaffectedbythemaximumandminimumextremevalues.Changesinpartofthedatahavenoeffectonthemedian.Whenindividualdatainasetofdatachangesgreatly,itisoftenusedtodescribethecentraltendencyofthissetofdata.
3)Modeisalsoarepresentativenumberofdata,reflectingthedegreeofconcentrationofasetofdata.Indailylife,suchas"best","mostpopular","mostsatisfied",etc.,arerelatedtothemode,whichreflectsamostcommontendency.
Prosandcons:
Average:Itneedsallthedataofthewholegrouptocalculate;itiseasilyaffectedbyextremevaluesinthedata.Median:Itcanbedeterminedonlybyarrangingthedatainorder;itisnoteasilyaffectedbytheextremevaluesinthedata.Mode:Obtainedbycounting;noteasilyaffectedbyextremevaluesinthedata.