epidemiology 9509 - principles of biostatistics...

26
Epidemiology 9509 oneway (continued) Epidemiology 9509 Principles of Biostatistics Chapter 15 - One way analysis of variance (continued) John Koval Department of Epidemiology and Biostatistics University of Western Ontario 1

Upload: others

Post on 20-Jun-2020

25 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Epidemiology 9509 - Principles of Biostatistics …publish.uwo.ca/~jkoval/courses/Epid9509/chapter15/...Epidemiology9509 oneway(continued) Epidemiology 9509 Principles of Biostatistics

Epidemiology 9509 oneway (continued)

Epidemiology 9509Principles of Biostatistics

Chapter 15- One way analysis of variance (continued)

John Koval

Department of Epidemiology and BiostatisticsUniversity of Western Ontario

1

Page 2: Epidemiology 9509 - Principles of Biostatistics …publish.uwo.ca/~jkoval/courses/Epid9509/chapter15/...Epidemiology9509 oneway(continued) Epidemiology 9509 Principles of Biostatistics

Epidemiology 9509 oneway (continued)

What is being covered

1. multiple comparisons (posthoc tests)

1.1 p-value1.2 confidence intervals for differences

2. using SAS for oneway ANOVA

2.1 SAS Proc ANOVA2.2 options for unequal group size

2

Page 3: Epidemiology 9509 - Principles of Biostatistics …publish.uwo.ca/~jkoval/courses/Epid9509/chapter15/...Epidemiology9509 oneway(continued) Epidemiology 9509 Principles of Biostatistics

Epidemiology 9509 oneway (continued)

p-value method

test statistic

q =|y1 − y2|

s2p2

(

1n1

+ 1n2

)

when sample size equal

q =|y1 − y2|√

s2pn

3

Page 4: Epidemiology 9509 - Principles of Biostatistics …publish.uwo.ca/~jkoval/courses/Epid9509/chapter15/...Epidemiology9509 oneway(continued) Epidemiology 9509 Principles of Biostatistics

Epidemiology 9509 oneway (continued)

example

we calculate, from the data,q12 = q23 =

0.5√

(0.183)5

= 2.613

Similarly, q13 = 5.227

by table A.5 on page A.37, p-value for q12 and q23= Pr(Q3,12 > 2.613) > 0.10

Similarly, for q13p-value = Pr(Q3,12 > 5.227) < 0.01

4

Page 5: Epidemiology 9509 - Principles of Biostatistics …publish.uwo.ca/~jkoval/courses/Epid9509/chapter15/...Epidemiology9509 oneway(continued) Epidemiology 9509 Principles of Biostatistics

Epidemiology 9509 oneway (continued)

Conclusion

Hence, at α = 0.05

1. the effect of Placebo is different from that of ASA

2. but the effect of AC is not different from Placebo or ASA

sometimes described pictoriallyPlacebo AC ASA

SAS uses this in its LINES option

5

Page 6: Epidemiology 9509 - Principles of Biostatistics …publish.uwo.ca/~jkoval/courses/Epid9509/chapter15/...Epidemiology9509 oneway(continued) Epidemiology 9509 Principles of Biostatistics

Epidemiology 9509 oneway (continued)

multiple confidence intervals

using Tukey methodHSD (Honestly Significance Difference)

for equal group size

|yi − yj | ±Qk,N−k,0.05

s2p

n

for unequal group size

|yi − yj | ± Qk,N−k,0.05

s2p

2

(

1

ni+

1

nj

)

6

Page 7: Epidemiology 9509 - Principles of Biostatistics …publish.uwo.ca/~jkoval/courses/Epid9509/chapter15/...Epidemiology9509 oneway(continued) Epidemiology 9509 Principles of Biostatistics

Epidemiology 9509 oneway (continued)

multiple confidence intervals - example

(

s2pn

)

=√

0.1835 = 0.1915

From the tables (page A.31)Q3,12,0.05 = 3.783

7

Page 8: Epidemiology 9509 - Principles of Biostatistics …publish.uwo.ca/~jkoval/courses/Epid9509/chapter15/...Epidemiology9509 oneway(continued) Epidemiology 9509 Principles of Biostatistics

Epidemiology 9509 oneway (continued)

multiple confidence intervals - example (continued)

six pairs of differencescompute the confidence intervals for only three

8

Page 9: Epidemiology 9509 - Principles of Biostatistics …publish.uwo.ca/~jkoval/courses/Epid9509/chapter15/...Epidemiology9509 oneway(continued) Epidemiology 9509 Principles of Biostatistics

Epidemiology 9509 oneway (continued)

multiple confidence intervals - example (continued)

six pairs of differencescompute the confidence intervals for only three

1. δ21 = µ2 − µ1 = −δ12(positive difference)

2. δ32 = µ3 − µ2 = −δ23

3. δ31 = µ3 − µ1 = −δ13

9

Page 10: Epidemiology 9509 - Principles of Biostatistics …publish.uwo.ca/~jkoval/courses/Epid9509/chapter15/...Epidemiology9509 oneway(continued) Epidemiology 9509 Principles of Biostatistics

Epidemiology 9509 oneway (continued)

multiple confidence intervals - example (again)

1. 0.5± 3.783(0.1915) = 0.5 +−0.724= (−0.224, 1.224)for the first two

2. 1.0± 3.783(0.1915) = 1.0 +−0.724= (0.276, 1.724)for the last

using the confidence intervals for testinggives same conclusion as critical value and p-value

10

Page 11: Epidemiology 9509 - Principles of Biostatistics …publish.uwo.ca/~jkoval/courses/Epid9509/chapter15/...Epidemiology9509 oneway(continued) Epidemiology 9509 Principles of Biostatistics

Epidemiology 9509 oneway (continued)

using SAS for ANOVA

balanced data onlyequal group size

1. ask for multiple comparisons

MEANS groupvar/TUKEY;

2. critical value is defaultask for confidence intervals for differences

MEANS groupvar/CLDIFF TUKEY;

11

Page 12: Epidemiology 9509 - Principles of Biostatistics …publish.uwo.ca/~jkoval/courses/Epid9509/chapter15/...Epidemiology9509 oneway(continued) Epidemiology 9509 Principles of Biostatistics

Epidemiology 9509 oneway (continued)

data

1 0.6

1 0.4

1 0.0

1 -0.4

1 -0.6

2 1.0

2 0.5

2 0.0

2 0.3

2 0.7

3 1.0

3 1.5

3 0.5

3 1.2

3 0.8

12

Page 13: Epidemiology 9509 - Principles of Biostatistics …publish.uwo.ca/~jkoval/courses/Epid9509/chapter15/...Epidemiology9509 oneway(continued) Epidemiology 9509 Principles of Biostatistics

Epidemiology 9509 oneway (continued)

program

filename one ’onew.dat’;

data marj;

infile one;

input group difft ;

label group = ’treatment group’ ;

label difft = ’change in body temperature’;

proc anova ;

class group;

model difft= group;

means group/tukey;

means group/cldiff tukey;

13

Page 14: Epidemiology 9509 - Principles of Biostatistics …publish.uwo.ca/~jkoval/courses/Epid9509/chapter15/...Epidemiology9509 oneway(continued) Epidemiology 9509 Principles of Biostatistics

Epidemiology 9509 oneway (continued)

SAS output

oneway analysis of variance

The ANOVA Procedure

Class Level Information

Class Levels Values

group 3 1 2 3

Number of Observations Read 15

Number of Observations Used 15

Dependent Variable: difft change in body temperature

Sum of

Source DF Squares Mean Square FValue Pr > F

Model 2 2.50000000 1.25000000 6.82 0.0105

Error 12 2.20000000 0.18333333

Corrected Total 14 4.70000000

14

Page 15: Epidemiology 9509 - Principles of Biostatistics …publish.uwo.ca/~jkoval/courses/Epid9509/chapter15/...Epidemiology9509 oneway(continued) Epidemiology 9509 Principles of Biostatistics

Epidemiology 9509 oneway (continued)

output II

Tukey’s Studentized Range (HSD) Test for difft

NOTE: This test controls the Type I experimentwise

error rate, but it generally has a higher Type II

error rate than REGWQ.

15

Page 16: Epidemiology 9509 - Principles of Biostatistics …publish.uwo.ca/~jkoval/courses/Epid9509/chapter15/...Epidemiology9509 oneway(continued) Epidemiology 9509 Principles of Biostatistics

Epidemiology 9509 oneway (continued)

output III

Alpha 0.05

Error Degrees of Freedom 12

Error Mean Square 0.183333

Critical Value of Studentized Range 3.77278

Minimum Significant Difference 0.7224

Means with the same letter

are not significantly different.

Tukey Grouping Mean N group

A 1.0000 5 3

A

B A 0.5000 5 2

B

B 0.0000 5 1

16

Page 17: Epidemiology 9509 - Principles of Biostatistics …publish.uwo.ca/~jkoval/courses/Epid9509/chapter15/...Epidemiology9509 oneway(continued) Epidemiology 9509 Principles of Biostatistics

Epidemiology 9509 oneway (continued)

output IV

Comparisons significant at the 0.05 level

are indicated by ***.

Difference

group Between Simultaneous 95%

Comparison Means Confidence Limits

3 - 2 0.5000 -0.2224 1.2224

3 - 1 1.0000 0.2776 1.7224 ***

2 - 3 -0.5000 -1.2224 0.2224

2 - 1 0.5000 -0.2224 1.2224

1 - 3 -1.0000 -1.7224 -0.2776 ***

1 - 2 -0.5000 -1.2224 0.2224

17

Page 18: Epidemiology 9509 - Principles of Biostatistics …publish.uwo.ca/~jkoval/courses/Epid9509/chapter15/...Epidemiology9509 oneway(continued) Epidemiology 9509 Principles of Biostatistics

Epidemiology 9509 oneway (continued)

Comment

For equal sized groups (balance)the critical value methodand use of multiple confidence interval

GIVE THE SAME INFERENTIAL RESULTS

18

Page 19: Epidemiology 9509 - Principles of Biostatistics …publish.uwo.ca/~jkoval/courses/Epid9509/chapter15/...Epidemiology9509 oneway(continued) Epidemiology 9509 Principles of Biostatistics

Epidemiology 9509 oneway (continued)

unbalanced data

remove one ASA score from previous data

1 0.6

1 0.4

1 0.0

1 -0.4

1 -0.6

2 1.0

2 0.5

2 0.0

2 0.3

2 0.7

3 1.5

3 0.5

3 1.2

3 0.8

19

Page 20: Epidemiology 9509 - Principles of Biostatistics …publish.uwo.ca/~jkoval/courses/Epid9509/chapter15/...Epidemiology9509 oneway(continued) Epidemiology 9509 Principles of Biostatistics

Epidemiology 9509 oneway (continued)

Using SAS

1. The SAS manual says to use Proc GLMinstead of Proc ANOVAbut, for our example,Procs give identical output

2. with unequal group sizefor multiple comparisons

2.1 the default is OPTION CLDIFFuses the actual group sizes

2.2 OPTION LINESuses the harmonic mean of the groups sizes

these two approachesCAN lead to different inferencesI recommend OPTION CLDIFFand the actual group sizes

20

Page 21: Epidemiology 9509 - Principles of Biostatistics …publish.uwo.ca/~jkoval/courses/Epid9509/chapter15/...Epidemiology9509 oneway(continued) Epidemiology 9509 Principles of Biostatistics

Epidemiology 9509 oneway (continued)

SAS program for unbalanced data

title1 ’oneway analysis of variance’;

title2 ’unbalanced data’;

filename one ’onew2.dat’;

data marj;

infile one;

input group difft ;

label group = ’treatment group’ ;

label difft = ’change in body temperature’;

proc anova;

class group;

model difft= group;

means group/lines tukey;

means group/cldiff tukey;

21

Page 22: Epidemiology 9509 - Principles of Biostatistics …publish.uwo.ca/~jkoval/courses/Epid9509/chapter15/...Epidemiology9509 oneway(continued) Epidemiology 9509 Principles of Biostatistics

Epidemiology 9509 oneway (continued)

SAS output for unbalanced data

oneway analysis of variance

unequal sample size

proc anova

The ANOVA Procedure

Class Level Information

Class Levels Values

group 3 1 2 3

Number of Observations Read 14

Number of Observations Used 14

Dependent Variable: difft change in body temperature

Sum of

Source DF Squares Mean Square FValue Pr > F

Model 2 2.23214286 1.11607143 5.58 0.0212

Error 11 2.20000000 0.20000000

Corrected Total 13 4.43214286

22

Page 23: Epidemiology 9509 - Principles of Biostatistics …publish.uwo.ca/~jkoval/courses/Epid9509/chapter15/...Epidemiology9509 oneway(continued) Epidemiology 9509 Principles of Biostatistics

Epidemiology 9509 oneway (continued)

SAS output for unbalanced data II

Tukey’s Studentized Range (HSD) Test for difft

NOTE: This test controls the Type I experimentwise

error rate, but it generally has a higher Type II

error rate than REGWQ.

Alpha 0.05

Error Degrees of Freedom 11

Error Mean Square 0.2

Critical Value of Studentized Range 3.81952

Minimum Significant Difference 0.7951

Harmonic Mean of Cell Sizes 4.615385

NOTE: Cell sizes are not equal.

23

Page 24: Epidemiology 9509 - Principles of Biostatistics …publish.uwo.ca/~jkoval/courses/Epid9509/chapter15/...Epidemiology9509 oneway(continued) Epidemiology 9509 Principles of Biostatistics

Epidemiology 9509 oneway (continued)

SAS output for unbalanced data III

Tukey’s Studentized Range (HSD) Test for difft

Means with the same letter

are not significantly different.

Tukey Grouping Mean N group

A 1.0000 4 3

A

B A 0.5000 5 2

B

B 0.0000 5 1

24

Page 25: Epidemiology 9509 - Principles of Biostatistics …publish.uwo.ca/~jkoval/courses/Epid9509/chapter15/...Epidemiology9509 oneway(continued) Epidemiology 9509 Principles of Biostatistics

Epidemiology 9509 oneway (continued)

SAS output for unbalanced data

Tukey’s Studentized Range (HSD) Test for difft

NOTE: This test controls the Type I experimentwise

error rate.

Alpha 0.05

Error Degrees of Freedom 11

Error Mean Square 0.2

Critical Value of Studentized Range 3.81952

25

Page 26: Epidemiology 9509 - Principles of Biostatistics …publish.uwo.ca/~jkoval/courses/Epid9509/chapter15/...Epidemiology9509 oneway(continued) Epidemiology 9509 Principles of Biostatistics

Epidemiology 9509 oneway (continued)

SAS output for unbalanced data IV

Comparisons significant at the 0.05 level

are indicated by ***.

Difference

group Between Simultaneous 95%

Comparison Means Confidence Limits

3 - 2 0.5000 -0.3102 1.3102

3 - 1 1.0000 0.1898 1.8102 ***

2 - 3 -0.5000 -1.3102 0.3102

2 - 1 0.5000 -0.2639 1.2639

1 - 3 -1.0000 -1.8102 -0.1898 ***

1 - 2 -0.5000 -1.2639 0.2639

26