Comparing Several Means

Similar documents
ANOVA: Analysis of Variation

1-Way ANOVA MATH 143. Spring Department of Mathematics and Statistics Calvin College

Example: Four levels of herbicide strength in an experiment on dry weight of treated plants.

Wolf River. Lecture 19 - ANOVA. Exploratory analysis. Wolf River - Data. Sta 111. June 11, 2014

Chapter 11 - Lecture 1 Single Factor ANOVA

Wolf River. Lecture 15 - ANOVA. Exploratory analysis. Wolf River - Data. Sta102 / BME102. October 26, 2015

Sociology 6Z03 Review II

In ANOVA the response variable is numerical and the explanatory variables are categorical.

Analysis of Variance (ANOVA) Cancer Research UK 10 th of May 2018 D.-L. Couturier / R. Nicholls / M. Fernandes

Announcements. Unit 4: Inference for numerical variables Lecture 4: ANOVA. Data. Statistics 104

Wolf River. Lecture 15 - ANOVA. Exploratory analysis. Wolf River - Data. Sta102 / BME102. October 22, 2014

Introduction. Chapter 8

Multiple t Tests. Introduction to Analysis of Variance. Experiments with More than 2 Conditions

Chapter Seven: Multi-Sample Methods 1/52

Analysis of Variance

df=degrees of freedom = n - 1

Lecture 10: F -Tests, ANOVA and R 2

y ˆ i = ˆ " T u i ( i th fitted value or i th fit)

Example - Alfalfa (11.6.1) Lecture 14 - ANOVA cont. Alfalfa Hypotheses. Treatment Effect

ANOVA Situation The F Statistic Multiple Comparisons. 1-Way ANOVA MATH 143. Department of Mathematics and Statistics Calvin College

Multiple Testing. Gary W. Oehlert. January 28, School of Statistics University of Minnesota

1 Multiple Regression

Lecture 15 - ANOVA cont.

Statistics for EES Factorial analysis of variance

Multiple Comparisons

Module 03 Lecture 14 Inferential Statistics ANOVA and TOI

Statistiek II. John Nerbonne using reworkings by Hartmut Fitz and Wilbert Heeringa. February 13, Dept of Information Science

Linear regression. We have that the estimated mean in linear regression is. ˆµ Y X=x = ˆβ 0 + ˆβ 1 x. The standard error of ˆµ Y X=x is.

Week 14 Comparing k(> 2) Populations

Workshop 7.4a: Single factor ANOVA

Summary of Chapter 7 (Sections ) and Chapter 8 (Section 8.1)

SIMPLE REGRESSION ANALYSIS. Business Statistics

DESAIN EKSPERIMEN Analysis of Variances (ANOVA) Semester Genap 2017/2018 Jurusan Teknik Industri Universitas Brawijaya

More about Single Factor Experiments

One-Way Analysis of Variance: ANOVA

Example - Alfalfa (11.6.1) Lecture 16 - ANOVA cont. Alfalfa Hypotheses. Treatment Effect

Factorial designs. Experiments

Regression Part II. One- factor ANOVA Another dummy variable coding scheme Contrasts Mul?ple comparisons Interac?ons

FinalExamReview. Sta Fall Provided: Z, t and χ 2 tables

COMPARING SEVERAL MEANS: ANOVA

ANOVA Analysis of Variance

ANOVA: Comparing More Than Two Means

Sampling distribution of t. 2. Sampling distribution of t. 3. Example: Gas mileage investigation. II. Inferential Statistics (8) t =

The One-Way Independent-Samples ANOVA. (For Between-Subjects Designs)

22s:152 Applied Linear Regression. Take random samples from each of m populations.

Simple Linear Regression

One- factor ANOVA. F Ra5o. If H 0 is true. F Distribu5on. If H 1 is true 5/25/12. One- way ANOVA: A supersized independent- samples t- test

22s:152 Applied Linear Regression. There are a couple commonly used models for a one-way ANOVA with m groups. Chapter 8: ANOVA

Lecture 6: Linear Regression

Math 141. Lecture 16: More than one group. Albyn Jones 1. jones/courses/ Library 304. Albyn Jones Math 141

Introduction to Analysis of Variance (ANOVA) Part 2

This gives us an upper and lower bound that capture our population mean.

ANOVA: Analysis of Variance

Variance Decomposition and Goodness of Fit

9 One-Way Analysis of Variance

Econ 3790: Business and Economic Statistics. Instructor: Yogesh Uppal

Comparing Several Means: ANOVA

Multiple Linear Regression. Chapter 12

Linear Combinations of Group Means

Keppel, G. & Wickens, T. D. Design and Analysis Chapter 4: Analytical Comparisons Among Treatment Means

Chapter 26: Comparing Counts (Chi Square)

IEOR165 Discussion Week 12

Tables Table A Table B Table C Table D Table E 675


STA 302 H1F / 1001 HF Fall 2007 Test 1 October 24, 2007

Inferences for Regression

Chapter 12 - Lecture 2 Inferences about regression coefficient

Statistics for Managers Using Microsoft Excel Chapter 10 ANOVA and Other C-Sample Tests With Numerical Data

1 Introduction to One-way ANOVA

Announcements. Final Review: Units 1-7

Lecture 6 Multiple Linear Regression, cont.

Categorical Data Analysis. The data are often just counts of how many things each category has.

22s:152 Applied Linear Regression. Chapter 8: 1-Way Analysis of Variance (ANOVA) 2-Way Analysis of Variance (ANOVA)

Specific Differences. Lukas Meier, Seminar für Statistik

STAT22200 Spring 2014 Chapter 5

R 2 and F -Tests and ANOVA

Inference for Regression Inference about the Regression Model and Using the Regression Line

Formal Statement of Simple Linear Regression Model

Multiple Testing. Tim Hanson. January, Modified from originals by Gary W. Oehlert. Department of Statistics University of South Carolina

Table 1: Fish Biomass data set on 26 streams

MS&E 226: Small Data

LECTURE 6. Introduction to Econometrics. Hypothesis testing & Goodness of fit

Analysis of Covariance. The following example illustrates a case where the covariate is affected by the treatments.

Unbalanced Data in Factorials Types I, II, III SS Part 1

STA 4210 Practise set 2a

Tests of Linear Restrictions

Chap The McGraw-Hill Companies, Inc. All rights reserved.

Hypothesis testing: Steps

Lecture 5: ANOVA and Correlation

Chapter 9 Inferences from Two Samples

Hypothesis T e T sting w ith with O ne O One-Way - ANOV ANO A V Statistics Arlo Clark Foos -

22s:152 Applied Linear Regression. 1-way ANOVA visual:

STAT 135 Lab 11 Tests for Categorical Data (Fisher s Exact test, χ 2 tests for Homogeneity and Independence) and Linear Regression

STAT763: Applied Regression Analysis. Multiple linear regression. 4.4 Hypothesis testing

STA441: Spring Multiple Regression. This slide show is a free open source document. See the last slide for copyright information.

STAT 401A - Statistical Methods for Research Workers

ANOVA: Comparing More Than Two Means

Announcements. Statistics 104 (Mine C etinkaya-rundel) Diamonds. From last time.. = 22

Multiple Pairwise Comparison Procedures in One-Way ANOVA with Fixed Effects Model

Analysis of variance

Transcription:

Comparing Several Means Some slides from R. Pruim STA303/STA1002: Methods of Data Analysis II, Summer 2016 Michael Guerzhoy

The Dating World of Swordtail Fish In some species of swordtail fish, males develop brightly coloured swordtails Southern Platyfish do not Want to know: will female Southern Platyfish prefer males with artificial brightly-coloured swordtails? If they do, that s evidence that males in other species evolved as a result of female preference Experiment: multiple pair of males, one with a transparent artificial tail, one with a bright yellow artificial swordtail. Measure the percentage of time the female spends courting with the male with the yellow tail. There are 84 females in total.

Platyfish Eventually, we would like to know whether females spent more time with the yellow-swordtailed males. But we would like to first investigate whether there is anything else going on in the data that might affect our conclusions Question: Do the (means of) the quantitative variables depend on which group (given by categorical variable) the individual is in? (the fish, in R)

Computing Group Means with Linear Regression Fit a linear regression: Y~a 0 + a g1 I g1 + a g2 I g2 + + a gn I gn Y: the percentage of time the female spends with the yellow-tailed male I gk : 1 if the case involves Group k, 0 otherwise Regression: Minimize σ i Y i (a 0 + a g1 I i,g1 + a g2 I i,g2 + + a gn I i,gn ) 2

Computing Group Means with Linear Regression σ i Y i (a 0 + a g1 I i,g1 + a g2 I i,g2 + + a gn I i,gn ) 2 = group i group Y i a group 2 σ i group Y i a group 2 is minimized when a group =? (show how to do this)

Computing Group Means with Linear Regression σ i group Y i a group 2 = 0 2 i group Y i a group = 0 i group Y i = i group a group = σ i group Y i N group a group

Computing the Means with R (in R)

Are the Pairs Different from Each Other? If we had just two pairs in which we re interested, we could simply use a t-test Estimate the pooled variance from the entire dataset s p 2 = N g1 1 s 1 2 + + N gn 1 s N 2 N g1 1 + +(N gn 1) mean g1 mean g2 1 s p Ng1 + 1 Ng2 ( N g1 1 + + (N gn 1) d.f.) ~t( N g1 1 + + (N gn 1)) But we re interested in whether any pair is different from any other pair

ANOVA Null Hypothesis: the means of all the groups are equal Notation: N: number of individuals/observation all together തX: mean for entire data set is Group i: N i : number of individuals in group i X ij : value for individual j in group i ഥX i : mean for group i

ANOVA: Idea If all the group means are the same, the average variation within the groups should be almost as large as the average variation within the entire dataset (why almost?) Variation BETWEEN groups: For each data value look at the difference between its group mean and the overall mean: σ i N i ഥX i തX 2 Variation WITHIN groups: For each data value look at the difference between the value and the group mean: σ i σ j X ij തX i 2

ANOVA: Idea SSReg (Regression Sum of Squares, variation across groups) : σ i N i ഥX i തX 2 (d.f.: Ngroups-1) RSS (Residual Sum of Squares, variation within groups): σ i σ j X ij തX i 2 (d.f.: Npoints-Ngroups) Compute the ratio of the averages: F = σ i N i X i തX 2 Npoints Ngroups Ngroups 1 / σ i σ j X ij തX i 2

ANOVA: Idea F = σ i X i തX 2 Ngroups 1 / σ i σ j X ij തX i 2 Npoints ngroups If average between-group variation is not larger than average within-group variation (i.e., the Null Hypothesis is true), F 1 If between-group variation is larger than within-group variation (i.e., the means for the different groups are different), F > 1 σ i N i X i തX 2 σ ij X ij X i σ 2 ~χ 2 (Ngroups 1) σ 2 2 ~χ 2 Npoints Ngroups F~F(Ngroups 1, Npoints Ngroups)

The F distribution If W 1 ~χ 2 (k 1 ) and W 2 ~χ 2 (k 2 ), then F = W 1 W 2 ~F(k 1, k2)

ANOVA: the model Constant variance σ 2, (possibly) different means μ i for the different groups X ij ~N μ i, σ 2 Null Hypothesis: μ 1 = μ 2 = = μ Ngroups F statistic: F = σ i N i X i തX 2 / σ i σ j X ij തX i Ngroups 1 Npoints ngroups F-test: P μ1 = =μ Ngroups (F > f) If the Null Hypothesis is true, F~F(Ngroups 1, Npoints Ngroups) 2

ANOVA table Df Sum Sq Mean Sq F value Pr(>F) Pair 5 938.7 187.75 0.7858 0.563 Residuals 78 18636.7 238.93 1 less than # of groups # of data values - # of groups (equals df for each group added together)

ANOVA table Df Sum Sq Mean Sq F value Pr(>F) Pair 5 938.7 187.75 0.7858 0.563 Residuals 78 18636.7 238.93 (X ij തX i ) ij N i തX i തX 2 i

ANOVA table Df Sum Sq Mean Sq F value Pr(>F) Pair 5 938.7 187.75 0.7858 0.563 Residuals 78 18636.7 238.93 MSG = SSG DFG MSE = SSE DFE F = MSG / MSE P F > f ~F(DFG < DFE)

ANOVA table Df Sum Sq Mean Sq F value Pr(>F) Pair 5 938.7 187.75 0.7858 0.563 Residuals 78 18636.7 238.93 The p-value for the F-statistic. A measure of how compatible the data is with the hypothesis that μ 1 = = μ Ngroups

Pairwise t-tests Suppose we find (using an F-test) that there are differences between the different means. That still doesn t tell us what the differences are Naively, we can run a t-test for every pair of groups (in R)

Problem with Multiple Comparisons If we are computing a p-value and the Null Hypothesis is true, we d get a false positive 5% of the time (1 time out of 20) False positive: p-value<.05, but the Null Hypothesis is true If we are computing 20 p-values and the Null Hypothesis is true, what percent of the time will we get at least one false positive?

Problem with Multiple Comparisons If we are computing 20 p-values and the Null Hypothesis is true, what percent of the time will we get at least one false positive? 1 1 0.05 20 64% If we have 7 groups, and compare each mean to each other mean, how many comparisons do we make? (Show in R)

Problem with Multiple Comparisons N variables to do pairwise comparison on: N 2 = N(N 1)/2 comparisons Intuition: See the table in R For each coefficient (N) of them, compare it to every other (N-1): N(N-1) comparisons. But we compared each pair twice, so divide by two: N(N-1)/2

Bonferroni correction Boole s inequality: the probability of any one of the events E 1, E 2,, E n happening is smaller than σ i P(E i ): P i E i σ i P E i Idea: the probability is largest when the events are mutually exclusive, in which case the probability is σ i P E i n P i=1 n p i α n σ n i=1 P p i α = nα = α n n

Bonferroni correction If we want the familywise p-value threshold to be α, make the individual p-value threshold be α n, where n is the number of groups Generally, very conservative Why?

Tukey s Honest Significant Differences (HSD) Tukey s HSD is a method of adjusting the SE estimate based on the range of the data Not as conservative as using the Bonferroni correction

Confidence Intervals -- Bonferroni If the statistic is t-distributed: መθ ± t α df,1 SE( መθ) k (In R)

Summary: F-test and Pairwise Comparisons Assuming (and checking) normal distributions with constant variance in different groups: Run F-test to see if any of the means are different Can follow up and check pairwise differences If you have a hypothesis about which group means are different ahead of time, that s like running multiple studies Some of your multiple studies might be wrong, of course Still, okay not to adjust as long as you report that you had lots of hypotheses about which means might be different Of course, if you have lots of hypotheses, people might think you re a little bit scatterbrained