36
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/F16 Switching 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

Stat 13, Intro. to Statistical Methods for the Life and ...frederic/13/F16/day02.pdfStat 13, Intro. to Statistical Methods for the Life and Health Sciences. Hw1 is due Tue 10/4. 1.3.16,

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Stat 13, Intro. to Statistical Methods for the Life and ...frederic/13/F16/day02.pdfStat 13, Intro. to Statistical Methods for the Life and Health Sciences. Hw1 is due Tue 10/4. 1.3.16,

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

Page 2: Stat 13, Intro. to Statistical Methods for the Life and ...frederic/13/F16/day02.pdfStat 13, Intro. to Statistical Methods for the Life and Health Sciences. Hw1 is due Tue 10/4. 1.3.16,

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

Page 3: Stat 13, Intro. to Statistical Methods for the Life and ...frederic/13/F16/day02.pdfStat 13, Intro. to Statistical Methods for the Life and Health Sciences. Hw1 is due Tue 10/4. 1.3.16,

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

Page 4: Stat 13, Intro. to Statistical Methods for the Life and ...frederic/13/F16/day02.pdfStat 13, Intro. to Statistical Methods for the Life and Health Sciences. Hw1 is due Tue 10/4. 1.3.16,

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

Page 5: Stat 13, Intro. to Statistical Methods for the Life and ...frederic/13/F16/day02.pdfStat 13, Intro. to Statistical Methods for the Life and Health Sciences. Hw1 is due Tue 10/4. 1.3.16,

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

Page 6: Stat 13, Intro. to Statistical Methods for the Life and ...frederic/13/F16/day02.pdfStat 13, Intro. to Statistical Methods for the Life and Health Sciences. Hw1 is due Tue 10/4. 1.3.16,

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

Page 7: Stat 13, Intro. to Statistical Methods for the Life and ...frederic/13/F16/day02.pdfStat 13, Intro. to Statistical Methods for the Life and Health Sciences. Hw1 is due Tue 10/4. 1.3.16,

ContinuingtheHGexamplefromlasttime,usingsimulationsofHoweobtainedsamplesof254values,andjustbychance,in0.51%ofthesesamples,atleast15.34%ormorewerepretermorlessthan4.66%werepreterm.Sowe'dsaythep-valueis0.51%forthistwo-sidedtest.Theobserveddifferenceishighlysignificant,andwehavestrongevidenceagainstthenullhypothesisofHGpregnancieshavinga10%chanceofbeingpretermlikeotherpregnancies.

7

Page 8: Stat 13, Intro. to Statistical Methods for the Life and ...frederic/13/F16/day02.pdfStat 13, Intro. to Statistical Methods for the Life and Health Sciences. Hw1 is due Tue 10/4. 1.3.16,

3.HeartTransplantExample.

Example1.3

Page 9: Stat 13, Intro. to Statistical Methods for the Life and ...frederic/13/F16/day02.pdfStat 13, Intro. to Statistical Methods for the Life and Health Sciences. Hw1 is due Tue 10/4. 1.3.16,

HeartTransplants

• TheBritishMedicalJournal(2004)reportedthathearttransplantsatSt.George’sHospitalinLondonhadbeensuspendedafteraspikeinthemortalityrate

• Ofthelast10hearttransplants,80%hadresultedindeathswithin30days

• Thismortalityratewasoverfivetimesthenationalaverage.

• Theresearchersused15%asareasonablevalueforcomparison.

Page 10: Stat 13, Intro. to Statistical Methods for the Life and ...frederic/13/F16/day02.pdfStat 13, Intro. to Statistical Methods for the Life and Health Sciences. Hw1 is due Tue 10/4. 1.3.16,

HeartTransplants• DoesahearttransplantpatientatSt.George’shaveahigherprobabilityofdyingthanthenationalrateof0.15?

• Observationalunits– Thelast10hearttransplantations

• Variable– Ifthepatientdiedornot

• Parameter– TheactualprobabilityofadeathafterahearttransplantoperationatSt.George’s

Page 11: Stat 13, Intro. to Statistical Methods for the Life and ...frederic/13/F16/day02.pdfStat 13, Intro. to Statistical Methods for the Life and Health Sciences. Hw1 is due Tue 10/4. 1.3.16,

HeartTransplants

• Nullhypothesis:DeathrateatSt.George’sisthesameasthenationalrate(0.15).

• Alternativehypothesis:DeathrateatSt.George’sishigherthanthenationalrate.

• H0:𝜋 =0.15 Ha:𝜋 >0.15

• Ourstatistic is8outof10(�̂� =0.8)

Page 12: Stat 13, Intro. to Statistical Methods for the Life and ...frederic/13/F16/day02.pdfStat 13, Intro. to Statistical Methods for the Life and Health Sciences. Hw1 is due Tue 10/4. 1.3.16,

HeartTransplants

Simulation• Nulldistributionof1000repetitionsofdrawingsamplesof10“patients”wheretheprobabilityofdeathisequalto0.15.

Whatisthep-value?

Page 13: Stat 13, Intro. to Statistical Methods for the Life and ...frederic/13/F16/day02.pdfStat 13, Intro. to Statistical Methods for the Life and Health Sciences. Hw1 is due Tue 10/4. 1.3.16,

HeartTransplants

StrengthofEvidence• Ourp-valueis0,sowehaveverystrongevidence

againstthenullhypothesis.• Evenwiththisstrongevidence,itwouldbeniceto

havemoredata.• Researchersexaminedtheprevious361heart

transplantationsatSt.George’sandfoundthat71diedwithin30days.

• Ournewstatistic,�̂�,is71/361≈0.1967

Page 14: Stat 13, Intro. to Statistical Methods for the Life and ...frederic/13/F16/day02.pdfStat 13, Intro. to Statistical Methods for the Life and Health Sciences. Hw1 is due Tue 10/4. 1.3.16,

HeartTransplants

• Hereisanulldistributionandp-valuebasedonthenewstatistic.

Page 15: Stat 13, Intro. to Statistical Methods for the Life and ...frederic/13/F16/day02.pdfStat 13, Intro. to Statistical Methods for the Life and Health Sciences. Hw1 is due Tue 10/4. 1.3.16,

HeartTransplants

• Thep-valuewasabout0.003• Westillhaveverystrongevidenceagainstthenullhypothesis,butnotquiteasstrongasthefirstcase

• Anotherwaytomeasurestrengthofevidenceistostandardize theobservedstatistic

Page 16: Stat 13, Intro. to Statistical Methods for the Life and ...frederic/13/F16/day02.pdfStat 13, Intro. to Statistical Methods for the Life and Health Sciences. Hw1 is due Tue 10/4. 1.3.16,

TheStandardizedStatistic

• Thestandardizedstatisticisthenumberofstandarddeviationsoursamplestatisticisabovethemeanofthenulldistribution(orbelowthemeanifitisnegative).

• z= statistic$meanofnulldistributionstandarddeviationofnulldistribution

• Forasingleproportion,wewillusethesymbolz forstandardizedstatistic.

• Note:Intheformulaabove,wecaneitherusethemeanoftheactualnulldistributionor(betteryet)thelong-termproportion(probability)giveninthenullhypothesis.

Page 17: Stat 13, Intro. to Statistical Methods for the Life and ...frederic/13/F16/day02.pdfStat 13, Intro. to Statistical Methods for the Life and Health Sciences. Hw1 is due Tue 10/4. 1.3.16,

• Herearethestandardizedstatisticsforourtwostudies.

𝑧 =0.80 − 0.150.113 = 5.75𝑧 =

0.197 − 0.150.018 = 2.61

• Inthefirst,ourobservedstatisticwas5.75standarddeviationsabovethemean.

• Inthesecond,ourobservedstatisticwas2.61standarddeviationsabovethemean.

• Bothoftheseareverystrong,butwehavestrongerevidenceagainstthenullinthefirst.

TheStandardizedStatistic

Page 18: Stat 13, Intro. to Statistical Methods for the Life and ...frederic/13/F16/day02.pdfStat 13, Intro. to Statistical Methods for the Life and Health Sciences. Hw1 is due Tue 10/4. 1.3.16,

Guidelinesforstrengthofevidence

• Ifastandardizedstatisticisbelow-2orabove2,wehavestrongevidenceagainstthenull.

StandardizedStatistic EvidenceAgainstNullbetween -1.5and1.5 notmuchbelow-1.5orabove1.5 moderatebelow-2or above2 strongbelow-3orabove 3 verystrong

Page 19: Stat 13, Intro. to Statistical Methods for the Life and ...frederic/13/F16/day02.pdfStat 13, Intro. to Statistical Methods for the Life and Health Sciences. Hw1 is due Tue 10/4. 1.3.16,

4.Whatimpactsp-valuesandstrengthofevidence?

Section1.4

Page 20: Stat 13, Intro. to Statistical Methods for the Life and ...frederic/13/F16/day02.pdfStat 13, Intro. to Statistical Methods for the Life and Health Sciences. Hw1 is due Tue 10/4. 1.3.16,

PredictingElectionsfromFaces

Example1.4

Page 21: Stat 13, Intro. to Statistical Methods for the Life and ...frederic/13/F16/day02.pdfStat 13, Intro. to Statistical Methods for the Life and Health Sciences. Hw1 is due Tue 10/4. 1.3.16,

PredictingElections

• Dovotersmakejudgmentsaboutcandidatesbasedonfacialappearances?

• Morespecifically,canyoupredictanelectionbychoosingthecandidatewhosefaceismorecompetent-looking?

• Participantswereshowntwocandidatesandaskedwhohasthemorecompetent-lookingface.

Page 22: Stat 13, Intro. to Statistical Methods for the Life and ...frederic/13/F16/day02.pdfStat 13, Intro. to Statistical Methods for the Life and Health Sciences. Hw1 is due Tue 10/4. 1.3.16,

Whohasthemorecompetentlookingface?

• 2004SenateCandidatesfromWisconsin

Winner Loser

Page 23: Stat 13, Intro. to Statistical Methods for the Life and ...frederic/13/F16/day02.pdfStat 13, Intro. to Statistical Methods for the Life and Health Sciences. Hw1 is due Tue 10/4. 1.3.16,

Bonus:OneisnamedTimandtheotherisRuss.Whichnameistheoneontheleft?

• 2004SenateCandidatesfromWisconsin

RussTim

Page 24: Stat 13, Intro. to Statistical Methods for the Life and ...frederic/13/F16/day02.pdfStat 13, Intro. to Statistical Methods for the Life and Health Sciences. Hw1 is due Tue 10/4. 1.3.16,

PredictingElections

• Theydeterminedwhichfacewasthemorecompetentforthe32Senateracesin2004.

• Whataretheobservationalunits?– The32Senateraces

• Whatisthevariablemeasured?– Ifthemethodpredictedthewinnercorrectly

Page 25: Stat 13, Intro. to Statistical Methods for the Life and ...frederic/13/F16/day02.pdfStat 13, Intro. to Statistical Methods for the Life and Health Sciences. Hw1 is due Tue 10/4. 1.3.16,

PredictingElections

• Nullhypothesis:Theprobabilitythismethodpredictsthewinnerequals0.5.(H0:𝜋 =0.5)

• Alternativehypothesis:Theprobabilitythismethodpredictsthewinnerisgreaterthan0.5.(Ha∶ 𝜋 >0.5)

• Thismethodpredicted23of32races,hence𝑝4 = 23/32≈0.719,or71.9%.

Page 26: Stat 13, Intro. to Statistical Methods for the Life and ...frederic/13/F16/day02.pdfStat 13, Intro. to Statistical Methods for the Life and Health Sciences. Hw1 is due Tue 10/4. 1.3.16,

PredictingElections

1000simulatedsetsof32races

Page 27: Stat 13, Intro. to Statistical Methods for the Life and ...frederic/13/F16/day02.pdfStat 13, Intro. to Statistical Methods for the Life and Health Sciences. Hw1 is due Tue 10/4. 1.3.16,

PredictingElections

• Withap-value of0.009wehavestrongevidenceagainstthenullhypothesis.

• Whenwecalculatethestandardizedstatisticweagainshowstrongevidenceagainstthenull.

• Whatdothep-valueandstandardizedstatisticmean?

𝑧 =0.7188 − 0.5

0.09 = 2.43.

Page 28: Stat 13, Intro. to Statistical Methods for the Life and ...frederic/13/F16/day02.pdfStat 13, Intro. to Statistical Methods for the Life and Health Sciences. Hw1 is due Tue 10/4. 1.3.16,

Whataffectsthestrengthofevidence?

1. Thedifferencebetweentheobservedstatistic(𝑝4)andnullhypothesisparameter(𝜋0).

2. Samplesize.3. Ifwedoaoneortwo-sidedtest.

Page 29: Stat 13, Intro. to Statistical Methods for the Life and ...frederic/13/F16/day02.pdfStat 13, Intro. to Statistical Methods for the Life and Health Sciences. Hw1 is due Tue 10/4. 1.3.16,

Differencebetween�̂� andthenullparameter

• Whatifresearcherspredicted26electionsinsteadof23?– 26/32=0.8125neveroccursjustbychancehencethep-valueis0.

Page 30: Stat 13, Intro. to Statistical Methods for the Life and ...frederic/13/F16/day02.pdfStat 13, Intro. to Statistical Methods for the Life and Health Sciences. Hw1 is due Tue 10/4. 1.3.16,

• Thefartherawaytheobservedstatisticisfromtheaveragevalueofthenulldistribution(or𝜋0),themoreevidencethereisagainstthenullhypothesis.

Differencebetween�̂� andthenullparameter

Page 31: Stat 13, Intro. to Statistical Methods for the Life and ...frederic/13/F16/day02.pdfStat 13, Intro. to Statistical Methods for the Life and Health Sciences. Hw1 is due Tue 10/4. 1.3.16,

SampleSize

Supposethesampleproportionstaysthesame,doyouthinkincreasingsamplesizewillincrease,decrease,orhavenoimpactonthestrengthofevidenceagainstthenullhypothesis?

Page 32: Stat 13, Intro. to Statistical Methods for the Life and ...frederic/13/F16/day02.pdfStat 13, Intro. to Statistical Methods for the Life and Health Sciences. Hw1 is due Tue 10/4. 1.3.16,

SampleSize• Thenulldistributionchangesasweincreasethesample

sizefrom32senateracesto128racesto256races.• Asthesamplesizeincreases,thevariability(standard

deviation)decreases.

Page 33: Stat 13, Intro. to Statistical Methods for the Life and ...frederic/13/F16/day02.pdfStat 13, Intro. to Statistical Methods for the Life and Health Sciences. Hw1 is due Tue 10/4. 1.3.16,

SampleSize

• Whatdoesdecreasingvariabilitymeanforstatisticalsignificance(withsamesampleproportion)?

• 32elections– p-value=0.009andz=2.43

• 128elections– p-value=0andz=5.07

• 256elections– Evenstrongerevidence– p-value=0andz =9.52

Page 34: Stat 13, Intro. to Statistical Methods for the Life and ...frederic/13/F16/day02.pdfStat 13, Intro. to Statistical Methods for the Life and Health Sciences. Hw1 is due Tue 10/4. 1.3.16,

SampleSize

• Asthesamplesizeincreases,thevariabilitydecreases.

• Therefore,asthesamplesizeincreases,theevidenceagainstthenullhypothesisincreases(aslongasthesampleproportionstaysthesameandisinthedirectionofthealternativehypothesis).

Page 35: Stat 13, Intro. to Statistical Methods for the Life and ...frederic/13/F16/day02.pdfStat 13, Intro. to Statistical Methods for the Life and Health Sciences. Hw1 is due Tue 10/4. 1.3.16,

Two-SidedTests• Whatifresearcherswerewrong;insteadoftheperson

withthemorecompetentfacebeingelectedmorefrequently,itwasactuallylessfrequently?

H0:𝜋 =0.5Ha:𝜋 >0.5

• Withthisalternative,ifwegetasampleproportionlessthan0.5,wewouldgetaverylargep-value.

• Thisisaone-sided test.• Oftenone-sidedistoonarrow• Infactmostresearchusestwo-sidedtests.

Page 36: Stat 13, Intro. to Statistical Methods for the Life and ...frederic/13/F16/day02.pdfStat 13, Intro. to Statistical Methods for the Life and Health Sciences. Hw1 is due Tue 10/4. 1.3.16,

Two-SidedTests

• Inatwo-sidedtestthenullcanberejectedwhensampleproportionsareineithertailofthenulldistribution.

Nullhypothesis:Theprobabilitythismethodpredictsthewinnerequals0.50.(H0:π =0.50)

Alternativehypothesis:Theprobabilitythismethodpredictsthewinnerisnot0.50.(Ha:π ≠0.50)