Run Mann Whitney Test Excel

download Run Mann Whitney Test Excel

of 6

Transcript of Run Mann Whitney Test Excel

  • 7/31/2019 Run Mann Whitney Test Excel

    1/6

    8:MakinganExcelfiletocalculatetheMannWhitneyUtest

    Unfortunately,makinganExcelfilefortheMannWhitneyUtestisquitecumbersomebecause:

    1. Exceldoesnotincludethepvaluesofthetest2. ExcelsRankfunctiondoesnotgivegoodvaluesfortiedscores

    Becauseofthefirstproblem,wewillnotbeabletocalculatecorrectpvaluesforN1andN2valueslowerthan20(seep.

    204forhowthestandardnormaldistributioncanbeusedasanapproximationwhensamplesizesarelargerthan20).

    InthisexamplewewillmakeanExcelfileforthestudywithpsychologyandsociologystudentspresentedinTable8.3(p

    205ofthebook).Onthewebsiteyoufindaprogramthatisslightlymorecomplicatedbecauseitallowsyoutoenter

    dataforsamplesizesupto100.

    Startbydefiningbothcolumnsand

    enteringthe

    data:

  • 7/31/2019 Run Mann Whitney Test Excel

    2/6

    First,wecalculatetheMediansof

    bothconditions:

    Nextwecalculatetheranks.

    MicrosofthasafunctionRank,

    whichdoesthis.Letsuseit.We

    definecellD2astherankofcellA2.

    Thisrank

    must

    be

    calculated

    over

    all

    valuesoftheAandtheBcolumn.

    Wedothisasfollows:

    Fillinthevariouspartsofthepanel

    thatappears.Inthefirstcellyou

    identifythecellforwhichtherank

    mustbecalculated(A2).Inthe

    secondyouidentifythewholerange

    ofvalues,whichgoesfromcellA2to

    cellB11.Becarefulherethatyou

    use$signs,becausewewantthese

    valuestobefixedwhenwecopythe

    functiontoothercells.Finally,inthe

    thirdpanelenter1,togetascending

    ranks(i.e.,startingwiththelowest

    valuesandgoingtothehighest).

    Thisishowitshouldlooklike:

  • 7/31/2019 Run Mann Whitney Test Excel

    3/6

    NowcopycellD2(clickonitand

    pressCTRLC).Thenactivateallcells

    fromD2toE11(byholdingtheleft

    buttonofthemousepressedand

    goingwiththecursoroverthe

    differentcells)andpastethe

    functionintothesecells(byusing

    CTRLV):

    Tocalculatetheexactranks,wehavetocorrectExcel.Thisisdonebytakingtothetotalnumberofobservations

    plusoneandsubtractfromthistherankscalculatedinascendinganddescendingorders,andthendividingthis

    by2.Letsillustrate:

    Inourexample,thetotalnumberofobservationsis20.Theascendingrankofthescore80(cellA2)accordingto

    Excelis15(seeabove),thedescendingrankis6(i.e.,80isthe6thlargestvalueobserved).Enteringthesevalues

    intothecorrectionequationgives:(20+1156)/2=0.So,thereisnocorrectionneeded(becausethereisonly1

    valueof80).Nowforthescore90(ofwhichthereare3),wegetthefollowingcorrection:theascendingrank

    accordingto

    Excel

    is

    17

    (see

    above),

    the

    descending

    rank

    is

    2(because

    90

    is

    the

    2nd

    largest

    value

    observed).

    This

    givesusthecorrection:(20+1172)2=1.So,theExcelranksforthescores90mustbecorrectedby+1.

  • 7/31/2019 Run Mann Whitney Test Excel

    4/6

    Assaid,itallisquite

    cumbersome,butwithabit

    ofprogrammingyouare

    there.Thetotalnumberof

    observationsisobtained

    withthefunctionCount,

    therankswiththeRank

    function(both

    ascending

    anddescending).Sothe

    correctionwilllookas

    follows

    (COUNT($A$2:$B$11)+1

    RANK(A2,$A$2:$B$11,1)

    RANK(A2,$A$2:$B$11,0))/2,

    asshownbelow:

  • 7/31/2019 Run Mann Whitney Test Excel

    5/6

    Whenyounowcopythe

    functionofcellD2tothe

    othercells,yougetthe

    correctranksasgivenin

    Table8.4ofthebook(p.

    206):

    Nowthatwehavecorrect

    ranks,itiseasytoplugin

    thevarious

    functions.

    Here

    wego:

    Whenallfunctionshave

    beenenteredandrunyou

    get:

  • 7/31/2019 Run Mann Whitney Test Excel

    6/6

    Thenextannoyanceisthat

    Exceldoesnotallowusto

    calculatethepvaluesfor

    samplesizesbelow20.So,

    youwillhavetocheck

    AppendixCofthebookfor

    that(p.401).Forlarger

    values,we

    can

    make

    use

    of

    theapproximation

    describedonp.204.As

    shownbelow:

    Thisgivesthefollowing

    values(whichare

    approximate,giventhatthe

    samplesizesareonly10):

    So,nowyouknoweverythingtorunMannWhitneyUtestsyourself!