Statistik för bioteknik SF1911 Föreläsning 11: Hypotesprövning och statistiska test del 2. Timo Koski

Relevanta dokument
SF1901: SANNOLIKHETSLÄRA OCH STATISTIK MER OM KONFIDENSINTERVALL. HYPOTESPRÖVNING. Jan Grandell & Timo Koski

SF1901: SANNOLIKHETSLÄRA OCH STATISTIK. MER HYPOTESPRÖVNING. χ 2 -TEST. Jan Grandell & Timo Koski

This exam consists of four problems. The maximum sum of points is 20. The marks 3, 4 and 5 require a minimum

Kurskod: TAIU06 MATEMATISK STATISTIK Provkod: TENA 17 August 2015, 8:00-12:00. English Version

Kurskod: TAMS28 MATEMATISK STATISTIK Provkod: TEN1 05 June 2017, 14:00-18:00. English Version

7.5 Experiment with a single factor having more than two levels

Betrakta kopparutbytet från malm från en viss gruva. För att kontrollera detta tar man ut n =16 prover och mäter kopparhalten i dessa.

TAMS65 - Föreläsning 6 Hypotesprövning

Kurskod: TAMS11 Provkod: TENB 28 August 2014, 08:00-12:00. English Version

SF1911: Statistik för bioteknik

Kurskod: TAIU06 MATEMATISK STATISTIK Provkod: TENA 31 May 2016, 8:00-12:00. English Version

TAMS65 - Föreläsning 6 Hypotesprövning

SF1901: SANNOLIKHETSTEORI OCH HYPOTESPRÖVNING. STATISTIK. Tatjana Pavlenko. 4 oktober 2016

7.1 Hypotesprövning. Nollhypotes: H 0 : µ = 3.9, Alternativ hypotes: H 1 : µ < 3.9.

Kurskod: TAIU06 MATEMATISK STATISTIK Provkod: TENA 15 August 2016, 8:00-12:00. English Version

English Version. 1 x 4x 3 dx = 0.8. = P (N(0, 1) < 3.47) = =

Kurskod: TAMS11 Provkod: TENB 12 January 2015, 08:00-12:00. English Version

Föreläsningsanteckningar till kapitel 9, del 2

SF1901: SANNOLIKHETSTEORI OCH HYPOTESPRÖVNING. STATISTIK. Tatjana Pavlenko. 13 maj 2015

Föreläsning 12, FMSF45 Hypotesprövning

Kurskod: TAMS24 / Provkod: TEN (8:00-12:00) English Version

Tentamen MVE301 Sannolikhet, statistik och risk

Kurskod: TAMS28 MATEMATISK STATISTIK Provkod: TEN1 08 June 2015, 14:00-18:00. English Version

Isometries of the plane

SF1901: SANNOLIKHETSLÄRA OCH STATISTIK. MER OM χ 2 -TEST OCH LIKNANDE. Jan Grandell & Timo Koski

Mälardalens Högskola. Formelsamling. Statistik, grundkurs

Chapter 2: Random Variables

Tentamen MVE301 Sannolikhet, statistik och risk

Tentamen i matematisk statistik

Grafisk teknik IMCDP IMCDP IMCDP. IMCDP(filter) Sasan Gooran (HT 2006) Assumptions:

Tentamen MVE301 Sannolikhet, statistik och risk

Kurskod: TAMS11 Provkod: TENB 07 April 2015, 14:00-18:00. English Version

7.3.3 Nonparametric Mann-Whitney test

Statistik för bioteknik SF1911 CBIOT3 Föreläsning 9: Modellbaserad data-analys Timo Koski

Tentamen MVE300 Sannolikhet, statistik och risk

F14 HYPOTESPRÖVNING (NCT 10.2, , 11.5) Hypotesprövning för en proportion. Med hjälp av data från ett stickprov vill vi pröva

Datorövning Power curve 0,0305 0, Kvantiler, kritiska regioner

En scatterplot gjordes, och linjär regression utfördes därefter med följande hypoteser:

Hur fattar samhället beslut när forskarna är oeniga?

Datorövning 5. Statistisk teori med tillämpningar. Lära sig beräkna konfidensintervall och utföra hypotestest för:

12.6 Heat equation, Wave equation

Föreläsning 5: Hypotesprövningar

χ 2 -test χ 2 -test med skattade parametrar små talens lag (Bortkiewicz) homogenitetstest oberoendetest

Kroppstemperaturen hos människa anses i regel vara 37,0 C/ 98,6 F. För att beräkna och rita grafer har programmet Minitab använts.

Tentamen MVE301 Sannolikhet, statistik och risk

Grafisk teknik IMCDP. Sasan Gooran (HT 2006) Assumptions:

English Version. + 1 n 2. n 1

Tentamen MVE302 Sannolikhet och statistik

4.3 Stokastiska variabler (slumpmässiga variabler) 4.4 Väntevärde och varians till stokastiska variabler

Exam MVE265 Mathematical Statistics,

Lö sningsfö rslag till tentamen i matematisk statistik Statistik öch kvalitetsteknik 7,5 hp

Kurskod: TAMS28 MATEMATISK STATISTIK Provkod: TEN1 20 August 2014, English Version

Föreläsning 11: Mer om jämförelser och inferens

Uppgift 1. Produktmomentkorrelationskoefficienten

Matematisk statistik för B, K, N, BME och Kemister

Grafisk teknik. Sasan Gooran (HT 2006)

Statistik för teknologer, 5 poäng Skrivtid:

English Version. Number of sold cakes Number of days

Tentamen MVE302 Sannolikhet och statistik

Syfte: o statistiska test om parametrar för en fördelning o. förkasta eller acceptera hypotesen

Lö sningsfö rslag till tentamen i matematisk statistik Statistik öch kvalitetsteknik 7,5 hp

Module 6: Integrals and applications

F ξ (x) = f(y, x)dydx = 1. We say that a random variable ξ has a distribution F (x), if. F (x) =

Hypotesprövning. Andrew Hooker. Division of Pharmacokinetics and Drug Therapy Department of Pharmaceutical Biosciences Uppsala University

Pre-Test 1: M0030M - Linear Algebra.

Tentamen MVE301 Sannolikhet, statistik och risk

Tentamen MMG610 Diskret Matematik, GU

SF1901: Sannolikhetslära och statistik Föreläsning 2. Betingad sannolikhet & Oberoende

Laboration 2. i 5B1512, Grundkurs i matematisk statistik för ekonomer

S0005M, Föreläsning 2

Statistical Quality Control Statistisk kvalitetsstyrning. 7,5 högskolepoäng. Ladok code: 41T05A, Name: Personal number:

Adding active and blended learning to an introductory mechanics course

1. Varje bevissteg ska motiveras formellt (informella bevis ger 0 poang)

S0005M. Stokastiska variabler. Notes. Notes. Notes. Stokastisk variabel (slumpvariabel) (eng: random variable) Mykola Shykula

Tentamen MVE300 Sannolikhet, statistik och risk

Tentamen i matematisk statistik

Statistik 1 för biologer, logopeder och psykologer

Viktig information för transmittrar med option /A1 Gold-Plated Diaphragm

Module 1: Functions, Limits, Continuity

LÖSNINGSFÖRSLAG TILL TENTAMEN I MATEMATISK STATISTIK

Föreläsning G60 Statistiska metoder

Föreläsning 3. NDAB02 Statistik; teori och tillämpning i biologi

Tentamen i Matematik 2: M0030M.

Gamla tentor (forts) ( x. x ) ) 2 x1

Stat. teori gk, ht 2006, JW F13 HYPOTESPRÖVNING (NCT ) Ordlista till NCT

Kapitel 10 Hypotesprövning

LUNDS TEKNISKA HÖGSKOLA Institutionen för Elektro- och Informationsteknik

Lösningar till SPSS-övning: Analytisk statistik

Statistiska analyser C2 Inferensstatistik. Wieland Wermke

Avd. Matematisk statistik

Jesper Rydén. Matematiska institutionen, Uppsala universitet Tillämpad statistik 1MS026 vt 2014

English Version. 1 f(x) = if 0 x θ; 0 otherwise, ) = V (X) = E(X2 ) (E(X)) 2 =

Tentamen består av 9 frågor, totalt 34 poäng. Det krävs minst 17 poäng för att få godkänt och minst 26 poäng för att få väl godkänt.

MVE051/MSG810 Matematisk statistik och diskret matematik

Laboration 4: Hypotesprövning och styrkefunktion

Metod och teori. Statistik för naturvetare Umeå universitet

Standardfel (Standard error, SE) SD eller SE. Intervallskattning MSG Staffan Nilsson, Chalmers 1

SF1911: Statistik för bioteknik

TMS136. Föreläsning 11

Tentamen MVE301 Sannolikhet, statistik och risk

Transkript:

Statistik för bioteknik SF1911 Föreläsning 11: Hypotesprövning och statistiska test del 2. Timo Koski TK 28.11.2017 TK 28.11.2017 1 / 40

Outline of Lecture 11. Matched pairs or the paired samples (sticprov i par, parvisa observationer) t-test Type I error/fel av typ I, Type II error/fel av typ II Specificitet, sensitivitet Testets styrka/power Styrkefunktion/power function TK 28.11.2017 2 / 40

Lady tasting tea TK 28.11.2017 3 / 40

Lady tasting tea David Salsburg: Lady Tasting Tea - How Statistics Revolutionized Science in the Twentieth Century Holt McDougal, 2002-05-01. Brief commercial: (The book is) saluting the spirit of those who dared to look at the world in a new way, this insightful, revealing history explores the magical mathematics that transformed the world. TK 28.11.2017 4 / 40

Matched Pairs We shall deal with a testing situation matched pairs that is treacherously close to the comparison of two means above. We present this by an example. Suppose that we want to test the effectiveness of a low-fat diet. The weight of n subjects is measured before and after the diet. The results are x 1,..., x n and y 1,..., y n, respectively. Obviously x i and y i would be dependent, but the samples corresponding to different subjects are independent. TK 28.11.2017 5 / 40

Matched Pairs We have Diet Subject 1 2... n weight before diet x 1 x 2... x n weight after diet y 1 y 2... y n TK 28.11.2017 6 / 40

Matched Pairs/Stickprov i par Let us assume x j for the jth subject is a sample from N(µ j, σ 1 ) and y j a sample from N(µ j +, σ 2 ). is the population mean difference for all matched pairs. is the population parameter for the effectiveness of the low-fat diet. TK 28.11.2017 7 / 40

Matched Pairs/Stickprov i par There is, as in case of two means, two series of observations. But the model for two means is inapplicable, the pairs x j, y j are now matched to each other, two measurements of the weight of one and the same person. The data consists of n matched pairs. The unknown parameters are µ 1,..., µ n, σ 1, σ 2 och. µ 1,..., µ n reflect differences between subjects, whereas reflects the systematic difference between the weights before and after the low fat diet. If < 0 then the weight after diet is in average lower than before the diet. Note that σ 1 and σ 2 can be different. TK 28.11.2017 8 / 40

Matched Pairs We are primarily interested in. To do the analysis we need a trick, which is best illustrated by another example. TK 28.11.2017 9 / 40

Matched Pairs: Another example A laboratory in a brewery takes daily samples of beer to analyse. Two chemists A and B analyse the alcoholic percentage in the samples. One asks if there was a systematic difference between A s and B s results. Daily, for n days, we let A and B, independently of each other, to analyse the same sample of beer, new sample per day. TK 28.11.2017 10 / 40

Matched Pairs Chemist Beer sample 1 2... n A x 1 x 2... x n B y 1 y 2... y n TK 28.11.2017 11 / 40

The Statistical Model: X 1, X 2,..., X n N(µ i, σ A ) (A s results) Y 1, Y 2,..., Y n N(µ i +, σ B ) (B s results) = a systematic difference TK 28.11.2017 12 / 40

The trick The trick is to form the differences Z i = Y i X i ( since then Z i N(, σ) with σ = σ 2 A + σ2 B ). But now we have reduced the problem to a case with one sample and we can form confidence interval for as we did for µ in Lect. 4. TK 28.11.2017 13 / 40

Hypothesis testing for matched pairs z is the mean value (=arithmetic mean of the samples z i ) of the differences z i = y i x i of the matched pair data. n 1 s = (z i z) n 1 2. i=1 is the standard deviation for differences z i of the matched data. The test statistic is t = z s n TK 28.11.2017 14 / 40

Hypothesis testing for matched pairs: critical region The test statistic is If then t = z s n H o : = 0, H 1 : = 0 t = z s n The critical values t α/2 are obtained from a t-distribution with n 1 degrees of freedom. The critical region is t < t α/2 or t > t α/2 TK 28.11.2017 15 / 40

Confidence Interval for Matched Pairs z E < < z + E where E = t α/2 (n 1) s n If Reject H o if 0 is not in the interval. H o : = 0, H 1 : = 0 TK 28.11.2017 16 / 40

Structure and Logic of Statistical Tests (General Discussion) We take another look at the general principles. TK 28.11.2017 17 / 40

Structure and Logic of Statistical Tests (General Discussion) When testing a null hypothesis, the statement is to either reject or fail to reject that null hypothesis. Such conclusions are sometimes correct and sometimes wrong, even if we do everything correctly in terms of computing margins of errors e.t.c., and have a good/perfect model of the population. There are two types of errors: Type I error The mistake of rejecting the null hypothesis when it actually is true. The symbol α is used to represent the probability of type I error. Type II error The mistake of failing to reject the null hypothesis when it actually is false. The symbol β is used to represent the probability of type II error. TK 28.11.2017 18 / 40

α and β Here we read g(t H o ) as the density curve in t, when H 0 is true, and g(t H 1 ) has a analogous meaning. Here, for e.g. H o : X N(µ, σ), H 1 : X N(µ 1, σ 1 ), i.e., the alternative hypothesis is not a composite one. t cut is the critical value. TK 28.11.2017 19 / 40

Four possible outcomes of a test; c.f. rule of court TK 28.11.2017 20 / 40

Controlling Type I error and Type II error (General Discussion) For fixed α increase n, then β will decrease. For fixed n, decrease α, then β will increase. Increase n, decreases both α and β. TK 28.11.2017 21 / 40

Power of a Test Definition The power of a hypothesis test is the probability 1 β of rejecting a false null hypothesis. Power is computed by using a particular significance level α, a particular sample size n, the value of the population parameter used in the null hypothesis, and a particular value of the population parameter that is an alternative to the value assumed in the null hypothesis. TK 28.11.2017 22 / 40

Hypotesprövning: ESP En person påstår att han har extrasensory perception (ESP), som yttrar sig i förmåga att med förbundna ögon avgöra om krona eller klave kommer upp vid kast med ett mynt. TK 28.11.2017 23 / 40

Hypotesprövning: ESP Låt p vara den okända sannolikheten att han svarar rätt vid ett sådant kast. Man kastar ett symmetriskt mynt 12 gånger och med ledning av antalet korrekta svar x pröva vad som kallas nollhypotesen H 0 : p = 1/2 (som innebär att personen bara gissar). Modellen: För varje p gäller att x är en observation av X Bin(12, p) och speciellt, om H 0 är sann, att X Bin(12, 1/2). TK 28.11.2017 24 / 40

Hypotesprövning: ESP En procedur: Förkasta H 0, d.v.s påstå att personen har ESP, om x är tillräckligt stort, säg om x a, men inte annars. Storheten a bör bestämmas så att sannolikheten är liten att H 0 förkastas om H 0 skulle vara sann. Därigenom garderar vi oss mot att påstå att personen har ESP om detta inte är sant. Angivna sannolikhet kallar vi felrisken eller signifikansnivån (ofta 0.05, 0.01 och 0.001) TK 28.11.2017 25 / 40

Hypotesprövning: ESP Börja med felrisken 0.05; vi säger vi att felrisken skall vara ca (men inte mer än) 0.05. Dvs. P(X a), om p = 1/2, bör vara ca 0.05, ty om x a i detta fall kommer vi felaktigt att påstå att H 0 är falsk, d.v.s att personen har ESP. TK 28.11.2017 26 / 40

Hypotesprövning: ESP P(X a) = 12 i=a ( ) 12 (1 ) 12 0.05. (1) i 2 För att lösa denna ekvation i a kan man pröva sig fram. 12 11 10 9 0.00024 0.00293 0.01611 0.05371 För a = 10 blir summan 0.016 och närmare 0.05 kan man inte komma, eftersom man inte vill överskrida detta tal. Om personen svarar rätt minst 10 gånger bör man alltså påstå att han har ESP, men inte annars. TK 28.11.2017 27 / 40

Hypotesprövning: ESP Om man sänker felrisken från 0.05, först till 0.01, sedan till 0.001 : Felrisk 0.05 a = 10 0.01 11 0.001 12 I det sista fallet måste vi alltså kräva helt riktigt svar. Vi ser att det inte går att minska felrisken hur mycket som helst; skulle man vara så rädd för felaktigt uttalande att man vill ha en felrisk på, säg, 10 6, måste man kasta myntet mer än 12 gånger. TK 28.11.2017 28 / 40

Hypotesprövning: begrepp i samband med exemplet om ESP X Bin(12, p): en testvariabel, x observerat värde på X x a: ett kritiskt område (ett ensidigt test) H 0 : p = 1/2 nollhypotes Beslutsregel: Förkasta H 0 om observationen hamnar i kritiskt område. Bestäm a så att P(X a) = α, α = felrisk, signifikansnivå. P(X a) = 12 i=a ( 12 i ) ( 1 2) 12 om H0 sann. TK 28.11.2017 29 / 40

Hypotesprövning: alternativ hypotes Nytt påstående: Jag kan i nio fall av tio svara rätt. Detta är en mothypotes (hypotes mot H 0 ) H 0 : p = 1/2 H 1 : p = 9/10 Tag α = 0.05. Förkasta H 0 om x 10. ( ) i ( ) 12 i h(0.9) = P(X 10) = 12 i=10 ( 12 i ) 9 1 10 10 Detta är sannolikheten för att H 0 förkastas om p = 9/10 sant. (=TESTETS STYRKA.) ) i ( 12 i h(p) = 12 i=10 ( 12 i (p ) 1 p) kallas testets styrkefunktion. TK 28.11.2017 30 / 40

Hypotesprövning: ESP Du kan själv testa din egen förmåga för ESP med Rhines och Zeners test, som är ungefär som ovan men har fem symboler och räknar signifikans med t -fördelning (jfr. nedan). Se: http://www.scientificpsychic.com/esp/esptest.html TK 28.11.2017 31 / 40

TK 28.11.2017 32 / 40

TK 28.11.2017 33 / 40

Ŷ is an estimate of Y that has two values, 1 and +1. (E.g., in gene detection by a sequence model, Y = gene or not. False Positives = FP, True Positives = TP False Negatives = FN, True Negatives= TN Y = +1 Y = 1 Ŷ = +1 TP FP Ŷ = 1 FN TN TK 28.11.2017 34 / 40

Error rates with statistics names Let N=TN+FP, P=FN+TP. FP/N = type I error = 1 Specificity TP/P= 1-type II error =power =sensitivity=recall TK 28.11.2017 35 / 40

Testyrka (power), Uppgift 9.2.9 i övningarna Vi har n data som är N ( µ, σ 2). Vi testar mot den alternativa hypotesen H 0 : µ = 7 H A : µ < 7 med hjälp av teststorheten (teststatistikan) U = X 7 σ/ n. Härvid förkastas H 0 om u < 1.64. Ensidigt test. TK 28.11.2017 36 / 40

Testyrka (power), Uppgift 9.2.9 i övningarna Testets styrka är sannolikheten att förkasta H 0 som funktion av parametern µ. Vi betecknar denna funktion med h(µ) och definierar i matematiska termer som h(µ) def = P(U < 1.64; µ) = P( X 7 σ/ n < 1.64; µ) Beteckningen P(U < 1.64; µ) innebär att vi beräknar denna sannolikhet med N ( µ, σ 2), där µ är något väntevärde µ < 7. X = P( σ/ n < 7 σ/ n 1.64) = P( X µ σ/ < 7 µ n σ/ n 1.64) }{{} N (0,1) TK 28.11.2017 37 / 40

n = 5, σ 2 = 1.65 D.v.s. ( = Φ ( 7 µ = Φ ) 1.284/ 5 1.64 = 7 1.284/ 5 µ 1.284/ 5 1.64 = Φ (12.1904 1.64 1.7415 µ) = Φ (10.5504 1.7415 µ) h(µ) = Φ (10.5504 1.7415 µ). ) TK 28.11.2017 38 / 40

h(µ) = Φ (10.5504 1.7415 µ). Denna funktion återges grafiskt i figuren nedan: 1 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0-10 -8-6 -4-2 0 2 4 6 8 TK 28.11.2017 39 / 40

Till exempel h(4) = Φ (10.5504 1.7415 µ) = 0.9998 vilket säger att testets styrka = 0.998 för µ = 4, eller, med andra ord att 0.9998 är sannolikheten att förkasta H o : µ = 7, när det sanna värdet på µ är 4. h(7) = Φ (10.5504 1.7415 7) = 0.05. är givetvis signifikansnivån, ty det kritiska värdet 1.64 = λ 0.05. TK 28.11.2017 40 / 40