Bayes' Theorem Problems, Definition and Examples

文章推薦指數: 80 %
投票人數:10人

For two events, A and B, Bayes' theorem allows you to figure out p(A|B) (the probability that event A happened, given that test B was positive) from p(B|A) (the ... ShareonWhatisBayes’Theorem? WatchthevideoforaquickexampleofworkingaBayes’Theoremproblem: BayesTheoremExample#1WatchthisvideoonYouTube. Can’tseethevideo?Clickhere. Bayes’theoremisawaytofigureoutconditionalprobability.Conditionalprobabilityistheprobabilityofaneventhappening,giventhatithassomerelationshiptooneormoreotherevents.Forexample,yourprobabilityofgettingaparkingspaceisconnectedtothetimeofdayyoupark,whereyoupark,andwhatconventionsaregoingonatanytime.Bayes’theoremisslightlymorenuanced.Inanutshell,itgivesyoutheactualprobabilityofaneventgiveninformationabouttests. “Events”Aredifferentfrom“tests.”Forexample,thereisatestforliverdisease,butthat’sseparatefromtheeventofactuallyhavingliverdisease. Testsareflawed:justbecauseyouhaveapositivetestdoesnotmeanyouactuallyhavethedisease.Manytestshaveahighfalsepositiverate.Rareeventstendtohavehigherfalsepositiveratesthanmorecommonevents.We’renotjusttalkingaboutmedicaltestshere.Forexample,spamfilteringcanhavehighfalsepositiverates.Bayes’theoremtakesthetestresultsandcalculatesyourrealprobabilitythatthetesthasidentifiedtheevent. TheFormula Bayes’Theorem(alsoknownasBayes’rule)isadeceptivelysimpleformulausedtocalculateconditionalprobability.TheTheoremwasnamedafterEnglishmathematicianThomasBayes(1701-1761).Theformaldefinitionfortheruleis: Inmostcases,youcan’tjustplugnumbersintoanequation;Youhavetofigureoutwhatyour“tests”and“events”arefirst.Fortwoevents,AandB,Bayes’theoremallowsyoutofigureoutp(A|B)(theprobabilitythateventAhappened,giventhattestBwaspositive)fromp(B|A)(theprobabilitythattestBhappened,giventhateventAhappened).Itcanbealittletrickytowrapyourheadaroundastechnicallyyou’reworkingbackwards;youmayhavetoswitchyourtestsandeventsaround,whichcangetconfusing.AnexampleshouldclarifywhatImeanby“switchthetestsandeventsaround.” Bayes’TheoremExample#1 Youmightbeinterestedinfindingoutapatient’sprobabilityofhavingliverdiseaseiftheyareanalcoholic.“Beinganalcoholic”isthetest(kindoflikealitmustest)forliverdisease. Acouldmeantheevent“Patienthasliverdisease.”Pastdatatellsyouthat10%ofpatientsenteringyourclinichaveliverdisease.P(A)=0.10. Bcouldmeanthelitmustestthat“Patientisanalcoholic.”Fivepercentoftheclinic’spatientsarealcoholics.P(B)=0.05. Youmightalsoknowthatamongthosepatientsdiagnosedwithliverdisease,7%arealcoholics.ThisisyourB|A:theprobabilitythatapatientisalcoholic,giventhattheyhaveliverdisease,is7%. Bayes’theoremtellsyou: P(A|B)=(0.07*0.1)/0.05=0.14 Inotherwords,ifthepatientisanalcoholic,theirchancesofhavingliverdiseaseis0.14(14%).Thisisalargeincreasefromthe10%suggestedbypastdata.Butit’sstillunlikelythatanyparticularpatienthasliverdisease. MoreBayes’TheoremExamples Bayes’TheoremProblemsExample#2 Anotherwaytolookatthetheoremistosaythatoneeventfollowsanother.AboveIsaid“tests”and“events”,butit’salsolegitimatetothinkofitasthe“firstevent”thatleadstothe“secondevent.”There’snoonerightwaytodothis:usetheterminologythatmakesmostsensetoyou. Inaparticularpainclinic,10%ofpatientsareprescribednarcoticpainkillers.Overall,fivepercentoftheclinic’spatientsareaddictedtonarcotics(includingpainkillersandillegalsubstances).Outofallthepeopleprescribedpainpills,8%areaddicts.Ifapatientisanaddict,whatistheprobabilitythattheywillbeprescribedpainpills? Step1:Figureoutwhatyourevent“A”isfromthequestion.Thatinformationisintheitalicizedpartofthisparticularquestion.Theeventthathappensfirst(A)isbeingprescribedpainpills.That’sgivenas10%. Step2:Figureoutwhatyourevent“B”isfromthequestion.Thatinformationisalsointheitalicizedpartofthisparticularquestion.EventBisbeinganaddict.That’sgivenas5%. Step3:FigureoutwhattheprobabilityofeventB(Step2)giveneventA(Step1).Inotherwords,findwhat(B|A)is.Wewanttoknow“Giventhatpeopleareprescribedpainpills,what’stheprobabilitytheyareanaddict?”Thatisgiveninthequestionas8%,or.8. Step4:InsertyouranswersfromSteps1,2and3intotheformulaandsolve. P(A|B)=P(B|A)*P(A)/P(B)=(0.08*0.1)/0.05=0.16 Theprobabilityofanaddictbeingprescribedpainpillsis0.16(16%). Example#3:theMedicalTest Aslightlymorecomplicatedexampleinvolvesamedicaltest(inthiscase,agenetictest): ThereareseveralformsofBayes’Theoremoutthere,andtheyareallequivalent(theyarejustwritteninslightlydifferentways).Inthisnextequation,“X”isusedinplaceof“B.”Inaddition,you’llseesomechangesinthedenominator.Theproofofwhywecanrearrangetheequationlikethisisbeyondthescopeofthisarticle(otherwiseitwouldbe5,000wordsinsteadof2,000!).However,ifyoucomeacrossaquestioninvolvingmedicaltests,you’lllikelybeusingthisalternativeformulatofindtheanswer: WatchthevideoforaBayes’Theoremexample: BayesTheoremExampleWatchthisvideoonYouTube. Can’tseethevideo?Clickhere. 1%ofpeoplehaveacertaingeneticdefect. 90%oftestsforthegenedetectthedefect(truepositives). 9.6%ofthetestsarefalsepositives. Ifapersongetsapositivetestresult,whataretheoddstheyactuallyhavethegeneticdefect? ThefirststepintosolvingBayes’theoremproblemsistoassignletterstoevents: A=chanceofhavingthefaultygene.Thatwasgiveninthequestionas1%.Thatalsomeanstheprobabilityofnothavingthegene(~A)is99%. X=Apositivetestresult. So: P(A|X)=Probabilityofhavingthegenegivenapositivetestresult. P(X|A)=Chanceofapositivetestresultgiventhatthepersonactuallyhasthegene.Thatwasgiveninthequestionas90%. p(X|~A)=Chanceofapositivetestifthepersondoesn’thavethegene.Thatwasgiveninthequestionas9.6% Nowwehavealloftheinformationweneedtoputintotheequation: P(A|X)=(.9*.01)/(.9*.01+.096*.99)=0.0865(8.65%). Theprobabilityofhavingthefaultygeneonthetestis8.65%. Bayes’TheoremProblems#4:ATestforCancer Iwroteabouthowchallengingphysiciansfindprobabilityandstatisticsinmypostonreadingmammogramresultswrong.It’snotsurprisingthatphysiciansarewayoffwiththeirinterpretationofresults,giventhatsometrickyprobabilitiesareatplay.Here’sasecondexampleofhowBayes’Theoremworks.I’veusedsimilarnumbers,butthequestioniswordeddifferentlytogiveyouanotheropportunitytowrapyourmindaroundhowyoudecidewhichiseventAandwhichiseventX. Q.Giventhefollowingstatistics,whatistheprobabilitythatawomanhascancerifshehasapositivemammogramresult? Onepercentofwomenover50havebreastcancer. Ninetypercentofwomenwhohavebreastcancertestpositiveonmammograms. Eightpercentofwomenwillhavefalsepositives. Step1:AssigneventstoAorX.Youwanttoknowwhatawoman’sprobabilityofhavingcanceris,givenapositivemammogram.Forthisproblem,actuallyhavingcancerisAandapositivetestresultisX. Step2:Listoutthepartsoftheequation(thismakesiteasiertoworktheactualequation): P(A)=0.01 P(~A)=0.99 P(X|A)=0.9 P(X|~A)=0.08 Step3:Insertthepartsintotheequationandsolve.Notethatasthisisamedicaltest,we’reusingtheformoftheequationfromexample#2: (0.9*0.01)/((0.9*0.01)+(0.08*0.99)=0.10. Theprobabilityofawomanhavingcancer,givenapositivetestresult,is10%. Rememberwhen(upthere^^)IsaidthattherearemanyequivalentwaystowriteBayesTheorem?Hereisanotherequation,thatyoucanusetofigureouttheaboveproblem.You’llgetexactlythesameresult: Themaindifferencewiththisformoftheequationisthatitusestheprobabilitytermsintersection(∩)andcomplement(c).Thinkofitasshorthand:it’sthesameequation,writteninadifferentway. Inordertofindtheprobabilitiesontherightsideofthisequation,usethemultiplicationrule: P(B∩A)=P(B)*P(A|B) Thetwosidesoftheequationareequivalent,andP(B)*P(A|B)iswhatwewereusingwhenwesolvedthenumeratorintheproblemabove. P(B)*P(A|B)=0.01*0.9=0.009 Forthedenominator,wehaveP(Bc∩A)aspartoftheequation.Thiscanbe(equivalently)rewrittenasP(Bc*P(A|Bc).Thisgivesus: P(Bc*P(A|Bc)=0.99*0.08=0.0792. Insertingthosetwosolutionsintotheformula,weget: 0.009/(0.009+0.0792)=10%. Bayes’TheoremProblems:AnotherWaytoLookatIt. Bayes’theoremproblemscanbefiguredoutwithoutusingtheequation(althoughusingtheequationisprobablysimpler).Butifyoucan’twrapyourheadaroundwhytheequationworks(orwhatit’sdoing),here’sthenon-equationsolutionforthesameproblemin#1(thegenetictestproblem)above. Step1:Findtheprobabilityofatruepositiveonthetest.Thatequalspeoplewhoactuallyhavethedefect(1%)*truepositiveresults(90%)=.009. Step2:Findtheprobabilityofafalsepositiveonthetest.Thatequalspeoplewhodon’thavethedefect(99%)*falsepositiveresults(9.6%)=.09504. Step3:Figureouttheprobabilityofgettingapositiveresultonthetest.Thatequalsthechanceofatruepositive(Step1)plusafalsepositive(Step2)=.009+.09504=.0.10404. Step4:Findtheprobabilityofactuallyhavingthegene,givenapositiveresult.Dividethechanceofhavingareal,positiveresult(Step1)bythechanceofgettinganykindofpositiveresult(Step3)=.009/.10404=0.0865(8.65%). OtherformsofBayes’Theorem Bayes’Theoremhasseveralforms.Youprobablywon’tencounteranyoftheseotherformsinanelementarystatsclass.Thedifferentformscanbeusedfordifferentpurposes.Forexample,oneversionuseswhatRudolfCarnapcalledthe“probabilityratio“.Theprobabilityratiorulestatesthatanyevent(likeapatienthavingliverdisease)mustbemultipliedbythisfactorPR(H,E)=PE(H)/P(H).Thatgivestheevent’sprobabilityconditionalonE.TheOddsRatioRuleisverysimilartotheprobabilityratio,butthelikelihoodratiodividesatest’struepositiveratedividedbyitsfalsepositiverate.TheformaldefinitionoftheOddsRatioruleisOR(H,E)=PH,(E)/P~H(E). BayesianSpamFiltering AlthoughBayes’Theoremisusedextensivelyinthemedicalsciences,thereareotherapplications.Forexample,it’susedtofilterspam.Theeventinthiscaseisthatthemessageisspam.Thetestforspamisthatthemessagecontainssomeflaggedwords(like“viagra”or“youhavewon”).Here’stheequationsetup(fromWikipedia),readas“Theprobabilityamessageisspamgiventhatitcontainscertainflaggedwords”: Theactualequationsusedforspamfilteringarealittlemorecomplex;theycontainmoreflagsthanjustcontent.Forexample,thetimingofthemessage,orhowoftenthefilterhasseenthesamecontentbefore,aretwootherspamtests. Next:InverseProbabilityDistribution References Dodge,Y.(2008).TheConciseEncyclopediaofStatistics.Springer. Everitt,B.S.;Skrondal,A.(2010),TheCambridgeDictionaryofStatistics,CambridgeUniversityPress. Gonick,L.(1993).TheCartoonGuidetoStatistics.HarperPerennial. CITETHISAS:StephanieGlen."Bayes’TheoremProblems,DefinitionandExamples"FromStatisticsHowTo.com:ElementaryStatisticsfortherestofus!https://www.statisticshowto.com/probability-and-statistics/probability-main-index/bayes-theorem-problems/ --------------------------------------------------------------------------- Needhelpwithahomeworkortestquestion?WithCheggStudy,youcangetstep-by-stepsolutionstoyourquestionsfromanexpertinthefield.Yourfirst30minuteswithaCheggtutorisfree! Comments?Needtopostacorrection?PleasepostacommentonourFacebookpage. StatisticsHowToFacebookPage Search NEEDHELPwithahomeworkproblem?CLICKHERE!Needhelpwithahomeworkortestquestion?WithCheggStudy,youcangetstep-by-stepsolutionstoyourquestionsfromanexpertinthefield.Yourfirst30minuteswithaCheggtutorisfree! Feellike“cheating”atStatistics?CheckoutourPracticallyCheatingStatisticsHandbook,whichgivesyouhundredsofeasy-to-followanswersinaPDFformat.Recommendedreadingattopuniversities! NEEDHELPwithahomeworkproblem?CLICKHERE! Latestarticles OmnibusTest ContrastAnalysis SampleSpaceExamplesandTheCountingPrinciple NRMSE TestStatistic:Definition,TypesofTestStatistic EulerDiagram:HowtoDrawoneinEasySteps X-MR(X-MovingRange)Chart BiasinStatistics:Definition,SelectionBias&SurvivorshipBias NEEDHELPwithahomeworkproblem?CLICKHERE!



請為這篇文章評分?