Analysis of Variance (ANOVA)
description
Transcript of Analysis of Variance (ANOVA)
Analysis of Variance(ANOVA)
Penjelasan Umum• Seringkali kita ingin menguji apakah tiga atau lebih populasi
memiliki rata-rata yg sama. • Contoh:
Apakah bahan bakar/km yg digunakan untuk beberapa merek mobil sama?
Apakah pendapatan pekerja pada beberapa lapangan pekerjaan sama?
Atau apakah biaya produksi yg menggunakan beberapa proses yg berbeda adalah sama?
Penjelasan Umum• Kita dapat menggunakan cara seperti yg lalu untuk menguji
kesamaan rata-rata dua populasi, tetapi hal tersebut akan memakan waktu dan perhitungan yg lebih lama.Contoh: jika ada 5 pop, maka ada 5C2 cara/perhitungan yg harus dilakukan.
• Untuk itu kita dapat melakukan uji secara simultan /keseluruhan populasi tersebut dengan menggunakan distribusi F dan metoda yg disebut ANOVA (Analysis of Variance)
• Assumptions– Populations are normally distributed– Populations have equal variances– Samples are randomly and independently drawn
One-Way Analysis of Variance
Hipotesis untukOne-Way ANOVA
• – Seluruh rata-rata populasi adalah sama – Artinya: Tidak ada efek treatment (tidak ada keragaman rata-
rata dalam kelompok)
• – Minimal salah satu rata-rata populasi ada yang tidak sama– Artinya: Terdapat efek treatment (terdapat keragaman rata-
rata dalam kelompok)– Tidak berarti bahwa semua rata-rata populasi tidak sama
(beberapa pasang mungkin sama)
k3210 μμμμ:H
sama populasi rata-rata semuaTidak :AH
One-Factor ANOVA
All Means are the same:The Null Hypothesis is True
(No Treatment Effect)
k3210 μμμμ:H
same the are μ all Not:H iA
321 μμμ
One-Factor ANOVA
At least one mean is different:The Null Hypothesis is NOT true
(Treatment Effect is present)
k3210 μμμμ:H
same the are μ all Not:H iA
321 μμμ 321 μμμ
or
(continued)
Partitioning the Variation
Partitioning the Variation
• Total variation can be split into two parts:
SST = Total Sum of SquaresSSB = Sum of Squares BetweenSSW = Sum of Squares Within
SST = SSB + SSW
Partitioning the Variation
Total Variation = jumlah kuadrat total (SST), yang mengukur keragaman total dalam data
Within-Sample Variation = kergaman di dalam masing-masing kelompok populasi (SSW)
Between-Sample Variation = keragaman antar kelompok populasi (SSB)
SST = SSB + SSW
(continued)
Partition of Total Variation
Variation Due to Factor (SSB)
Variation Due to Random Sampling (SSW)
Total Variation (SST)
Commonly referred to as: Sum of Squares Within Sum of Squares Error Sum of Squares Unexplained Within Groups Variation
Commonly referred to as: Sum of Squares Between Sum of Squares Among Sum of Squares Explained Among Groups Variation
= +
Total Sum of Squares
k
i
n
jij
i
)xx(SST1 1
2
Dimana:
SST = Total sum of squares (Jumlah kuadrat total)k = jumlah populasi (kelompok, level atau
treatment)
ni = sample size dari populasi ke-i
xij = pengamatan ke-jth dari populasi ke-i
x = rata-rata total (rata-rata dari seluruh data)
SST = SSB + SSW
Total Variation(continued)
G rou p 1 G rou p 2 G rou p 3
Resp on se , X
X
2212
211 )xx(...)xx()xx(SST
kkn
Sum of Squares Between
Dimana:
SSB = Sum of squares betweenk = jumlah populasi (kelompok, level, atau
treatment)
ni = sample size dari populasi ke-i
xi = rata-rata sample dari populasi ke-i
x = rata-rata total (rata-rata dari seluruh data)
2
1
)xx(nSSB i
k
ii
SST = SSB + SSW
Between-Group Variation
Variation Due to Differences Among Groups
i j
2
1
)xx(nSSB i
k
ii
1
kSSBMSB
Mean Square Between = SSB/degrees of freedom
Between-Group Variation(continued)
G rou p 1 G rou p 2 G rou p 3
Resp on se , X
X1X 2X
3X
2222
211 )xx(n...)xx(n)xx(nSSB kk
Sum of Squares Within
Dimana:
SSW = Sum of squares withink = jumlah populasi (kelompok, level, atau
treatment)
ni = sample size dari populasi ke-i
xi = rata-rata sample dari populasi ke-i
xij = pengamatan ke-jth dari populasi ke-i
2
11
)xx(SSW iij
n
j
k
i
j
SST = SSB + SSW
Within-Group Variation
Summing the variation within each group and then adding over all groups
i
kNSSWMSW
Mean Square Within = SSW/degrees of freedom
2
11
)xx(SSW iij
n
j
k
i
j
Within-Group Variation(continued)
G rou p 1 G rou p 2 G rou p 3
Resp on se , X
1X2X
3X
22221
2111 )(...)()( kkn xxxxxxSSW
k
One-Way ANOVA Table
Source of Variation
dfSS MS
Between Samples SSB MSB =
Within Samples N - kSSW MSW =
Total N - 1SST =SSB+SSW
k - 1 MSBMSW
F ratio
k = jumlah populasi (kelompok, level, atau treatment)N = jumlah seluruh pengamatandf = derajat bebas
SSBk - 1SSWN - k
F =
One-Factor ANOVAF Test Statistic
• Test statistic
MSB is mean squares between variancesMSW is mean squares within variances
• Degrees of freedom– df1 = k – 1 (k = number of populations)– df2 = N – k (N = sum of sample sizes from all populations)
MSWMSBF
H0: μ1= μ2 = … = μ k
HA: At least two population means are different
• The F statistic is the ratio of the between estimate of variance and the within estimate of variance– The ratio must always be positive– df1 = k -1 will typically be small– df2 = N - k will typically be large
The ratio should be close to 1 if H0: μ1= μ2 = … = μk is true
The ratio will be larger than 1 if H0: μ1= μ2 = … = μk is false
Interpreting One-Factor ANOVA F Statistic
One-Factor ANOVA F Test Example
You want to see if three different golf clubs yield different distances. You randomly select five measurements from trials on an automated driving machine for each club. At the .05 significance level, is there a difference in mean distance?
Club 1 Club 2 Club 3254 234 200263 218 222241 235 197237 227 206251 216 204
••••
•
One-Factor ANOVA Example: Scatter Diagram
270
260
250
240
230
220
210
200
190
•••••
•••••
Distance
1X
2X
3X
X
227.0 x
205.8 x 226.0x 249.2x 321
Club 1 Club 2 Club 3254 234 200263 218 222241 235 197237 227 206251 216 204
Club1 2 3
One-Factor ANOVA Example Computations
Club 1 Club 2 Club 3254 234 200263 218 222241 235 197237 227 206251 216 204
x1 = 249.2
x2 = 226.0
x3 = 205.8
x = 227.0
n1 = 5
n2 = 5
n3 = 5
N = 15
k = 3
SSB = 5 [ (249.2 – 227)2 + (226 – 227)2 + (205.8 – 227)2 ] = 4716.4
SSW = (254 – 249.2)2 + (263 – 249.2)2 +…+ (204 – 205.8)2 = 1119.6
MSB = 4716.4 / (3-1) = 2358.2
MSW = 1119.6 / (15-3) = 93.325.275
93.32358.2F
F = 25.275
One-Factor ANOVA Example Solution
H0: μ1 = μ2 = μ3
HA: μi not all equal = .05df1= 2 df2 = 12
Test Statistic:
Decision:
Conclusion:Reject H0 at = 0.05
There is evidence that at least one μi differs from the rest0
= .05
F.05 = 3.885Reject H0Do not
reject H0
25.27593.3
2358.2MSWMSBF
Critical Value:
F = 3.885
Uji Wilayah Berganda• Dari hasil pengujian kesamaan rata-rata populasi dgn ANOVA,
jika keputusan adalah menolak Ho. Maka kita dapati kesimpulan bahwa tidak semua µ sama (paling sedikit ada dua yang tidak sama). Namun kita tidak tahu mana yang berbeda.
• Untuk mencari µ mana yang berbeda nyata→ UJI WILAYAH BERGANDA DUNCAN DAN UJI TUKEY
xμ 1 = μ 2 μ 3
Uji Duncan
Prosedur:1. Urutkan rata-rata sampel untuk masing-
masing populasi (kelompok) dari yang terkecil hingga terbesar
2. Hitung wilayah nyata terpendek dari berbagai rata-rata
Uji Duncan
3. Kriteria pengujianBandingkan selisih kedua rata-rata yang ingin dilihat perbedaannya dengan kriteria sbb: xi – xj ≤ Rp (Tidak berbeda nyata) xi – xj > Rp (Berbeda nyata)
Contoh: Uji Duncan
1. Urutkan rata-rata sampel:Club 1 Club 2 Club 3
254 234 200263 218 222241 235 197237 227 206251 216 204
2. Hitung wilayah nyata terpendek dari berbagai rata-rata:
205.8 226.0 249.2
p 2 3rp 3.082 3.225Rp 13.313 13.931
α = 0.05, df = 12
Contoh: Uji Duncan
3. Bandingkan selisih rata-rata dengan Rp:
(Beda nyata)
(Beda nyata)
(Beda nyata)
Uji Tukey-Kramer
Dimana:q = Nilai dari standardized range table dengan df = k
dan N - k MSW = Mean Square Within ni dan nj = Sample sizes dari populasi (kelompok) ke-i & ke-j
ji n1
n1
2MSWqRange Critical
Contoh: Uji Tukey-Kramer
1. Compute absolute mean differences:Club 1 Club 2 Club 3
254 234 200263 218 222241 235 197237 227 206251 216 204 20.2205.8226.0xx
43.4205.8249.2xx
23.2226.0249.2xx
32
31
21
2. Find the q value from the table Tukey with k and N - k degrees of freedom for the desired level of
3.77qα
Contoh: Uji Tukey-Kramer
5. All of the absolute mean differences are greater than critical range. Therefore there is a significant difference between each pair of means at 5% level of significance.
16.28551
51
293.33.77
n1
n1
2MSWqRange Critical
jiα
3. Compute Critical Range:
20.2xx
43.4xx
23.2xx
32
31
21
4. Compare: