Computational Formulas for ANOVA - University of …rmm2440/CompFormulasANOV… ·  ·...

2
PSYCHOLOGY 315 DR. MCFATTER Computational Formulas for ANOVA One-Way ANOVA Let a = # of levels of the independent variable = # of groups N = total # of observations in the experiment n 1 = # of observations in group 1, etc. H 0 : μ 1 = μ 2 = μ 3 = . . . = μ a ΑNOVA analyzes sample variances to draw inferences about population means. Sample variances can always be calculated as SS/df and these sample variances are called mean squares (MS): SS T = 9 2 + 8 2 + . . . + 1 2 + 5 2 - (80) 2 /15 = 93.333 SS B = (40 2 + 25 2 + 15 2 )/5 - 80 2 /15 = 63.333 SS W = 93.333 - 63.333 = 30.000 An alternative computational approach emphasizing the conceptual basis of ANOVA is given below. This is the variance of all scores in the experiment = 6.667. This is the average of the variances within the groups = 2.50. (1.22 2 + 1.87 2 + 1.58 2 )/3 = 2.50. This is n times the variance of the means = 5(6.333) = 31.667. Multiple Comparisons: t Crit is the critical value from a t-table using the df of the error term from the ANOVA table. The error term is always the denominator of the F-ratio. Thus, in the above example, the error df would be 12. The MS Error would be 2.50; n is always the number of observations each mean you’re comparing is based on. Example. X 1 X 2 X 3 Placebo Drug A Drug B 9 5 2 8 4 4 8 5 3 6 8 1 9 3 5 Sum 40 25 15 80 M 8 5 3 5.333 s 1.224745 1.870829 1.581139 ANOVA Summary Table Source SS df MS F p Between 63.333 2 31.667 12.67 0.0011 Within 30.000 12 2.500 Total 93.333 14 6.667 SS Total SS Between SS Within s SS df MS 2 = = ( ) SS X X N Total = - 2 2 ( ) ( ) ( ) ( ) SS X n X n X n X N Between a a = + + + - 1 2 1 2 2 2 2 2 K SS SS SS Within Total Between = - df a Between = - 1 df N a Within = - F MS MS Between Within = df N Total = - 1 ( ) $ σ T Total X X N N MS 2 2 2 1 = - - = $ σ W a Within s s s a MS 2 1 2 2 2 2 = + + + = K $ $ σ σ B M Between n MS 2 2 = = LSD t MS n Crit Error = 2

Transcript of Computational Formulas for ANOVA - University of …rmm2440/CompFormulasANOV… ·  ·...

Page 1: Computational Formulas for ANOVA - University of …rmm2440/CompFormulasANOV… ·  · 2008-07-21Computational Formulas for ANOVA One-Way ANOVA Let a = # of levels of the independent

PSYCHOLOGY 315 DR. MCFATTER

Computational Formulas for ANOVA One-Way ANOVA Let a = # of levels of the independent variable = # of groups N = total # of observations in the experiment n1 = # of observations in group 1, etc. H0: µ1 = µ2 = µ3 = . . . = µa ΑNOVA analyzes sample variances to draw inferences about population means. Sample variances can always be calculated as SS/df and these sample variances are called mean squares (MS):

SST = 92 + 82 + . . . + 12 + 52 - (80)2/15 = 93.333 SSB = (402 + 252 + 152)/5 - 802/15 = 63.333 SSW = 93.333 - 63.333 = 30.000

An alternative computational approach emphasizing the conceptual basis of ANOVA is given below. This is the variance of all scores in the experiment = 6.667. This is the average of the variances within the groups = 2.50. (1.222 + 1.872 + 1.582)/3 = 2.50. This is n times the variance of the means = 5(6.333) = 31.667. Multiple Comparisons: tCrit is the critical value from a t-table using the df of the error term

from the ANOVA table. The error term is always the denominator of the F-ratio. Thus, in the above example, the error df would be 12. The MSError would be 2.50; n is always the number of observations each mean you’re comparing is based on.

Example. X1 X2 X3 Placebo Drug A Drug B 9 5 2 8 4 4 8 5 3 6 8 1 9 3 5

Sum 40 25 15 80 M 8 5 3 5.333 s 1.224745 1.870829 1.581139

ANOVA Summary Table Source SS df MS F p Between 63.333 2 31.667 12.67 0.0011 Within 30.000 12 2.500 Total 93.333 14 6.667

SSTotal

SSBetween SSWithin

sSS

dfMS2

= =

( )SS X

X

NTotal = −∑∑ 2

2

( ) ( ) ( ) ( )SS

X

n

X

n

X

n

X

NBetween

a

a

= + + + −∑ ∑ ∑ ∑1

2

1

2

2

2

2 2

K

SS SS SSWithin Total Between= −

df aBetween = −1

df N aWithin = −FMS

MSBetween

Within

=

df NTotal = −1

( )$σ T Total

XX

NN

MS2

2

2

1=

−=

∑∑

$σWa

Within

s s s

aMS2 1

222 2

=+ + +

=K

$ $σ σB M Betweenn MS2 2= =

LSD tMS

nCritError=

2

Page 2: Computational Formulas for ANOVA - University of …rmm2440/CompFormulasANOV… ·  · 2008-07-21Computational Formulas for ANOVA One-Way ANOVA Let a = # of levels of the independent

PSYCHOLOGY 315 DR. MCFATTER Two-Way Factorial ANOVA

Let: a = # of levels of the independent variable A c = # of levels of the independent variable C ac = # of cells in the experiment N = total # of observations in the experiment n1 = # of observations in cell 1, etc.

SST = 537 - 932/18 = 56.50 SSB = 122/3 + 212/3 + . . . - 932/18 = 26.50 SSW = 56.50 - 26.50 = 30.00 SSA = 452/9 + 482/9 - 932/18 = 0.50 SSC = 302/6 + 332/6 + 302/6 - 932/18 = 1.00 SSA×C = 26.50 - 0.50 - 1.00 = 25.00

2 × 3 factorial design Crime (C) DV = Years Forgery Swindle Burglary

3 6 2 Attractive 4 7 4 5 8 6 4 3 4 Unattractive 6 4 6

Attractiveness of Offender

(A)

8 5 8

Table of Totals

Forgery Swindle Burglary Marginal Totals

Attractive 12 21 12 45

Unattractive 18 12 18 48 Marginal Totals 30 33 30 93 Table of Means

Forgery Swindle Burglary Marginal Means

Attractive 4 7 4 5

Unattractive 6 4 6 5.33 Marginal Means 5 5.5 5 5.17

ANOVA Summary Table Source SS df MS F p A 0.50 1 0.500 0.20 0.6627 C 1.00 2 0.500 0.20 0.8214 AC 25.00 2 12.500 5.00 0.0263 Within 30.00 12 2.500 Total 56.50 17 3.324

Null hypotheses:

A main effect H0: µA = µU

C main effect H0: µF = µS = µB

AC interaction H0: (µAF - µUF) = (µAS - µUS) = (µAB - µUB)

or equivalently H0: parallel lines in the cell mean plot

( )SS X

X

NTotal = −∑∑ 2

2

( ) ( ) ( ) ( )SS

X

n

X

n

X

n

X

NBetween

ac

ac

= + + + −∑ ∑ ∑ ∑1

2

1

2

2

2

2 2

K

SS SS SSWithin Total Between= −

( ) ( )SS

for each row

n for each row

X

NA = −∑ ∑∑

2 2

( ) ( )SS

for each column

n for each column

X

NC = −∑ ∑∑

2 2

SS SS SS SSAC Between A C= − −

2

3

4

5

6

7

8

Forgery Swindle BurglaryCrime (C)

Yea

rs

AttractiveUnattractive

2

3

45

6

7

8

Unattractive AttractiveAttractiveness (A)

Yea

rs

ForgerySwindleBurglary

df aA = −1

df cC = −1

df a cAC = − −( )( )1 1

df N acWithin = −

df NTotal = −1