Oversigt. 1 Motiverende eksempel - energiforbrug. 2 Hypotesetest (Repetition) 3 Two-sample t-test og p-værdi. 4 Konfidensinterval for forskellen

Relaterede dokumenter
Kursus 02402/02323 Introducerende Statistik. Forelæsning 6: Sammenligning af to grupper

Oversigt. 1 Motiverende eksempel - energiforbrug. 2 Hypotesetest (Repetition) 3 Two-sample t-test og p-værdi. 4 Konfidensinterval for forskellen

Oversigt. Kursus 02402/02323 Introducerende Statistik. Forelæsning 5: Hypotesetest, power og modelkontrol - one sample

Kursus 02323: Introducerende Statistik. Forelæsning 12: Forsøgsplanlægning. Peder Bacher

Basic statistics for experimental medical researchers

enote 3: Hypotesetests for én gruppe/stikprøve Introduktion til Statistik Forelæsning 5: Hypotesetest, power og modelkontrol - one sample Peder Bacher

Kursus Introduktion til Statistik. Forelæsning 7: Kapitel 7 og 8: Statistik for to gennemsnit, ( , ) Per Bruun Brockhoff

Introduktion til Statistik. Forelæsning 5: Hypotesetest, power og modelkontrol - one sample. Peder Bacher

Ensidet eller tosidet alternativ. Hypoteser. tosidet alternativ. nul hypotese testes mod en alternativ hypotese

Forelæsning 6: Kapitel 7: Hypotesetest for gennemsnit (one-sample setup)

Afsnit E1 Konfidensinterval for middelværdi i normalfordeling med kendt standardafvigelse

Statistik for MPH: 7

Vina Nguyen HSSP July 13, 2008

Kursus 02402/02323 Introduktion til statistik. Forelæsning 13: Et overblik over kursets indhold. Klaus K. Andersen og Per Bruun Brockhoff

Oversigt. 1 Eksempel. 2 Fordelingen for gennemsnittet t-fordelingen. 3 Konfidensintervallet for µ Eksempel

1 enote 1: Simple plots og deskriptive statistik. 2 enote2: Diskrete fordelinger. 3 enote 2: Kontinuerte fordelinger

Konfidensintervaller og Hypotesetest

Kvant Eksamen December timer med hjælpemidler. 1 Hvad er en continuous variable? Giv 2 illustrationer.

Forelæsning 11: Envejs variansanalyse, ANOVA

Statistik for MPH: oktober Attributable risk, bestemmelse af stikprøvestørrelse (Silva: , )

Program. t-test Hypoteser, teststørrelser og p-værdier. Hormonkonc.: statistisk model og konfidensinterval. Hormonkoncentration: data

Forelæsning 4: Konfidensinterval for middelværdi (og spredning)

k UAFHÆNGIGE grupper Oversigt 1 Intro eksempel 2 Model og hypotese 3 Beregning - variationsopspaltning og ANOVA tabellen 4 Hypotesetest (F-test)

Reexam questions in Statistics and Evidence-based medicine, august sem. Medis/Medicin, Modul 2.4.

STAT-UB.0103 Spring 2012 Homework Set 8 Solutions

Introduktion til Statistik. Forelæsning 12: Inferens for andele. Peder Bacher

Forelæsning 9: Inferens for andele (kapitel 10)

Question I.1 (1) We use Method 3.8 from Chapter 3 to achieve

Generalized Probit Model in Design of Dose Finding Experiments. Yuehui Wu Valerii V. Fedorov RSU, GlaxoSmithKline, US

Forelæsning 5: Kapitel 7: Inferens for gennemsnit (One-sample setup)

Introduktion til Statistik. Forelæsning 10: Inferens for andele. Peder Bacher

Oversigt. 1 Gennemgående eksempel: Højde og vægt. 2 Korrelation. 3 Regressionsanalyse (kap 11) 4 Mindste kvadraters metode

Opgaver til ZAR II. Afdeling for Anvendt Matematik og Statistik Michael Sørensen Oktober Opgave 1

Project Step 7. Behavioral modeling of a dual ported register set. 1/8/ L11 Project Step 5 Copyright Joanne DeGroat, ECE, OSU 1

Oversigt. 1 Motiverende eksempel: Højde-vægt. 2 Lineær regressionsmodel. 3 Mindste kvadraters metode (least squares)

Eksamen Bacheloruddannelsen i Medicin med industriel specialisering

Forelæsning 11: Kapitel 11: Regressionsanalyse

Anvendt Statistik Lektion 5. Sammenligning af to grupper * Sammenligning af middelværdier * Sammenligning af andele

q-værdien som skal sammenlignes med den kritiske Chi-i-Anden værdi p-værdien som skal sammenlignes med signifikansniveauet.

Oversigt. Kursus Introduktion til Statistik. Forelæsning 9: Inferens for andele (kapitel 10) Per Bruun Brockhoff

Besvarelse af vitcap -opgaven

Normalfordelingen. Statistik og Sandsynlighedsregning 2

Forelæsning 10: Statistik ved hjælp af simulering

Vores mange brugere på musskema.dk er rigtig gode til at komme med kvalificerede ønsker og behov.

Normalfordelingen. Statistik og Sandsynlighedsregning 2

Exam questions in Statistics and evidence-based medicine, spring sem. Medis/Medicin, Modul 2.4.

1 enote 1: Simple plots og deskriptive statistik. 2 enote 2: Diskrete fordelinger. 3 enote 2: Kontinuerte fordelinger

Anvendt Statistik Lektion 5. Sammenligning af to grupper * Sammenligning af middelværdier * Sammenligning af andele

(studienummer) (underskrift) (bord nr)

Linear Programming ١ C H A P T E R 2

User Manual for LTC IGNOU

Kursus Introduktion til Statistik. Forelæsning 12: Variansanalyse. Per Bruun Brockhoff

Skriftlig Eksamen Kombinatorik, Sandsynlighed og Randomiserede Algoritmer (DM528)

Oversigt. Kursus Introduktion til Statistik. Forelæsning 10: Statistik ved hjælp af simulering. Per Bruun Brockhoff.

Measuring Evolution of Populations

Oversigt. Course 02402/02323 Introducerende Statistik. Forelæsning 2: Stokastisk variabel og diskrete fordelinger

Forsøgsplanlægning Stikprøvestørrelse

Skriftlig eksamen Science statistik- ST501

Oversigt. 1 Intro: Regneeksempel og TV-data fra B&O. 2 Model og hypotese. 3 Beregning - variationsopspaltning og ANOVA tabellen

Statistik. Statistik. Hvad er Statistik? Hvad er Statistik? Hvad er Statistik? 1. Hvad er statistik? 2. Mennesker som måleinstrumenter

Løsning eksamen d. 15. december 2008

Ikke-parametriske tests

Analyseinstitut for Forskning

Resumé: En statistisk analyse resulterer ofte i : Et estimat θˆmed en tilhørende se

Privat-, statslig- eller regional institution m.v. Andet Added Bekaempelsesudfoerende: string No Label: Bekæmpelsesudførende

Oversigt. Kursus Introduktion til Statistik. Forelæsning 12: Variansanalyse. Per Bruun Brockhoff. Envejs variansanalyse - eksempel

Trin 1: Formuler hypotese Spørgsmål der ønskes testet vha. data H 0 : Nul hypotese Formuleres som en ligheds hændelse

Anvendt Statistik Lektion 9. Variansanalyse (ANOVA)

KA 4.2 Kvantitative Forskningsmetoder Forår 2010

Statistik og Sandsynlighedsregning 2. Repetition og eksamen. Overheads til forelæsninger, mandag 7. uge

Hypoteser om mere end to stikprøver ANOVA. k stikprøver: (ikke ordinale eller højere) gælder også for k 2! : i j

Sport for the elderly

Indhold. 2 Tosidet variansanalyse Additive virkninger Vekselvirkning... 9

Basal statistik Esben Budtz-Jørgensen 4. november Forsøgsplanlægning Stikprøvestørrelse

En Introduktion til SAS. Kapitel 5.

Statistik Lektion 20 Ikke-parametriske metoder. Repetition Kruskal-Wallis Test Friedman Test Chi-i-anden Test

Anvendt Statistik Lektion 9. Variansanalyse (ANOVA)

Hvad skal vi lave? Nulhypotese - alternativ. Teststatistik. Signifikansniveau

The X Factor. Målgruppe. Læringsmål. Introduktion til læreren klasse & ungdomsuddannelser Engelskundervisningen

Multivariate Extremes and Dependence in Elliptical Distributions

Opgave I.1 II.1 II.2 II.3 III.1 IV.1 IV.2 IV.3 V.1 VI.1 Spørgsmål (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Svar

Maple-oversigt til matematik B-niveau: Rungsted Gymnasium Definer en funktion og funktionsværdier. Tegn grafen for en funktion.

Ikke-parametriske metoder. Repetition Wilcoxon Signed-Rank Test Kruskal-Wallis Test Friedman Test Chi-i-anden Test

Klasseøvelser dag 2 Opgave 1

Fejlbeskeder i SMDB. Business Rules Fejlbesked Kommentar. Validate Business Rules. Request- ValidateRequestRegist ration (Rules :1)

Hvis α vælges meget lavt, bliver β meget stor. Typisk vælges α = 0.01 eller 0.05

Engelsk. Niveau D. De Merkantile Erhvervsuddannelser September Casebaseret eksamen. og

Sommereksamen Bacheloruddannelsen i Medicin/Medicin med industriel specialisering

Kommentarer til opg. 1 og 3 ved øvelser i basalkursus, 3. uge

Forelæsning 11: Tovejs variansanalyse, ANOVA

1 Sammenligning af 2 grupper Responsvariabel og forklarende variabel Afhængige/uafhængige stikprøver... 2

Exam questions in Statistics and evidence-based medicine, spring sem. Medis/Medicin, Modul 2.4.

Kursus Introduktion til Statistik. Forelæsning 13: Summary. Per Bruun Brockhoff

DoodleBUGS (Hands-on)

Hvad skal vi lave? Responsvariabel og forklarende variabel Afhængige/uafhængige stikprøver

Løsning til eksaminen d. 29. maj 2009

Forsøgsplanlægning Stikprøvestørrelse

Financial Literacy among 5-7 years old children

Aktivering af Survey funktionalitet

Trolling Master Bornholm 2012

Transkript:

Kursus 02402/02323 Introducerende Statistik Forelæsning 6: Sammenligning af to grupper Oversigt 1 Motiverende eksempel - energiforbrug 2 Hypotesetest (Repetition) 3 Klaus K. Andersen og Per Bruun Brockhoff DTU Compute, Statistik og Dataanalyse Danmarks Tekniske Universitet 2800 Lyngby Danmark e-mail: klaus@cancer.dk 4 Konfidensinterval for forskellen 5 Overlappende konfidensintervaller? 6 7 Checking the normality assumptions 8 9 The pooled t-test - a possible alternative Klaus KA og Per BB (klaus@cancer.dk) Introduktion til Statistik, Forelæsning 6 Efteråret 2016 1 / 45 Klaus KA og Per BB (klaus@cancer.dk) Introduktion til Statistik, Forelæsning 6 Efteråret 2016 2 / 45 Motiverende eksempel - energiforbrug Motiverende eksempel - energiforbrug Forskel på energiforbrug? I et ernæringsstudie ønsker man at undersøge om der er en forskel i energiforbrug for forskellige typer (moderat fysisk krævende) arbejde. In the study, the energy usage of 9 nurses from hospital A and 9 (other) nurses from hospital B have been measured. The measurements are given in the following table in mega Joule (MJ): Stikprøve fra hver hospital, n 1 = n 2 = 9: Hospital A Hospital B 7.53 9.21 7.48 11.51 8.08 12.79 8.09 11.85 10.15 9.97 8.40 8.79 10.88 9.69 6.13 9.68 7.90 9.19 Klaus KA og Per BB (klaus@cancer.dk) Introduktion til Statistik, Forelæsning 6 Efteråret 2016 4 / 45 Motiverende eksempel - energiforbrug Eksempel - energiforbrug Hypotesen om ingen forskel ønskes undersøgt: Sample means og standard deviations: ˆµ A = x A = 8.293, (s A = 1.428) ˆµ B = x B = 10.298, (s B = 1.398) NYT:p-værdi for forskel: p værdi = 0.0083 (Beregnet under det scenarie, at H 0 er sand) H 0 : µ 1 = µ 2 Er data i overenstemmelse med nulhyposen H 0? Data: x B x A = 2.005 Nulhypotese: H 0 : µ B µ A = 0 NYT:Konfidensinterval for forskel: 2.005 ± 1.412 = [0.59; 3.42] Klaus KA og Per BB (klaus@cancer.dk) Introduktion til Statistik, Forelæsning 6 Efteråret 2016 5 / 45

Hypotesetest (Repetition) Definition af hypotesetest og signifikans (Repetition) Definition 3.23. Hypotesetest: We say that we carry out a hypothesis test when we decide against a null hypothesis or not using the data. A null hypothesis is rejected if the p-value, calculated after the data has been observed, is less than some α, that is if the p-value < α, where α is some pre-specifed (so-called) significance level. And if not, then the null hypothesis is said to be accepted. Definition 3.28. Statistisk signifikans: An effect is said to be (statistically) significant if the p-value is less than the significance level α. (OFTE bruges α = 0.05) Hypotesetest (Repetition) Metode 3.36. Steps ved hypotesetests - et overblik (Repetition) Helt generelt består et hypotesetest af følgende trin: 1 Formulate the hypotheses and choose the level of significance α (choose the "risk-level") 2 Calculate, using the data, the value of the test statistic 3 Calculate the p-value using the test statistic and the relevant sampling distribution, and compare the p-value and the significance level α and make a conclusion 4 (Alternatively, make a conclusion based on the relevant critical value(s)) Klaus KA og Per BB (klaus@cancer.dk) Introduktion til Statistik, Forelæsning 6 Efteråret 2016 7 / 45 Klaus KA og Per BB (klaus@cancer.dk) Introduktion til Statistik, Forelæsning 6 Efteråret 2016 8 / 45 Hypotesetest (Repetition) Definition og fortolkning af p-værdien (Repetition) Metode 3.58: Two-sample t-test p-værdien udtrykker evidence imod nulhypotesen Tabel 3.1: p < 0.001 Very strong evidence against H 0 0.001 p < 0.01 Strong evidence against H 0 0.01 p < 0.05 Some evidence against H 0 0.05 p < 0.1 Weak evidence against H 0 p 0.1 Little or no evidence against H 0 Definition 3.21 af p-værdien: The p-value is the probability of obtaining a test statistic that is at least as extreme as the test statistic that was actually observed. This probability is calculated under the assumption that the null hypothesis is true. beregning af teststørrelsen When considering the null hypothesis about the difference between the means of two independent samples: δ = µ 2 µ 1 H 0 : δ = δ 0 the (Welch) two-sample t-test statistic is t obs = ( x 1 x 2 ) δ 0 s 2 1 /n 1 + s 2 2 /n 2 Klaus KA og Per BB (klaus@cancer.dk) Introduktion til Statistik, Forelæsning 6 Efteråret 2016 9 / 45 Klaus KA og Per BB (klaus@cancer.dk) Introduktion til Statistik, Forelæsning 6 Efteråret 2016 11 / 45

Theorem 3.59: Fordelingen af (Welch) t-teststørrelsen Metode 3.60: Two-sample t-test Welch t-teststørrelsen er t-fordelt The (Welch) two-sample statistic seen as a random variable: T = ( X 1 X 2 ) δ 0 S 2 1 /n 1 + S2 2/n 2 approximately, under the null hypothesis, follows a t-distribution with ν degrees of freedom, where ν = ( s 2 1 n 1 + s2 2 n 2 ) 2 (s 2 1 /n 1) 2 n 1 1 + (s2 2 /n 2) 2 n 2 1 if the two population distributions are normal or if the two sample sizes are large enough.. Et level α test er 1 Compute t obs and ν as given above. 2 Compute the evidence against the null hypothesis a H 0 : µ 1 µ 2 = δ vs. the alternative hypothesis H 1 : µ 1 µ 2 δ by the p value = 2 P (T > t obs ) where the t-distribution with ν degrees of freedom is used. 3 If p value < α: We reject H 0, otherwise we accept H 0. 4 The rejection/acceptance conclusion could alternatively, but equivalently, be made based on the critical value(s) ±t 1 α/2 : If t obs > t 1 α/2 we reject H 0, otherwise we accept H 0. a We are often interested in the test where δ = 0 Klaus KA og Per BB (klaus@cancer.dk) Introduktion til Statistik, Forelæsning 6 Efteråret 2016 12 / 45 Klaus KA og Per BB (klaus@cancer.dk) Introduktion til Statistik, Forelæsning 6 Efteråret 2016 13 / 45 Metode 3.61: Det ensidede two-sample t-test Metode 3.62: Det ensidede two-sample t-test Et level α ensidet less test er 1 Compute t obs and ν as given above. 2 Compute the evidence against the null hypothesis H 0 : µ 1 µ 2 δ vs. the alternative hypothesis H 1 : µ 1 µ 2 < δ by the p value = P (T < t obs ) where the t-distribution with ν degrees of freedom is used. 3 If p value < α: We reject H 0, otherwise we accept H 0. 4 The rejection/acceptance conclusion could alternatively, but equivalently, be made based on the critical value t α : If t obs < t α we reject H 0, otherwise we accept H 0. Et level α ensidet greater test er 1 Compute t obs and ν as given above. 2 Compute the evidence against the null hypothesis H 0 : µ 1 µ 2 δ vs. the alternative hypothesis H 1 : µ 1 µ 2 > δ by the p value = P (T > t obs ) where the t-distribution with ν degrees of freedom is used. 3 If p value < α: We reject H 0, otherwise we accept H 0. 4 The rejection/acceptance conclusion could alternatively, but equivalently, be made based on the critical value t 1 α : If t obs > t 1 α we reject H 0, otherwise we accept H 0. Klaus KA og Per BB (klaus@cancer.dk) Introduktion til Statistik, Forelæsning 6 Efteråret 2016 14 / 45 Klaus KA og Per BB (klaus@cancer.dk) Introduktion til Statistik, Forelæsning 6 Efteråret 2016 15 / 45

Eksempel - energiforbrug Hypotesen om ingen forskel ønskes undersøgt: H 0 : δ = µ B µ A = 0 versus the non-directional(= two-sided) alternative: Først beregninger af t obs og ν: and t obs = ν = H 0 : δ = µ B µ A 0 10.298 8.293 2.0394/9 + 1.954/9 = 3.01 ( 2.0394 9 + 1.954 ) 2 9 (2.0394/9) 2 8 + (1.954/9)2 8 = 15.99 Klaus KA og Per BB (klaus@cancer.dk) Introduktion til Statistik, Forelæsning 6 Efteråret 2016 16 / 45 Eksempel - energiforbrug Dernæst findes p-værdien: p value = 2 P (T > t obs ) = 2P (T > 3.01) = 2 0.00415 = 0.0083 1 - pt(3.01, df = 15.99) [1] 0.0041545 Vurder evidencen (Tabel 3.1): Der er stærk evidence imod nulhypotesen. Konkluder baseret på α = 0.05: Vi forkaster nulhypotesen, der er signifikant forskel på grupperne - sygeplejersker på Hospital B kan siges at have et større (middel)energiforbrug end sygeplejesker på Hospital A. Klaus KA og Per BB (klaus@cancer.dk) Introduktion til Statistik, Forelæsning 6 Efteråret 2016 17 / 45 Konfidensinterval for forskellen Metode 3.69: Konfidensinterval for µ 1 µ 2 Konfidensinterval for forskellen Konfidensinterval og hypotesetest (Repetition) Acceptområdet er de mulige værdier for µ som ikke ligger for langt væk fra data: Konfidensintervallet for middelforskelen bliver: For two samples x 1,..., x n and y 1,..., y n the 100(1 α)% confidence interval for µ 1 µ 2 is given by s 2 1 x ȳ ± t 1 α/2 + s2 2 n 1 n 2 where t 1 α/2 is the 100(1 α/2)%-quantile from the t-distribution with ν degrees of freedom given from equation (3.26) (as above). Rejection Acceptance Rejection x t 0.025 s n x + t 0.975 s n x Klaus KA og Per BB (klaus@cancer.dk) Introduktion til Statistik, Forelæsning 6 Efteråret 2016 19 / 45 Klaus KA og Per BB (klaus@cancer.dk) Introduktion til Statistik, Forelæsning 6 Efteråret 2016 20 / 45

Konfidensinterval for forskellen Eksempel - energiforbrug - det hele i R: Konfidensinterval for forskellen Eksempel - energiforbrug - det hele i R: Let us find the 95% confidence interval for µ B µ A. Since the relevant t-quantile is, using ν = 15.99, the confidence interval becomes: t 0.975 = 2.120 10.298 8.293 ± 2.120 2.0394 which then gives the result as also seen above: [0.59; 3.42] 9 + 1.954 9 xa=c(7.53, 7.48, 8.08, 8.09, 10.15, 8.4, 10.88, 6.13, 7.9) xb=c(9.21, 11.51, 12.79, 11.85, 9.97, 8.79, 9.69, 9.68, 9.19) t.test(xb, xa) Welch Two Sample t-test data: xb and xa t = 3.0091, df = 15.993, p-value = 0.008323 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: 0.59228 3.41661 sample estimates: mean of x mean of y 10.2978 8.2933 Klaus KA og Per BB (klaus@cancer.dk) Introduktion til Statistik, Forelæsning 6 Efteråret 2016 21 / 45 Klaus KA og Per BB (klaus@cancer.dk) Introduktion til Statistik, Forelæsning 6 Efteråret 2016 22 / 45 Overlappende konfidensintervaller? Eksempel - energiforbrug - Præsentation af resultat Barplot med error bars ses ofte Et grupperet barplot med nogle error bars - herunder er 95%-konfidensintervallerne for hver gruppe vist: Overlappende konfidensintervaller? Vær varsom med at bruge overlappende konfidensintervaller Man bruger faktisk så ikke den rigtige variation til at vurdere forskellen: 0 2 4 6 8 10 Stand. dev. of ( X A X B ) Stand. dev. of XA + Stand. dev. of XB Var ( X A X B ) = Var ( X A ) + Var ( X B ) Antag at de to standard-errors er 3 og 4: Summen er7, men 3 2 + 4 2 = 5 Det korrekte forhold mellem de to er således: Stand. dev. of ( X A X B ) < Stand. dev. of XA + Stand. dev. of XB A B Klaus KA og Per BB (klaus@cancer.dk) Introduktion til Statistik, Forelæsning 6 Efteråret 2016 24 / 45 Klaus KA og Per BB (klaus@cancer.dk) Introduktion til Statistik, Forelæsning 6 Efteråret 2016 25 / 45

Overlappende konfidensintervaller? Vær varsom med at bruge overlappende konfidensintervaller Remark 3.73. Regel for brug af overlappende konfidensintervaller : When two CIs do NOT overlap: The two groups are significantly different When two CIs DO overlap: We do not know what the conclusion is Motiverende eksempel - sovemedicin Forskel på sovemedicin? I et studie er man interesseret i at sammenligne 2 sovemidler A og B. For 10 testpersoner har man fået følgende resultater, der er givet i forlænget søvntid (i timer) (Forskellen på effekten af de to midler er angivet): Stikprøve, n = 10: person A B D = B A 1 +0.7 +1.9 +1.2 2-1.6 +0.8 +2.4 3-0.2 +1.1 +1.3 4-1.2 +0.1 +1.3 5-1.0-0.1 +0.9 6 +3.4 +4.4 +1.0 7 +3.7 +5.5 +1.8 8 +0.8 +1.6 +0.8 9 0.0 +4.6 +4.6 10 +2.0 +3.4 +1.4 Klaus KA og Per BB (klaus@cancer.dk) Introduktion til Statistik, Forelæsning 6 Efteråret 2016 26 / 45 Klaus KA og Per BB (klaus@cancer.dk) Introduktion til Statistik, Forelæsning 6 Efteråret 2016 28 / 45 Parret setup og analyse = one-sample analyse Parret setup og analyse = one-sample analyse x1=c(.7,-1.6,-.2,-1.2,-1,3.4,3.7,.8,0,2) x2=c(1.9,.8,1.1,.1,-.1,4.4,5.5,1.6,4.6,3.4) dif=x2-x1 t.test(dif) One Sample t-test data: dif t = 4.6716, df = 9, p-value = 0.001166 alternative hypothesis: true mean is not equal to 0 95 percent confidence interval: 0.86133 2.47867 sample estimates: mean of x 1.67 t.test(x2, x1, paired=true) Paired t-test data: x2 and x1 t = 4.6716, df = 9, p-value = 0.001166 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: 0.86133 2.47867 sample estimates: mean of the differences 1.67 Klaus KA og Per BB (klaus@cancer.dk) Introduktion til Statistik, Forelæsning 6 Efteråret 2016 29 / 45 Klaus KA og Per BB (klaus@cancer.dk) Introduktion til Statistik, Forelæsning 6 Efteråret 2016 30 / 45

Parret versus independent eksperiment Eksempel - Sovemedicin - FORKERT analyse Completely Randomized (independent samples) 20 patients are used and completely at random allocated to one of the two treatments (but usually making sure to have 10 patients in each group). So: different persons in the different groups. Paired (dependent samples) 10 patients are used, and each of them tests both of the treatments. Usually this will involve some time in between treatments to make sure that it becomes meaningful, and also one would typically make sure that some patients do A before B and others B before A. (and doing this allocation at random). So: the same persons in the different groups. t.test(x1,x2) Welch Two Sample t-test data: x1 and x2 t = -1.9334, df = 17.9, p-value = 0.06916 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: -3.48539 0.14539 sample estimates: mean of x mean of y 0.66 2.33 Klaus KA og Per BB (klaus@cancer.dk) Introduktion til Statistik, Forelæsning 6 Efteråret 2016 31 / 45 Klaus KA og Per BB (klaus@cancer.dk) Introduktion til Statistik, Forelæsning 6 Efteråret 2016 32 / 45 Checking the normality assumptions Eksempel - Q-Q plot inden for hver stikprøve: Checking the normality assumptions Eksempel - Sammenligning med simulerede, A 6 7 8 9 10 11 Hospital A 9 10 11 12 Hospital B Klaus KA og Per BB (klaus@cancer.dk) Introduktion til Statistik, Forelæsning 6 Efteråret 2016 34 / 45 Klaus KA og Per BB (klaus@cancer.dk) Introduktion til Statistik, Forelæsning 6 Efteråret 2016 35 / 45

Checking the normality assumptions Eksempel - Sammenligning med simulerede, B Finding the power of detecting a group difference of 2 with σ = 1 for n = 10: power.t.test(n = 10, delta = 2, sd = 1, sig.level = 0.05) 0 1 2 1 2 Two-sample t test power calculation n = 10 delta = 2 sd = 1 sig.level = 0.05 power = 0.98818 alternative = two.sided NOTE: n is number in *each* group Klaus KA og Per BB (klaus@cancer.dk) Introduktion til Statistik, Forelæsning 6 Efteråret 2016 36 / 45 Klaus KA og Per BB (klaus@cancer.dk) Introduktion til Statistik, Forelæsning 6 Efteråret 2016 38 / 45 Finding the sample size for detecting a group difference of 2 with σ = 1 and power= 0.9: power.t.test(power = 0.90, delta = 2, sd = 1, sig.level = 0.05) Two-sample t test power calculation n = 6.3868 delta = 2 sd = 1 sig.level = 0.05 power = 0.9 alternative = two.sided NOTE: n is number in *each* group Finding the detectable effect size (delta) with σ = 1, n = 10 and power= 0.9: power.t.test(power = 0.90, n = 10, sd = 1, sig.level = 0.05) Two-sample t test power calculation n = 10 delta = 1.5337 sd = 1 sig.level = 0.05 power = 0.9 alternative = two.sided NOTE: n is number in *each* group Klaus KA og Per BB (klaus@cancer.dk) Introduktion til Statistik, Forelæsning 6 Efteråret 2016 39 / 45 Klaus KA og Per BB (klaus@cancer.dk) Introduktion til Statistik, Forelæsning 6 Efteråret 2016 40 / 45

The pooled t-test - a possible alternative Metode 3.64: The pooled two-sample t-test statistic The pooled t-test - a possible alternative Theorem 3.65: Fordelingen af den poolede test-størrelse Beregning af den poolede teststørrelse (og 3.63) When considering the null hypothesis about the difference between the means of two independent samples: δ = µ 2 µ 1 er en t-fordeling The pooled two-sample statistic seen as a random variable: T = ( X 1 X 2 ) δ 0 (1) Sp/n 2 1 + Sp/n 2 2 H 0 : δ = δ 0 the pooled two-sample t-test statistic is t obs = ( x 1 x 2 ) δ 0 s 2 p/n 1 + s 2 p/n 2 follows, under the null hypothesis and under the assumption that σ 2 1 = σ2 2, a t-distribution with n 1 + n 2 2 degrees of freedom if the two population distributions are normal. Klaus KA og Per BB (klaus@cancer.dk) Introduktion til Statistik, Forelæsning 6 Efteråret 2016 42 / 45 Klaus KA og Per BB (klaus@cancer.dk) Introduktion til Statistik, Forelæsning 6 Efteråret 2016 43 / 45 The pooled t-test - a possible alternative Vi bruger altid Welch versionen Oversigt The pooled t-test - a possible alternative Nogenlunde (idiot)sikkert at bruge Welch-versionen altid if s 2 1 = s2 2 the Welch and the Pooled test statistics are the same. Only when the two variances become really different the two test-statistics may differ in any important way, and if this is the case, we would not tend to favour the pooled version, since the assumption of equal variances appears questionable then. Only for cases with a small sample sizes in at least one of the two groups the pooled approach may provide slightly higher power if you believe in the equal variance assumption. And for these cases the Welch approach is then a somewhat cautious approach. 1 Motiverende eksempel - energiforbrug 2 Hypotesetest (Repetition) 3 4 Konfidensinterval for forskellen 5 Overlappende konfidensintervaller? 6 7 Checking the normality assumptions 8 9 The pooled t-test - a possible alternative Klaus KA og Per BB (klaus@cancer.dk) Introduktion til Statistik, Forelæsning 6 Efteråret 2016 44 / 45 Klaus KA og Per BB (klaus@cancer.dk) Introduktion til Statistik, Forelæsning 6 Efteråret 2016 45 / 45