Stat 13, Intro. to Statistical Methods for the Life and ...frederic/13/F16/day02.pdfStat 13, Intro....
Transcript of Stat 13, Intro. to Statistical Methods for the Life and ...frederic/13/F16/day02.pdfStat 13, Intro....
Stat 13, Intro. to Statistical Methods for the Life and Health Sciences.
1. Textbook versions and hw.2. p-values. 3. Heart transplant example.4. What influences p-values and strength of evidence, elections example.5. Normal distribution, CLT, and halloween candy example. 6. 1-sided and 2-sided tests. 7. Validity conditions for testing proportions.
Read chapter 1.Hw1 is due Tue 10/4. 1.3.16, 1.4.26, and the names and emails of 2 students.http://www.stat.ucla.edu/~frederic/13/F16Switching sections is proving difficult. About 8 people want out of A, but nobody wants A. And a lot of people want to go from B to C or D but nobody wants the other way so far.
1
1. Textbook and hw.If you have a different edition of the textbook than the 2016 edition, then make sure you are doing the correct hw problems. Hw1 is due Tue 10/4. 1.3.16, 1.4.26, and the names and emails of 2 students.
1.3.16 is on p84 and is about Rhesus monkeys, exercise 1.2.18, which is on p80. It starts "For this study: a. State the null hypothesis and the alternative hypothesis in the context of this study. b. Determine the standardized statistic from the data. (Hint: you will need to get the standard deviation of the simulated statistics from the null disttibution in an applet." But you don't need an applet. You can use the theoretical value of √[π(1-π)/n], where π is the probability of the monkey getting it right under the null hypothesis, or do simulations in R. For instance, in R you could do:pi2 = ## insert your answer to the null hypothesis part of question a here.a = rep(0,10000)for(i in 1:10000){
b = runif(40)c = (b < pi2)a[i] = mean(c)
}sd(a)## compare withsqrt(pi2 * (1-pi2) / n) 2
Stat 13, Intro. to Statistical Methods for the Life and Health Sciences.
Hw1 is due Tue 10/4. 1.3.16, 1.4.26, and the names and emails of 2 students.
1.4.26 is on p90. It starts "Researchers wanted to test the hypothesis that living in the country is better for your lungs than living in a city."Be careful in part c. The table gives you P(# of heads = i), not P(# of heads ≥ i), for i = 0,1,2,3,..., 7.
3
2.p-values.Thep-valueistheprobability,assumingHoistrue,thattheteststatisticwillbeatleastasextremeasthatobserved.
"Whatarethechancesofthat?"
Thekeyideaisthattheconventionistocomputetheprobabilityofgettingsomethingasextremeasyouobservedormoreextreme.e.g.n=5,πo =50%,p=4/5.Theprobabilitythatp=4/5is15.625%.However,whatifn=400,πo =50%,andp=201/400?Nowtheprobabilityofgetting201/400is3.97%,butobviouslythedataareconsistentwiththenullhypothesisthatπ=50%.
Typically,onedoesatwo-sidedtest,whichmeansthatby"extreme",wemeanextremeineitherdirection.Wewanttoseehowinlineourobservedvalueofp=15.34%iswithournullhypothesisofapopulationpercentageof10%.Couldoursampleof15.34%pretermhavecomefromapopulationof10%preterm?Asimulationwithp>15.34%wouldbemoreextremethanwhatweobserved,andalsoasimulationwithp<4.66%wouldbemoreextremethanwhatweobserved.
4
Guidelinesforevaluatingstrengthofevidencefromp-values
• p-value>0.10,notmuchevidenceagainstnullhypothesis
• 0.05<p-value< 0.10,moderateevidenceagainstthenullhypothesis
• 0.01<p-value< 0.05,strongevidenceagainstthenullhypothesis
• p-value< 0.01,verystrongevidenceagainstthenullhypothesis
a=rep(0,10000)for(i in1:10000){x=runif(254); a[i]=mean(x<.1)}hist(a*100,main="simulatedpretermpercentages",nclass=100,
xlab="percentagepreterminsample")abline(v=15.34)lmean(abs(a-.10)>.0534)##0.0051sd(a-.10)##0.01885409sqrt(.10*.90/254)## 0.01882367
6
simulated preterm percentages
percentage preterm in sample
Frequency
5 10 15
0200400600800
ContinuingtheHGexamplefromlasttime,usingsimulationsofHoweobtainedsamplesof254values,andjustbychance,in0.51%ofthesesamples,atleast15.34%ormorewerepretermorlessthan4.66%werepreterm.Sowe'dsaythep-valueis0.51%forthistwo-sidedtest.Theobserveddifferenceishighlysignificant,andwehavestrongevidenceagainstthenullhypothesisofHGpregnancieshavinga10%chanceofbeingpretermlikeotherpregnancies.
7
3.HeartTransplantExample.
Example1.3
HeartTransplants
• TheBritishMedicalJournal(2004)reportedthathearttransplantsatSt.George’sHospitalinLondonhadbeensuspendedafteraspikeinthemortalityrate
• Ofthelast10hearttransplants,80%hadresultedindeathswithin30days
• Thismortalityratewasoverfivetimesthenationalaverage.
• Theresearchersused15%asareasonablevalueforcomparison.
HeartTransplants• DoesahearttransplantpatientatSt.George’shaveahigherprobabilityofdyingthanthenationalrateof0.15?
• Observationalunits– Thelast10hearttransplantations
• Variable– Ifthepatientdiedornot
• Parameter– TheactualprobabilityofadeathafterahearttransplantoperationatSt.George’s
HeartTransplants
• Nullhypothesis:DeathrateatSt.George’sisthesameasthenationalrate(0.15).
• Alternativehypothesis:DeathrateatSt.George’sishigherthanthenationalrate.
• H0:𝜋 =0.15 Ha:𝜋 >0.15
• Ourstatistic is8outof10(�̂� =0.8)
HeartTransplants
Simulation• Nulldistributionof1000repetitionsofdrawingsamplesof10“patients”wheretheprobabilityofdeathisequalto0.15.
Whatisthep-value?
HeartTransplants
StrengthofEvidence• Ourp-valueis0,sowehaveverystrongevidence
againstthenullhypothesis.• Evenwiththisstrongevidence,itwouldbeniceto
havemoredata.• Researchersexaminedtheprevious361heart
transplantationsatSt.George’sandfoundthat71diedwithin30days.
• Ournewstatistic,�̂�,is71/361≈0.1967
HeartTransplants
• Hereisanulldistributionandp-valuebasedonthenewstatistic.
HeartTransplants
• Thep-valuewasabout0.003• Westillhaveverystrongevidenceagainstthenullhypothesis,butnotquiteasstrongasthefirstcase
• Anotherwaytomeasurestrengthofevidenceistostandardize theobservedstatistic
TheStandardizedStatistic
• Thestandardizedstatisticisthenumberofstandarddeviationsoursamplestatisticisabovethemeanofthenulldistribution(orbelowthemeanifitisnegative).
• z= statistic$meanofnulldistributionstandarddeviationofnulldistribution
• Forasingleproportion,wewillusethesymbolz forstandardizedstatistic.
• Note:Intheformulaabove,wecaneitherusethemeanoftheactualnulldistributionor(betteryet)thelong-termproportion(probability)giveninthenullhypothesis.
• Herearethestandardizedstatisticsforourtwostudies.
𝑧 =0.80 − 0.150.113 = 5.75𝑧 =
0.197 − 0.150.018 = 2.61
• Inthefirst,ourobservedstatisticwas5.75standarddeviationsabovethemean.
• Inthesecond,ourobservedstatisticwas2.61standarddeviationsabovethemean.
• Bothoftheseareverystrong,butwehavestrongerevidenceagainstthenullinthefirst.
TheStandardizedStatistic
Guidelinesforstrengthofevidence
• Ifastandardizedstatisticisbelow-2orabove2,wehavestrongevidenceagainstthenull.
StandardizedStatistic EvidenceAgainstNullbetween -1.5and1.5 notmuchbelow-1.5orabove1.5 moderatebelow-2or above2 strongbelow-3orabove 3 verystrong
4.Whatimpactsp-valuesandstrengthofevidence?
Section1.4
PredictingElectionsfromFaces
Example1.4
PredictingElections
• Dovotersmakejudgmentsaboutcandidatesbasedonfacialappearances?
• Morespecifically,canyoupredictanelectionbychoosingthecandidatewhosefaceismorecompetent-looking?
• Participantswereshowntwocandidatesandaskedwhohasthemorecompetent-lookingface.
Whohasthemorecompetentlookingface?
• 2004SenateCandidatesfromWisconsin
Winner Loser
Bonus:OneisnamedTimandtheotherisRuss.Whichnameistheoneontheleft?
• 2004SenateCandidatesfromWisconsin
RussTim
PredictingElections
• Theydeterminedwhichfacewasthemorecompetentforthe32Senateracesin2004.
• Whataretheobservationalunits?– The32Senateraces
• Whatisthevariablemeasured?– Ifthemethodpredictedthewinnercorrectly
PredictingElections
• Nullhypothesis:Theprobabilitythismethodpredictsthewinnerequals0.5.(H0:𝜋 =0.5)
• Alternativehypothesis:Theprobabilitythismethodpredictsthewinnerisgreaterthan0.5.(Ha∶ 𝜋 >0.5)
• Thismethodpredicted23of32races,hence𝑝4 = 23/32≈0.719,or71.9%.
PredictingElections
1000simulatedsetsof32races
PredictingElections
• Withap-value of0.009wehavestrongevidenceagainstthenullhypothesis.
• Whenwecalculatethestandardizedstatisticweagainshowstrongevidenceagainstthenull.
• Whatdothep-valueandstandardizedstatisticmean?
𝑧 =0.7188 − 0.5
0.09 = 2.43.
Whataffectsthestrengthofevidence?
1. Thedifferencebetweentheobservedstatistic(𝑝4)andnullhypothesisparameter(𝜋0).
2. Samplesize.3. Ifwedoaoneortwo-sidedtest.
Differencebetween�̂� andthenullparameter
• Whatifresearcherspredicted26electionsinsteadof23?– 26/32=0.8125neveroccursjustbychancehencethep-valueis0.
• Thefartherawaytheobservedstatisticisfromtheaveragevalueofthenulldistribution(or𝜋0),themoreevidencethereisagainstthenullhypothesis.
Differencebetween�̂� andthenullparameter
SampleSize
Supposethesampleproportionstaysthesame,doyouthinkincreasingsamplesizewillincrease,decrease,orhavenoimpactonthestrengthofevidenceagainstthenullhypothesis?
SampleSize• Thenulldistributionchangesasweincreasethesample
sizefrom32senateracesto128racesto256races.• Asthesamplesizeincreases,thevariability(standard
deviation)decreases.
SampleSize
• Whatdoesdecreasingvariabilitymeanforstatisticalsignificance(withsamesampleproportion)?
• 32elections– p-value=0.009andz=2.43
• 128elections– p-value=0andz=5.07
• 256elections– Evenstrongerevidence– p-value=0andz =9.52
SampleSize
• Asthesamplesizeincreases,thevariabilitydecreases.
• Therefore,asthesamplesizeincreases,theevidenceagainstthenullhypothesisincreases(aslongasthesampleproportionstaysthesameandisinthedirectionofthealternativehypothesis).
Two-SidedTests• Whatifresearcherswerewrong;insteadoftheperson
withthemorecompetentfacebeingelectedmorefrequently,itwasactuallylessfrequently?
H0:𝜋 =0.5Ha:𝜋 >0.5
• Withthisalternative,ifwegetasampleproportionlessthan0.5,wewouldgetaverylargep-value.
• Thisisaone-sided test.• Oftenone-sidedistoonarrow• Infactmostresearchusestwo-sidedtests.
Two-SidedTests
• Inatwo-sidedtestthenullcanberejectedwhensampleproportionsareineithertailofthenulldistribution.
Nullhypothesis:Theprobabilitythismethodpredictsthewinnerequals0.50.(H0:π =0.50)
Alternativehypothesis:Theprobabilitythismethodpredictsthewinnerisnot0.50.(Ha:π ≠0.50)