Anda di halaman 1dari 68

Mata kuliah : A0392 - Statistik Ekonomi

Tahun : 2010

Pertemuan 12
Analisis Varians Satu Arah dan
Dua Arah

1
Outline Materi :

 Model tabel ANOVA klasifikasi satu arah


 ANOVA ulangan sama
 ANOVA ulangan tidak sama

2
Analisis Variansi

• Analisa variansi (ANOVA) adalah suatu metoda


untuk menguji hipotesis kesamaan rata-rata dari
tiga atau lebih populasi.
• Asumsi
 Sampel diambil secara random dan saling
bebas (independen)
 Populasi berdistribusi Normal
 Populasi mempunyai kesamaan variansi
• Hipotesis
H0 : 1 = 2 = … = k
H1 : paling sedikit dua tidak sama
3
3
Analisis Variansi

Sampel dari Populasi ke :


1 2 … i … k
x11 x21 … xi1 … Xk1
Total
x12 x22 … xi2 … Xk2
: : : : : :
x1n x2n … xin … xkn
Total T1 T2 … Ti … Tk T

Ti adalah total semua pengamatan dari populasi ke-i


T adalah total semua pengamatan dari semua populasi 4
4
Rumus Hitung Jumlah Kuadrat

Untuk Pengujian Hipotesis Di atas Perlu ditentukan


Jumlah Kuadrat Setiap Sumber Variasi

k n 2
T
Jumlah Kuadrat Total = JKT   x ij2  
i 1 j1 nk
k

 i
T 2
T 2

Jumlah Kuadrat Perlakuan = JKP  i 1  


n nk
Jumlah Kuadrat Galat = JKG  JKT  JKP
5
5
Tabel Anova dan Daerah
Penolakan

Sumber Derajat Jumlah Kuadrat


Statistik F
Variasi bebas kuadrat Rata-rata
KRP = F=
Perlakuan k–1 JKP
JKP/(k – 1 ) KRP/KRG
KRG =
Galat k(n-1) JKG
JKG/(k(n-1))
Total nk – 1 JKT

H0 ditolak jika F > F(; k – 1; k(n – 1))


6
6
Contoh 1

Sebagai manager
Mesin1 Mesin2 Mesin3
produksi, anda ingin
25.40 23.40 20.00
melihat mesin pengisi akan
26.31 21.80 22.20
dilihat rata-rata waktu
24.10 23.50 19.75
pengisiannya. Diperoleh
23.74 22.75 20.60
data seperti di samping.
25.10 21.60 20.40
Pada tingkat signifikansi
0.05 adakah perbedaan
rata-rata waktu ?

7
7
Penyelesaian

 Hipotesa :
H 0:  1 =  2 =  3
H1: Ada rata-rata yang tidak sama
 Tingkat signifikasi  = 0.05
 Karena df1= derajat bebas perlakuan = 2
dan df2 = derajat bebas galat = 12, maka
f(0.05;2;12) = 3.89.
Jadi daerah pelokannya:
H0 ditolak jika F > 3.89
8
8
Data

Populasi
1 2 3
25.40 23.40 20.00
26.31 21.80 22.20 Total
24.10 23.50 19.75
23.74 22.75 20.60
25.10 21.60 20.40
Total 124.65 113.05 102.95 340.65
9
9
Jumlah Kuadrat Total

k n 2
T
JKT   x ij2  
i 1 j1 nk
 25.40 2  26.312  24.10 2  23.74 2  25.10 2 
23.40 2  21.80 2  23.50 2  22.752  21.60 2 
20.00 2  22.20 2  19.752  20.60 2  20.40 2
340.652

5 3
 58.2172
10
10
Jumlah Kuadrat Perlakuan dan
Jumlah Kuadrat Galat
k

T 2
i
T 2
JKP  i 1
 
n nk
124.65  113.05  102.95 340.65
2 2 2 2
 
5 5 3
 47.1640
JKG  58.2172  47.1640  11.0532

11
11
Tabel Anova dan Kesimpulan

Sumber Derajat Jumlah Kuadrat Statistik


Variasi Bebas Kuadrat Rata-rata F

Perlakuan 3-1=2 47.1640 23.5820


F = 25.60
Galat 15-3=12 11.0532 0.9211

Total 15-1=14 58.2172

Karena Fhitung = 25.60 > 3.89 maka H0 ditolak.


Jadi ada rata-rata yang tidak sama.
12
12
Rumus Hitung Jumlah Kuadrat
Untuk ukuran sampel yang berbeda
k ni 2
T
Jumlah Kuadrat Total = JKT   x ij 2 

i 1 j1 N
k
Ti2 T2
Jumlah Kuadrat Perlakuan = JKP   
i 1 n i N
Jumlah Kuadrat Galat = JKG  JKT  JKP
k
dengan N   n i
i 1

13
13
Tabel Anova
Untuk ukuran sampel yang berbeda

Sumber Derajat Jumlah Kuadrat


Statistik F
Variasi bebas kuadrat Rata-rata
KRP = F=
Perlakuan k–1 JKP
JKP/(k – 1 ) KRP/KRG
KRG =
Galat N–k JKG
JKG/(N - k)
Total N–1 JKT

14
14
Contoh 2

• Dalam Sebuah percobaan biologi Konsentrasi


4 konsentrasi bahan kimia
digunakan untuk merangsang 1 2 3 4
pertumbuhan sejenis tanaman
tertentu selama periode waktu 8.2 7.7 6.9 6.8
tertentu. Data pertumbuhan 8.7 8.4 5.8 7.3
berikut, dalam sentimeter, dicatat
dari tanaman yang hidup. 9.4 8.6 7.2 6.3
• Apakah ada beda pertumbuhan
rata-rata yang nyata yang 9.2 8.1 6.8 6.9
disebabkan oleh keempat 8.0 7.4 7.1
konsentrasi bahan kimia tersebut.
• Gunakan signifikasi 0,05. 6.1
15
15
Penyelesaian

 Hipotesa :
H 0:  1 =  2 =  3=  4
H1: Ada rata-rata yang tidak sama
 Tingkat signifikasi  = 0.05
 Karena df1= derajat bebas perlakuan = 3
dan df2 = derajat bebas galat = 16, maka
f(0.05;3;16) = 3.24.
Jadi daerah pelokannya:
H0 ditolak jika F > 3.24
16
16
Data

Populasi
1 2 3 4
8.2 7.7 6.9 6.8
8.7 8.4 5.8 7.3
Total
9.4 8.6 7.2 6.3
9.2 8.1 6.8 6.9
8.0 7.4 7.1
6.1
Total 35.5 40.8 40.2 34.4 150.9
17
17
Jumlah Kuadrat Total

k ni 2
T
JKT   x ij2  
i 1 j1 N
 8.2 2  8.7 2  9.4 2  9.2 2  7.7 2  8.4 2  8.6 2
 8.12  8.0 2  6.9 2  5.82  7.2 2  6.82  7.4 2
2
150.9
 6. 1  6. 8  7 .3  6 .3  6 .9  7 .1 
2 2 2 2 2 2

20
 19.350

18
18
Jumlah Kuadrat Perlakuan dan
Jumlah Kuadrat Galat

k
Ti2 T2
JKP   
i 1 n i N
35.52 40.82 40.2 2 34.4 2 150.9 2
    
4 5 6 5 20
 15.462

JKG  19.350  15.462  3.888

19
19
Tabel Anova dan Kesimpulan

Sumber Derajat Jumlah Kuadrat Statistik


Variasi Bebas Kuadrat Rata-rata F

Perlakuan 4-1=3 15.462 5.154


F=
Galat 20-4=16 3.888 0.243 21.213

Total 20-1=19 19.350

Karena Fhitung = 21.213 > 3.24 maka H0 ditolak.


Jadi ada rata-rata yang tidak sama.
20
20
Latihan 1

Seorang kontraktor di bidang jenis


jasa pengangkutan ingin Kapasitas
mengetahui apakah terdapat Mitsubishi Toyota Honda
perbedaan yang signifikan pada (A) (B) (A)
kapasitas daya angkut 3 merk truk,
yaitu Mitsubishi, Toyota dan Honda. 44 42 46
Untuk itu kontraktor ini mengambil
sampel masing-masing 5 truk pada
43 45 47
tiap-tiap merek menghasilkan data
seperti disamping.
Jika ketiga populasi data tersebut 48 44 45
berdistribusi normal dan variansi
ketiganya sama, uji dengan 45 45 44
signifikasi 5% apakah terdapat
perbedaan pada kwalitas daya
46 44 43
angkut ketiga merek truk tersebut
21
21
Latihan 2

Seorang guru SMU mengadakan Metode


penelitian tentang keunggulan
metode mengajar dengan A B C D
beberapa metode pengajaran.
Bila data yang didapat seperti 70 68 76 67
pada tabel disamping, ujilah 76 75 87 66
dengan signifikasi 5% apakah
keempat metode mengajar 77 74 78 78
tersebut memiliki hasil yang
sama? (asumsikan keempat data 78 67 77 57
berdistribusi Normal dan
variasnisnya sama)
67 57 68
89
22
22
ANALISIS VARIANSI
DUA ARAH
(Randomized Block Design)

23
The ANOVA Procedure

• The ANOVA procedure for the randomized block


design requires us to partition the sum of squares
total (SST) into three groups: sum of squares due to
treatments, sum of squares due to blocks, and sum
of squares due to error.
• The formula for this partitioning is

SST = SSTR + SSBL + SSE

• The total degrees of freedom, nT - 1, are partitioned


such that k - 1 degrees of freedom go to treatments,
b - 1 go to blocks, and (k - 1)(b - 1) go to the error
term.
24
ANOVA Table for a
Randomized Block Design

Source of Sum of Degrees of Mean


Variation Squares Freedom Squares
F

SSTR MSTR
Treatments SSTR k-1 MSTR 
k - 1 MSE
SSBL
Blocks SSBL b-1 MSBL 
b-1

Error SSE (k - 1)(b - 1) SSE


MSE 
( k  1)(b  1)
Total SST nT - 1 25
Randomized Block Design
• Example: Crescent Oil Co.
Crescent Oil has developed three
new blends of gasoline and must
decide which blend or blends to
produce and distribute. A study
of the miles per gallon ratings of the
three blends is being conducted to determine if the
mean ratings are the same for the three blends.

26
Randomized Block Design

 Example: Crescent Oil Co.


Five automobiles have been
tested using each of the three
gasoline blends and the miles
per gallon ratings are shown on
the next slide.

27
Randomized Block Design

Type of Gasoline (Treatment)


Automobile Block
(Block) Blend X Blend Y Blend Z Means
1 31 30 30 30.333
2 30 29 29 29.333
3 29 29 28 28.667
4 33 31 29 31.000
5 26 25 26 25.667

Treatment
Means 29.8 28.8 28.4

28
Randomized Block Design
 Mean Square Due to Treatments
The overall sample mean is 29. Thus,
SSTR = 5[(29.8 - 29)2 + (28.8 - 29)2 + (28.4 - 29)2] = 5.2
MSTR = 5.2/(3 - 1) = 2.6
 Mean Square Due to Blocks
SSBL = 3[(30.333 - 29)2 + . . . + (25.667 - 29)2] = 51.33
MSBL = 51.33/(5 - 1) = 12.8
• Mean Square Due to Error
SSE = 62 - 5.2 - 51.33 = 5.47
MSE = 5.47/[(3 - 1)(5 - 1)] = .68

29
Randomized Block Design

 ANOVA Table

Source of Sum of Degrees of Mean


Variation Squares Freedom Squares F

Treatments 5.20 2 2.60 3.82


Blocks 51.33 4 12.80
Error 5.47 8 .68

Total 62.00 14

30
Randomized Block Design

• Rejection Rule
p-Value Approach: Reject H0 if p-value < .05
Critical Value Approach: Reject H0 if F > 4.46
For  = .05, F.05 = 4.46
(2 d.f. numerator and 8 d.f. denominator)

31
Randomized Block Design
 Test Statistic
F = MSTR/MSE = 2.6/.68 = 3.82
• Conclusion
The p-value is greater than .05 (where F = 4.46)
and less than .10 (where F = 3.11). (Excel provides
a p-value of .07). Therefore, we cannot reject H0.
There is insufficient evidence to conclude that
the miles per gallon ratings differ for the three
gasoline blends.

32
• Selamat Belajar Semoga Sukses.

33
Materi Tambahan :

34
Analysis of Variance

• The Completely Randomized Design:


One-Way Analysis of Variance
– ANOVA Assumptions
– F Test for Difference in c Means
– The Tukey-Kramer Procedure

35
General Experimental Setting

• Investigator Controls One or More


Independent Variables
– Called treatment variables or factors
– Each treatment factor contains two or more
groups (or levels)
• Observe Effects on Dependent Variable
– Response to groups (or levels) of independent
variable
• Experimental Design: The Plan Used to
Test Hypothesis
36
Completely Randomized
Design

• Experimental Units (Subjects) are


Assigned Randomly to Groups
– Subjects are assumed to be homogeneous
• Only One Factor or Independent Variable
– With 2 or more groups (or levels)
• Analyzed by One-Way Analysis of
Variance (ANOVA)

37
Randomized Design Example

Factor (Training Method)


Factor
Levels
(Groups)
Randomly
Assigned   
Units
21 hrs 17 hrs 31 hrs
Dependent
Variable 27 hrs 25 hrs 28 hrs
(Response) 29 hrs 20 hrs 22 hrs
38
One-Way Analysis of Variance
F Test
• Evaluate the Difference Among the Mean Responses of
2 or More (c ) Populations
– E.g., Several types of tires, oven temperature
settings
• Assumptions
– Samples are randomly and independently drawn
• This condition must be met
– Populations are normally distributed
• F Test is robust to moderate departure from
normality
– Populations have equal variances
• Less sensitive to this requirement when samples
are of equal size from each population
39
Why ANOVA?

• Could Compare the Means One by One using Z


or t Tests for Difference of Means
• Each Z or t Test Contains Type I Error
• The Total Type I Error with k Pairs of Means is
1- (1 - ) k
– E.g., If there are 5 means and use  = .05
• Must perform 10 comparisons
• Type I Error is 1 – (.95) 10 = .40
• 40% of the time you will reject the null
hypothesis of equal means in favor of the
alternative when the null is true!
40
Hypotheses of One-Way
ANOVA
• H 0 : 1  2   c
– All population means are equal
– No treatment effect (no variation in means
among groups)
• H1 : Not all i are the same
– At least one population mean is different
(others may be the same!)
– There is a treatment effect
– Does not mean that all population means are
different
41
One-Way ANOVA
(No Treatment Effect)

H 0 : 1  2   c
H1 : Not all i are the same
The Null
Hypothesis is
True

1   2  3
42
One-Way ANOVA
(Treatment Effect Present)

H 0 : 1  2   c
H1 : Not all i are the same The Null
Hypothesis is
NOT True

1   2  3 1  2  3
43
One-Way ANOVA
(Partition of Total Variation)

Total Variation SST

Variation Due to Variation Due to Random


= Group SSA + Sampling
Commonly SSW
referred to as:
Commonly referred to as:  Within Group Variation
 Among Group Variation  Sum of Squares Within
 Sum of Squares Among  Sum of Squares Error
 Sum of Squares Between  Sum of Squares
 Sum of Squares Model Unexplained
 Sum of Squares Explained
 Sum of Squares Treatment 44
Total Variation
c nj

SST   ( X ij  X ) 2

j 1 i 1

X ij : the i -th observation in group j


n j : the number of observations in group j
n : the total number of observations in all groups
c : the number of groups
c nj

 X
j 1 i 1
ij

X  the overall or grand mean


n
45
Total Variation
(continued)

  X   X 
2 2 2
SST  X 11  X 21 X nc c X
Response, X

Group 1 Group 2 Group 3


46
Among-Group Variation

c
SSA   n j ( X j  X ) 2
MSA 
SSA
j 1 c 1

X j : The sample mean of group j


X : The overall or grand mean

i  j Variation Due to Differences Among Groups


47
Among-Group Variation
(continued)

  n X   
2 2 2
SSA  n1 X 1  X 2 2 X  nc X c  X

Response, X

X3
X2
X
X1

Group 1 Group 2 Group 3 48


Within-Group Variation

c nj
SSW
SSW   ( X ij  X j ) 2
MSW 
j 1 i 1 nc
X j : The sample mean of group j
X ij : The i -th observation in group j

Summing the variation


within each group and then
adding over all groups
j 49
Within-Group Variation
(continued)

SSW   X 11  X 1    X 21  X 1    
2 2 2
 X nc c  X c

Response, X

X3
X2
X
X1

Group 1 Group 2 Group 3 50


Within-Group Variation
(continued)

SSW For c = 2, this is the


MSW  pooled-variance in the
nc t test.
(n1  1) S1  (n2  1) S2      (nc  1) Sc
2 2 2

(n1  1)  (n2  1)      (nc  1)
•If more than 2 groups,
use F Test.
•For 2 groups, use t test.
F Test more limited.

j 51
One-Way ANOVA
F Test Statistic
• Test Statistic
– F  MSA
MSW
• MSA is mean squares among
• MSW is mean squares within
• Degrees of Freedom
– df1  c 1
– df 2  n  c
52
One-Way ANOVA
Summary Table
Degrees
Source Mean
of Sum of F
of Squares
Freedo Squares Statistic
Variation (Variance)
m
Among MSA = MSA/MS
c–1 SSA
(Factor) SSA/(c – 1 ) W
Within MSW =
n–c SSW
(Error) SSW/(n – c )
SST =
Total n–1 SSA +
SSW
53
Features of One-Way ANOVA
F Statistic
• The F Statistic is the Ratio of the Among
Estimate of Variance and the Within
Estimate of Variance
– The ratio must always be positive
– df1 = c -1 will typically be small
– df2 = n - c will typically be large
• The Ratio Should Be Close to 1 if the Null
is True
54
Features of One-Way ANOVA
F Statistic
(continued)

• If the Null Hypothesis is False


– The numerator should be greater than the
denominator
– The ratio should be larger than 1

55
One-Way ANOVA F Test
Example

As production manager, Machine1 Machine2


you want to see if 3 filling Machine3
machines have different 25.40 23.40 20.00
mean filling times. You 26.31 21.80 22.20
assign 15 similarly trained 24.10 23.50 19.75
& experienced workers, 5 23.74 22.75 20.60
per machine, to the 25.10 21.60 20.40
machines. At the .05
significance level, is there
a difference in mean filling
times? 56
One-Way ANOVA Example:
Scatter Diagram
Machine1 Machine2 27
Machine3 •
26
25.40 23.40 20.00 ••
26.31 21.80 22.20 25 X1
24 •
24.10 23.50 19.75 • ••
23.74 22.75 20.60 23
• X2 •
X
25.10 21.60 20.40 22 ••
21
X 1  24.93 X 2  22.61 •• X3
20 ••
X 3  20.59 X  22.71 19

57
One-Way ANOVA Example
Computations

Machine1 Machine2 Machine3 X 1  24.93 nj  5


25.40 23.40 20.00
26.31 21.80 22.20 X 2  22.61 c3
24.10 23.50 19.75 X 3  20.59 n  15
23.74 22.75 20.60
25.10 21.60 20.40 X  22.71

SSA  5  24.93  22.71   22.61  22.71   20.59  22.71 


 2 2 2
 
 47.164
SSW  4.2592  3.112  3.682  11.0532
MSA  SSA /(c -1)  47.16 / 2  23.5820
MSW  SSW /( n - c)  11.0532 /12  .9211 58
Summary Table

Source Degree
Mean
of s of Sum of F
Squares
Variatio Freedo Squares Statistic
(Variance)
n m
MSA/MS
Among W
3-1=2 47.1640 23.5820
(Factor)
=25.60
Within 15-
11.0532 .9211
(Error) 3=12
15-
Total 58.2172
1=14
59
One-Way ANOVA Example
Solution

Test Statistic:
H0: 1 = 2 = 3
H1: Not All Equal MSA 23.5820
 = .05
F   25.6
MSW .9211
df1= 2 df2 = 12
Decision:
Critical Value(s): Reject at  = 0.05.
 = 0.05 Conclusion:
There is evidence that at
least one  i differs from
0 3.89 F the rest.
60
The Tukey-Kramer Procedure

• Tells which Population Means are Significantly


Different
– E.g., 1 = 2  3 f(X)
– 2 groups whose means
may be significantly
different
1= 2 3 X
• Post Hoc (A Posteriori) Procedure
– Done after rejection of equal means in ANOVA
• Pairwise Comparisons
– Compare absolute mean differences with
critical range
61
The Tukey-Kramer Procedure:
Example

1. Compute absolute mean


Machine1 Machine2 Machine3
25.40 23.40 20.00 differences:
X 1  X 2  24.93  22.61  2.32
26.31 21.80 22.20
24.10 23.50 19.75 X 1  X 3  24.93  20.59  4.34
23.74 22.75 20.60
25.10 21.60 20.40 X 2  X 3  22.61  20.59  2.02
2. Compute critical range:
MSW 1 1 
Critical Range  QU ( c,nc )     1.618
2  nj nj' 
3. All of the absolute mean differences are greater than the
critical range. There is a significant difference between
each pair of means at the 5% level of significance. 62
Levene’s Test for
Homogeneity of Variance

• The Null Hypothesis


– H 0 :  2
1   2
2    2
c

– The c population variances are all equal


• The Alternative Hypothesis
– H1 : Not all  j are equal ( j  1, 2, , c)
2

– Not all the c population variances are equal

63
Levene’s Test for
Homogeneity of Variance:
Procedure

1. For each observation in each group,


obtain the absolute value of the
difference between each observation and
the median of the group.
2. Perform a one-way analysis of variance
on these absolute differences.

64
Levene’s Test for
Homogeneity of Variances:
Example
As production manager, Machine1 Machine2
you want to see if 3 filling Machine3
machines have different 25.40 23.40 20.00
variance in filling times. 26.31 21.80 22.20
You assign 15 similarly 24.10 23.50 19.75
trained & experienced 23.74 22.75 20.60
workers, 5 per machine, to 25.10 21.60 20.40
the machines. At the .05
significance level, is there
a difference in the variance
in filling times? 65
Levene’s Test:
Absolute Difference from the
Median

Time abs(Time - median(Time))


Machine1 Machine2 Machine3 Machine1 Machine2 Machine3
25.4 23.4 20 0.3 0.65 0.4
26.31 21.8 22.2 1.21 0.95 1.8
24.1 23.5 19.75 1 0.75 0.65
23.74 22.75 20.6 1.36 0 0.2
25.1 21.6 20.4 0 1.15 0
median 25.1 22.75 20.4

66
Summary Table

SUMMARY
Groups Count Sum Average Variance
Machine1 5 3.87 0.774 0.35208
Machine2 5 3.5 0.7 0.19
Machine3 5 3.05 0.61 0.5005

ANOVA
Source of Variation SS df MS F P-value F crit
Between Groups 0.067453 2 0.033727 0.097048 0.908218 3.88529
Within Groups 4.17032 12 0.347527

Total 4.237773 14
67
Levene’s Test Example:
Solution


H0: 1
2
  2
2   2
3 Test Statistic:
H1: Not All Equal
MSA 0.0337
 = .05 F   0.0970
df1= 2 df2 = 12 MSW 0.3475
Decision:
Critical Value(s):
Do not reject at  = 0.05.
Conclusion:
 = 0.05
There is no evidence that
at least one  j differs
2

0 3.89 F from the rest. 68

Anda mungkin juga menyukai