One-way ANOVA - FCUP · 09/30/12 2 Experimental Design One-way ANOVA Outline of this class Data...

Post on 05-Jul-2020

2 views 0 download

Transcript of One-way ANOVA - FCUP · 09/30/12 2 Experimental Design One-way ANOVA Outline of this class Data...

09/30/12 1

Experimental Design One-way ANOVA

One-way ANOVA

● Method to compare more than two samples simultaneously without inflating Type I Error rate (α)

● Simplicity

● Few assumptions

● Adequate for highly complex hypothesis testing

09/30/12 2

Experimental Design One-way ANOVA

Outline of this class●Data organization and layout

●Repartitioning of variance

●Definition of a linear model

●Combine the linear model with the repatitioning of variances

●Definition of a statistic (F-test)

09/30/12 3

Experimental Design One-way ANOVA

Data organization

Suppose that we want to investigate the average length of a fish species in three different lakes because we suspect that there might be some form of local adaptation

We sample 5 fish (replicates) at each lake

09/30/12 4

Experimental Design One-way ANOVA

Data organization

First we establish how to measure “length”

Lenght

This is an important part of experimental design!

09/30/12 5

Experimental Design One-way ANOVA

Data organization

Then we collect the data

09/30/12 6

Experimental Design One-way ANOVA

Data organization

Factor “Lake” has three levels: 1, 2 and 3

09/30/12 7

Experimental Design One-way ANOVA

Data organization

09/30/12 8

Experimental Design One-way ANOVA

Data organization

We may represent it as

Note that Lake is a classification criteria, that is, we can classify each fish according to the lake where it belongs

09/30/12 9

Experimental Design One-way ANOVA

Total variation =

Ronald Aylmer Fisher (1890-1962)

Repartitioning the variance

09/30/12 10

Experimental Design One-way ANOVA

Total variation =

Sum of all the squared differences between each individual value and the grand mean (overall mean)

But why squaring the differences?

Why this formula?

09/30/12 11

Experimental Design One-way ANOVA

Total variation =

09/30/12 12

Experimental Design One-way ANOVA

= 0

Total variationWithin treatments variation

Among (between) treatments variation

09/30/12 13

Experimental Design One-way ANOVA

Repartitioning the variance

09/30/12 14

Experimental Design One-way ANOVA

What do these quantities measure?

Repartitioning the variance

09/30/12 15

Experimental Design One-way ANOVA

Why use analysis of variance to test hypothesis about the means?

Repartitioning the variance

09/30/12 16

Experimental Design One-way ANOVA

Defining a linear model

Any single measurement can be predicted if we know the mean (μ) of the treatment or sample where it belongs (i) and the error (e) associated with that particular replicate (j) in the sample i

09/30/12 17

Experimental Design One-way ANOVA

An interesting propertyTake sample 1 (Lake 1)

09/30/12 18

Experimental Design One-way ANOVA

An interesting property

09/30/12 19

Experimental Design One-way ANOVA

An interesting property

09/30/12 20

Experimental Design One-way ANOVA

An interesting propertyWe can represent any sample in terms of its errors

We will make use of this property later on...

09/30/12 21

Experimental Design One-way ANOVA

Back to the linear model

H0: μ

1 = μ

2 = μ

3 = ... = μ

i ... = μ

a = μ

If the null hypothesis is true, all samples (treatments or levels) came from the same population

09/30/12 22

Experimental Design One-way ANOVA

Defining the linear model

If the null hypothesis is false, some samples will deviate from the grand mean by an amount called A

H0: A

1 = A

2 = A

3 = ... = A

i ... = A

a = 0

09/30/12 23

Experimental Design One-way ANOVA

Defining the linear model

09/30/12 24

Experimental Design One-way ANOVA

Defining the linear model

09/30/12 25

Experimental Design One-way ANOVA

Defining the linear model

09/30/12 26

Experimental Design One-way ANOVA

Joining the linear model andthe repartitioning of variances

09/30/12 27

Experimental Design One-way ANOVA

09/30/12 28

Experimental Design One-way ANOVA

09/30/12 29

Experimental Design One-way ANOVA

Where do we know this from?

We know that a sample can also be represented by the deviations of each replicate to the sample mean (errors)

09/30/12 30

Experimental Design One-way ANOVA

09/30/12 31

Experimental Design One-way ANOVA

09/30/12 32

Experimental Design One-way ANOVA

09/30/12 33

Experimental Design One-way ANOVA

09/30/12 34

Experimental Design One-way ANOVA

09/30/12 35

Experimental Design One-way ANOVA

09/30/12 36

Experimental Design One-way ANOVA

COVARIANCE

1st Assumption: individual observations are independent from each other (that is, no particular observation influences any other observation in the same or other sample)

INDEPENDENCE OF OBSERVATIONS

09/30/12 37

Experimental Design One-way ANOVA

COVARIANCE

If observations are independent, covariance is null (zero)

INDEPENDENCE OF OBSERVATIONS

09/30/12 38

Experimental Design One-way ANOVA

If observations are independent, covariance is null (zero)

INDEPENDENCE OF OBSERVATIONS

09/30/12 39

Experimental Design One-way ANOVA

Let’s focus on this term...

This is the deviation of sample means from the grand mean (Remember the Central Limit Theorem?)

09/30/12 40

Experimental Design One-way ANOVA

The central limit theorem says

09/30/12 41

Experimental Design One-way ANOVA

2nd Assumption: sample variances are equal (homogeneous or homoscedastic)

HOMOGENEITY OF VARIANCES

09/30/12 42

Experimental Design One-way ANOVA

2nd Assumption: sample variances are equal (homogeneous or homoscedastic)

HOMOGENEITY OF VARIANCES

09/30/12 43

Experimental Design One-way ANOVA

2nd Assumption: sample variances are equal (homogeneous or homoscedastic)

HOMOGENEITY OF VARIANCES

09/30/12 44

Experimental Design One-way ANOVA

2nd Assumption: sample variances are equal (homogeneous or homoscedastic)

HOMOGENEITY OF VARIANCES

Using the same argument

09/30/12 45

Experimental Design One-way ANOVA

09/30/12 46

Experimental Design One-way ANOVA

Change the order of “Between” and “Within” samples since this is the most common layout for an ANOVA

09/30/12 47

Experimental Design One-way ANOVA

Introducing degrees of freedom

● For a factor with a levels: a-1

● For the within samples variation: a(n-1)

● For the Total variation: an-1

09/30/12 48

Experimental Design One-way ANOVA

Introducing degrees of freedom

09/30/12 49

Experimental Design One-way ANOVA

Introducing degrees of freedom and Mean Squares

Mean Square (MS) = Sum of Squares / Degrees of Freedom (SS/DF)

09/30/12 50

Experimental Design One-way ANOVA

Introducing degrees of freedom and Mean Squares

Mean Square (MS) = Sum of Squares / Degrees of Freedom (SS/DF)

09/30/12 51

Experimental Design One-way ANOVA

Revisiting the null hypothesisIf the null hypothesis is true, sample means will be the same as the grand mean and deviations from the latter (A

i) will be zero

H0: A

1 = A

2 = A

3 = ... = A

i ... = A

a = 0

09/30/12 52

Experimental Design One-way ANOVA

If the null hypothesis is true

09/30/12 53

Experimental Design One-way ANOVA

If the null hypothesis is true

09/30/12 54

Experimental Design One-way ANOVA

Choosing a statistical test

09/30/12 55

Experimental Design One-way ANOVA

The adequate statistical test

3th Assumption: the variable being sampled follows a normal distribution (often stated as: the population being sampled follows a normal distribution)

NORMALITY OF SAMPLED POPULATION

If this is true, the ratio between two variances follows a F-distribution

09/30/12 56

Experimental Design One-way ANOVA

The F distribution

F ≈ 1: H0 true

F > 1: H0 false

09/30/12 57

Experimental Design One-way ANOVA

ANOVA in action

Source of variation

SS DF MS F P

Lakes 48.933

Error 50.000

Total 98.933

09/30/12 58

Experimental Design One-way ANOVA

ANOVA in action

Source of variation

SS DF MS F P

Lakes 48.933 2

Error 50.000 12

Total 98.933 14

09/30/12 59

Experimental Design One-way ANOVA

ANOVA in action

Source of variation

SS DF MS F P

Lakes 48.933 2 24.467

Error 50.000 12 4.167

Total 98.933 14

09/30/12 60

Experimental Design One-way ANOVA

ANOVA in action

Source of variation

SS DF MS F P

Lakes 48.933 2 24.467 5.872

Error 50.000 12 4.167

Total 98.933 14

09/30/12 61

Experimental Design One-way ANOVA

ANOVA in actionSource of variation

SS DF MS F P

Lakes 48.933 2 24.467 5.872

Error 50.000 12 4.167

Total 98.933 14

F > Fcrit

H0 rejected

HA accepted

Average length of fish species differs among lakes

0.017