Transcription of 1 Basic ANOVA concepts - Calvin University
1 Math143 ANOVA1 AnalysisofVariance( ANOVA )Recall,whenwewa ntedtocompare twopopulationmeans, 'sexpandthistocomparek 3 ,wecangraphicallygetanideaofwhatis goingonbylookingatside-by-sideboxplots.( , , , ) , weare consideringa quantitativeresponsevariableasit relatestooneormore explanatoryvariables, tthissetting:(i)Whichacademicdepartmenti nthesciencesgivesoutthelowestaveragegrad es?(Explanatoryvari-able:department; Responsevariable:studentGPA's forindividualcourses)(ii)Whichkindofprom otionalcampaignleadstogreateststore incomeatChristmastime?(Explanatoryvariab le:promotiontype; Responsevariable:dailystore income)(iii)Howdothetypeofcareerandmarit alstatusofa personrelatetothetotalcostinannualclaims she/heislikelytomakeonherhealthinsurance .(Explanatoryvariables:careerandmaritals tatus;Responsevariable:healthinsurancepa youts)Eachvalueoftheexplanatoryvariable( orvalue-pair, if there is more thanoneexplanatoryvariable)repre-sentsa ' , ,there are twofactors(explanatoryvariables):aspirin (valuesare takingit or nottakingit )andbetacarotene(valuesagainare takingit or nottakingit ),andthisdividesthesubjectsintofourgroup scorrespondingtothefourcellsofFigure ( ).
2 Hadtheresponsevariableforthisstudybeenqu antitative likesystolicbloodpres-sure level ratherthancategorical,it wouldhavebeenanappropriatescenarioinwhic htoapply(2-way) : The(population)meansofallgroupsundercons iderationare : The(pop.)meansare notallequal.(Note:Thisis differentthansaying theyare all unequal !) (a) (b)( ) , (a)are muchlessconvincingthatthepopulationmeans forthethreepopulationsare differentthanif thevariationsare (b).Thereasonis becausetheratioofvariationbetweengroupst ovariationwithingroupsis (a)thanit is (b).Math143 , ANOVA hassomeunderlyingassumptionswhichshouldb einplaceinordertomaketheresultsofcalcula tionscompletelytrustworthy. Theyinclude:(i)Subjectsare chosenviaa simplerandomsample.(ii)Withineachgroup/p opulation,theresponsevariableis normallydistributed.(iii)Whilethepopulat ionmeansmaybedifferentfromonegrouptothen ext,thepopulationstandarddeviationis , ANOVA is somewhatrobust( ,resultsremainfairlytrustworthydespitemi ldviolationsoftheseassumptions).
3 Assumptions(ii)and(iii)are closeenoughtobeingtrueif,aftergatheringS RSsamplesfromeachgroup,you:(ii)lookatnor malquantileplotsforeachgroupand,ineachca se,seethatthedatapointsfallclosetoaline. (iii)computethestandard deviationsforeachgroupsample, nomore is justoneexplanatoryvariable, is a thenumberofgroups/populations/valuesofth eexplanatoryvariable/levelsoftreatmentni = thesamplesizetakenfromgroupixi j= thejthresponsesampledfromtheithgroup/pop ulation. xi= thesamplemeanofresponsesfromtheithgroup= 1nini j=1xi jsi= thesamplestandard deviationfromtheithgroup=1ni 1ni j=1(xi j xi)2n= the(total)sample,irrespectiveofgroups= ki=1ni. x= themeanofallresponses,irrespectiveofgrou ps=1n i jxi (ratherthanksamplesfromtheindividualgrou ps/populations),onemightmeasurethetotala mountofvariabilityamongobservationsbysum mingthesquaresofthedifferencesbetweeneac hxi jand x:SST(standsforsumof squarestotal)=k i=1ni j=1(xi j x) ANOVA3 (speci cally, variationaroundtheoverallmean x)SSG:=k i=1ni( xi x)2, (speci cally, variationofobservationsabouttheirgroupme an xi)SSE:=k i=1ni j=1(xi j xi)2=k i=1(ni 1) is thecasethatSST=SSG+ thevariabilitybetweengroups/treatmentsis largerelativetothevariabilitywithingroup s/treatments,thenthedatasuggestthattheme ansofthepopulationsfromwhichthedatawere drawnare signi ,infact,howtheFstatisticiscomputed.
4 It isa measure ofthevariabilitybetweentreat-mentsdivide dbya measure ,thevariabilitybetweentreatmentsislarger elativetothevariationwithintreatments, small,thevariabilitybetweentreatmentsis smallrelativetothevariationwithintreatme nts,andwedonotrejectthenullhypothesisofe qualmeans.(Inthiscase,thesampledataiscon sistentwiththehypothesisthatpopulationme ansare equalbetweengroups.)To computethisratio(theFstatistic)is dif weare calledanANOVA table:SourceSSdfMSFM odel/GroupSSGk 1 MSG=SSGk 1 MSGMSER esidual/ErrorSSEn kMSE=SSEn kTotalSSTn 1 Whatare thesethings? Thesource(ofvariability)columntellsusSS= SumofSquares(sumofsquareddeviations):SST measuresvariationofthedataaroundtheovera llmean xSSGmeasuresvariationofthegroupmeansarou ndtheoverallmeanSSEmeasuresthevariationo feachobservationarounditsgroupmean xi Degreesoffreedomk 1forSSG,sinceit measuresthevariationofthekgroupmeansabou ttheoverallmeann kforSSE,sinceit measuresthevariationofthenobservationsab outkgroupmeansn 1forSST, sinceit measuresthevariationofallnobservationsab outtheoverallmeanMath143 ANOVA4 MS=MeanSquare=SS/df:Thisis likea standard forsamplestan-dard deviation( ).
5 Itsnumeratorwasa sumofsquareddeviations(justlikeourSSform ulas),andit is interestingtonotethatanotherformulaforMS EisMSE=(n1 1)s21+ (n2 1)s22+ + (nk 1)s2k(n1 1) + (n2 1) + + (nk 1),whichmayremindyouofthepooledsampleest imateforthepopulationvariancefor2-sample pro-cedures(whenwebelievethetwopopulatio nshavethesamevariance).Infact,thequantit yMSEisalsocalleds2p. TheFstatistic=MSG/MSEI fthenullhypothesisistrue,theFstatisticha sanFdistributionwithk 1 andn kdegreesoffreedominthenumerator/denomina torrespectively. If thealternatehypothesisis true, rejectH0infavorofHaif theFstatisticis suf ,wedeterminewhethertheFstatisticis largeby ndinga , alwaysthesame( ),thetestissingle-tailed(likethechi-squa redtest).Neverthless,toreadthecorrectP-v aluefromthetablerequiresknowledgeofthenu mberofdegreesoffreedomassociatedwithboth thenumerator(MSG)anddenominator(MSE) thenumeratordf,anddowntheleftsideare theFvalues,andtheP-values(theprobability ofgettinganFstatisticlargerthanthatifthe nullhypothesisis true)are : DetermineP(F3,6> )= (F2,20>5)= : A rmwishestocompare fourprogramsfortrainingworkerstoperforma randomlyassignedtothetrainingprograms,wi th5 ,a testis performedperminuteis VarianceSourceSSdfMSFProb> 'stestfor equalvariances:chi2(3)= >chi2= ANOVA5 Statagivesusa lineatthebottom theoneaboutBartlett'stest whichreinforcesourbeliefthatthevari-ance sare.
6 Inanexperimenttoinvestigatetheperformanc eofsixdifferenttypesofsparkplugsintended foruseona two-strokemotorcycle,tenplugsofeachbrand were testedandthenumberofdrivingmiles(atacons tantspeed)untilplugfailure , , : Onemore thingyouwilloften ndonanANOVA tableisR2(thecoef cientofdetermination).Itindicatestherati oofthevariabilitybetweengroupmeansinthes ampletotheoverallsamplevariability,meani ngthatit hasa cance,one- ( ) teststatistic(here it isFdfnumer., dfdenom.), anduseit todeterminea probabilityofgettinga sampleasextremeormore decisionrule:Atthe levelofsigni cance,rejectH0ifP(Fk 1,n k>Fcomputed)< . DonotrejectH0ifP> .IfP> , statethisasourconclusionalongwiththerele vantinformation(F-value,df-numerator, df-denominator,P-value).Ideally, a personconductingthestudywillhavesomeprec onceivedhypotheses(more specializedthantheH0,HawestatedforANOVA, andoneswhichsheheldbefore evercollecting/lookingatthedata) thecase,shemaygoaheadandexplore them(evenif ANOVA didnotindicateanoveralldifferenceingroup means),oftenemployingthemethodofcontrast s.
7 We willnotlearnthismethodasa class,butif youwishtoknowmore, someinformationis ,it is,generallyspeaking,inappro-priatetocon tinuesearchingforevidenceofa differenceinmeansif ourF-valuefromANOVA wasnotsigni ,however,P< , thenweknowthatatleasttwomeansare notequal,andthedooris ,wefollowupa signi cantF-statisticwithpairwisecomparisonsof themeans,toseewhichare signi (assumed)commonstandard deviationofallgroups( ):ti j= xi xjspq1=ni+1= determineif thisti jis statisticallysigni cant,wecouldjustgotoTableDwithn kdegreesoffreedom(thedfassociatedwithsp) .However, dependingonthenumberkofgroups,wemightbed oingmanycomparisons,andrecallthatstatist icalsigni cancecanoccursimplybychance(that,infact, isbuiltintotheinterpretationoftheP-value ),andit becomesmore andmore weare goingtoconductmanytests,andwanttheoveral lprobabilityofrejectinganyofthenullhypot heses(equalmeansbetweengrouppairs)inthep rocesstobenomorethan , thenwemustadjustthesigni cancelevelforeachindividualcomparisontob emuchsmallerthan.
8 There are a numberofdifferentapproacheswhichhavebeen proposedforchoosingtheindividual-testMat h143 2-wayANOVA6signi cancelevelsoastogetanoverallfamilysigni canceof , is availablethatcancarryoutthedetailsandrep orttheresultstous,weare mostlikelyagreeabletousingwhicheverpropo sal(s) doingmultiplecomparisonsisa ,amongothers,theBonferroniapproachforpai rwisecomparisons,whichis anapproachmentionedinourtext, : Recallourdatafroma statisticallysigni nextstep,weuseBonferronimultiplecomparis ons,providinghere theresultsasreportedbyStataComparisonof post-testby program(Bonferroni)Row Mean-|Col Mean|123---------+---------------------- -----------2 |-3| |3 |. | |4 | | therowlabeled`2'meetsthecolumnlabeled`1' ,weare toldthatthesamplemeanresponseforProgram2 was3 lowerthanthemeanresponseforProgram1 (Row Mean- Col Mean= -3), Thus,thisdifferenceis notstatisticallysigni cantatthe5%leveltoconcludethemeanrespons efromProgram1 is cant(atsigni cancelevel5%)meanresponses?
9 Program3 is di erentfromprogram2, withprogram3 is di erentfromprogram1, withprogram1 is di erentfromprogram3, withprogram3 , programs1 and3 are themostsuccessful,withnostatistically-si gni ,otherfactors,suchashowmuchit willcostthecompanytoimplementthetwopro-g rams, :SometimesinsteadofgivingP-values,a software packagewillgeneratecon ,there isnostatisticallysigni populationmeanswhenthepopulationsare classi edaccordingtotwo(categorical) mightliketolookatSAT scoresofstudentswhoare maleorfemale( rstfactor)andeitherhaveorhavenothada preparatorycourse(secondfactor). 'sdietontherat' ,mediumandlowamountsofeachmineral(butoth erwiseidentical) speci edtimeonthediet,thebloodpressure wilbeMath143 are usuallyhavea smallertotalsamplesize,sinceyou're studyingtwothingsatonce[ratdietexample,p . 800] removessomeoftherandomvariability(someof therandomvariabilityisnowexplainedbythes econdfactor, soyoucanmore easily ndsigni cantdifferences) wecanlookatinteractionsbetweenfactors(as igni cantinteractionmeanstheeffectofonevariab lechangesdependingontheleveloftheotherfa ctor).
10 Examplesof(potential)interaction. Radon(high/medium/low) Butif youare exposedtoradonandsmoke, , can'ttalkabouttheeffectofradonwithouttal kingaboutwhetherornotthepersonis a smoker. ageofperson(0-10,11-20,21+)andeffectofpe sticides(low/high) genderandeffectofdifferentlegaldrugs(dif ferentstandard doses)Two-wayANOVA tableBelowis theoutlineofa two-wayANOVA table,withfactorsAandB,havingIandJgroups , 1 SSAMSAMSA/MSEBJ 1 SSBMSBMSB/MSEA B(I 1)(J 1)SSABMSABMSAB/MSEE rrorn I JSSEMSET otaln 1 SSTMath143 A are threedifferentvaluesofF, ' Jgroupshasa normaldistributionwithpotentiallydiffere ntmeans( i j), butwitha commonstandard deviation( ). Thatis,xi jk= i j|{z}groupmean+ i jk|{z}residual,where i jk N(0, )Asusual,wewillusetwo-wayANOVA providedit isreasonabletoassumenormalgroupdistribut ionsandtheratioofthelargestgroupstandard deviationtothesmallestgroupstandard deviationis considerwhethertheclassifyingbydiagnosis (anxiety, depression,CDFS/Courtreferred)andpriorab use(yes/no)isrelatedtomeanBC(BeingCautio us) tablewhere eachcellcontainshemeanBCscore forpeoplewhowere is *D * 2-wayANOVA9 ThetablehasthreeP-values,correspondingto threetestsofsigni : ThemeanBCscore is thesamefor eachof : ThemeanBCscore is notthesamefor all isnotsigni canttorejectthenullhypothesis.