# เอกสารประกอบการเรียน การวิเคราะห์ข้อมูลทางรัฐศาสตร์ บทที่ 5

• View
331

5

Embed Size (px)

Transcript

216 .

.

5

Analysis of Variance: ANOVA

1.

2

5

Z t 3 3 3 3. H0 : H1 : 1. H0 : 2 1

H1 : 3

=

=

2

2. H0 :

1

=

3

3 1

2

H1 :

1

3

2

3 H0 : 1

H1 : i

=

2 j

=

3

H0 i j

1 ; i

j ; i, j = 1, 2, 3

1. 3

1 1

2

4. i

2. 2

1

3

3

3.

2

1

216 .

.

3 3

H0

1 2 1 3 2 5

2

2.

3 / 1.

2. = +

H0 H1 1 2

216 .

.

H0

ANOVA Oneway ANOVA ,

(Analysis of Variance Table) 1

2 Two way ANOVA 3 3-way ANOVA

3. ( One- way ANOVA ) 1. ( ) 2. 3. 4.

(Interval scale)

3

216 .

.

hypothesis) (Alternative hypothesis) 1

H0 (Null

H : =0 1

2

H : i j )1 i j

H

1

: 1

= k

(

( The sum of square) 1. Total sum of squares (

ss

T

)

j =1

K

Xi =1

n

2

ij

T2 N

ss

T

= K j =1

X ij X i =1

nj

2

2. Between groups sum of squares (

ssK j= 1

Bj

) j

(n ) j =1j

K

T j2

T2 N

n ( XS W S

X

)2

3. Within group sum of squares (

)

4

216 .

.

j =1

K

T j2 X n j i =1 j =1 nj 2 ij K

K j =1

X ij X j i =1

nj

2

(Mean of squear : MS) df T = N 1 , df B = K 1 df F testW

SS T SS B SS

W

(df) = N K N

K

F test (SS B ) W

3

F (SS ) df = K 1 (degree of freedom for the numerator) df L = N K (degree of Source of veariation Between groups groups Total Within freedom for the denominator) F test

SS SS BW

df K1 N -K

MS SS B / K SS /N W

F MS B / MSW

SS

1 K

SS B + SS

N1 5

216 .

.

W

T Ti

= n =

n = j

K = i j

X = i jX j

XK j =1

= nj i =1

= j

X ij2 = 1 One-way ANOWA

4 1 5 6 2 11 8 3 6 9 6 4 3 4

4 4

216 .

.

7 3 7 9 2 4

7 7 9

8 5 4 4 7

1 1 4 5

1 % ( = .01)

1.

H : =0 1

2

2.

H

1

:

1 = .01

=

3

= 4

3. F 1 5 6 2 11 8 3 6 9 7 4 3 4

216 .

.

7 3 7 9 2 4 nj

7 7 9

8 5 4 4 7

1 1 4 5

8

5 SS B

7

6

1) Ti

;

T1

T2T3

= 6+9+8++7 = 43 ; = = = =( 43 ) 2

= 11+8+7++9 = 42 = 3+4+1++5 = 18

= 5+6+7++4 = 43

T4

T2j njT12 n1 T22 n2 T32 n3 T42 n4

( 42 )2

8

= 231.13 = 352.80 = 264.14 = 54.00 43+42+43+18 = = 26 = 146

5

( 43 ) 27

(18 ) 26

T

N

=

= =

8+5+7+6(146 ) 226

T2 N

819.85

8

216 .

.

SS B =

T 2 j n j =1 jK

=

T2 N

= =

[231.13+352.80+264.14+54] - 819.85 902.07-819.85 82.22

2)

SSnj i =1

W

X ij2 1 2 3 4K

5 2 + 6 2 + 7 2 + ... + 4 2 = 269 112 + 8 2 + 7 2 + ... + 9 2 = 364

6 2 + 9 2 + 8 2 + ... + 7 2 = 2873 2 + 4 2 + 12 + .... + 5 2 = 68nj

X ij2 = 269+364+287+68j =1

i =1

= 988 SSW

= X j =1i =1

K

nj

2 ij

- ( n ) j =1j

K

T j2

= 988-902.07SS T

SS T

=SS T

= 85.93 =

SS B + SS =

W

82.22+85.93 168.15

F Source of veariation SS df

MS

F

9

216 .

.

Between groups groups Total Within

82.22 85.93

22

3

27.41 3.91

7.01

168.15

25

4. F (F = 7.01 ) F F H0F.01 , 3, 22 = 4.8 2

5. .01 1

F >

H1

1

2

3 3 1 5 4 2 5 6 10 3 8 9

216 .

.

6 7 8 6 5 9 5

5 3 4 3 5 4 3 9 8 8

7 7 8 9 9 9 8 7

nxj

j

9

6.11x

5.25

12

8.10

10

6.42

1. :

: H 0 : 1 = 2 = 3

H 1 : i j ; i j

2. 3. F

( ) = .05

11

216 .

.

SSw = 6.11)2

2 X i X 1 + X i X 2 + ... + i =1 i =1

n1

2

n

2

Xi Xk i =1

nk

2

+

=

(5 - 6.11)

2

+ (4 2

6.11) + +(5 2 2

5.25) +2

(5 5.25)

+ (4 - 5.25)2

+ + (8 -

8.10)

(8 - 8.10) + (9 8.10) + (7 2

2

= = =

76.039

SSB =2

n ( Xj= 1 j

K

jX

)2 + 12(5.25

6.42) + 10(8.10 6.42)2

9(6.11 6.42 ) 45.509 = X i X i =1 2

2

SS T

N

2

= ( 5 6.42 ) SS T

+ ( 4 6.42 ) + ... + ( 8 6.42 ) + ( 7 6.42 )2 2

2

= 121.548 = =

= SS B + SS

W

45.509+79-6.039 121.548

M SB

M S

B

= =

SS B df B45 .509 2

12

216 .

.

df B = K 1 = 3 1 = 2

=

22 .755

M Sw

M S

w

= = =

SS W df W 76 .039 282.716

df W = N K = 31 3 = 28

F F = = =MS B MS W 22 .7 2.7168.379

SS 45.509 76.039 121.54 8 df 2 MS 22.755 2.716 F 8.379

28 30

13

216 .

.

4. F 3.34 H1 F >

F.05 , 2 , 28

F H0

=

5. .05 1

4. (Two- way ANOVA) k (k 3)

3 4 ( 1) 6

( 2) 2

1 k 2 b 1 k = 4 2 b = 6

14

216 .

.

,k; j = 1,,b 2 k x b 2 1 2 3 . . X11 X21 X31 . .

(Xij) i = 1,

1 X12 X22 X32 . . X13 X23 X33 . . X1k X2k X3k . .

B1 B2 B3 . .

X 1. X 2. X 3.

. .X b.

b T1

Xb1 T2X .1

Xb2 T3X .2

Xb3 TkX .3

XbkX .k

Bb T

X

Xij = i 2 j 1 ; i = 1,2,..b ; j = 1,2,..k 2 = Xiji =1 b

Tj = j 1 Bi = i 2

1 = Xij j= 1

k

15

216 .

.

X .j

= Tj / b = Xij / b i

X i.

= Bi /k =

Xij / kj

T = = Xij = Tj = Bi n = = kbX

3

/

= = T/kb = T/n

1 + 2 +

SST = SSTrt + SSB + SSE SSTrt = 1 SSE = SST = ( Xij)X

SSB = 2 )2

SSTrt = SS( 1) = SS( = b( X X

.j

SSB = SS( 2) = SS() SSE = SST - SSTrt - SSB = k( Xi.

)

2

-

X

)

2

(df) 3

16

216 .

.

2 + n-1 2 1 2 df k-1 (k-1)(b1) n-1 = kb-1 b-1 SS SSTrt MS=SS/df MSTrt MSE MSB

= 1 + = (k-1) + (b-1) + (k-1)(b-1) F MSTrt/ MSB / MSE MSE

SSB SSE

SST

ANOVA CM = (Xij)2 2

= T /n2

= Xij

- CM

SST = ( Xij -

X

)

2

i. = i 1 ; i = 1,2,..,k

17

216 .

.

.j

2 ; j = 1,2,..,j

= j

2 1 ()

H0 : = =

H0 :

.1

.2

.k

1 2 k 2 H1 : ().i

H1 : 1 ; i j ; i , j = 1,2,

.j

H0 : = =

H0 :

.1.

.2.

b.

2 2 b H1 : i.

H1 : 1 ; i j ; i , j = 1,2,

.j.

18

216 .

.

() ()

F = MSB / MSE

F = MSTrt / MSE

()

F df = k-1 (k-1)(b-1) F df = b-1 (k-1)(b-1)

H0 F = MSTrt / MSE > F

() H0 F = MSB / MSE > F

2 1. 2.

19

216 .

.

3 3

(A,B,C)

() 1 3 4 ( 2,000 CC)

1 2 3 4

A

B 19.7 19.0 20.3 19.0

C

20.2 18.7 19.7 17.9

18.3 18.5 17.9 21.1

3

95%

1 3 k = 3

12

n = kb = 3x4 = 12

2 4 b = 4

20

216 .

.

T1 = 20.2 + 18.7 + 19.7 + 17.9 = 76.5 T2 = 19.7 + 19.0 + 20.3 + 19.0 = 78.0 T3 = 18.3 + 18.5 + 17.9 + 21.1 = 75.8 + 19.0 + 18.5 = 56.2 + 19.0 + 21.1 = 58.02

B1 = 20.2 + 19.7 + 18.3 = 58.2

B2 = 18.7 B4 = 17.9

B3 = 19.7 + 20.3 + 17.9 = 57.9

T = Xij = T1 + T2 + T3 = 76.5 + 78.0 + 75.8 = 230.32

CM = T /n = (230.3) /12 = 53,038.09/12 = 4,419.8408 4,431.17 Xij = (20.2) + (18.7) + +(17.9) + (21.1)2 2 2 2 2 2

=

SST = Xij CM = 4,431.17 - 4,419.8408 = 11.32922 2 2 2

4,419.8408 = 0.63172

SSTrt = Tj /b CM = (76.5) /4 + (78.0) /4 + (75.8) /4 MSTrt = SSTrt/(k-1) = 0.6317/2 = 0.315852 2

(58) - 4,419.8408 = 0.8559

SSB = Bi /k CM = (58.2) /3 + (56.2) /3 + (57.9) +2 2

MSB = SSB/ b-1 = 0.8559/3 = 0.2853

9.8416

SSE = SST - SSTrt - SSB = 11.3292 - 0. 6317 - 0