Successfully reported this slideshow.

Head first statistics14

691 views

Published on

Head first statistics14

Published in: Technology
  • Be the first to comment

Head first statistics14

  1. 1. Head First Statistics Ch.14 ๐Œ 2(Chi) ๋ถ„ํฌ 2012. 6.30 chois7912๋…„ 6์›” 30์ผ ํ† ์š”์ผ
  2. 2. ์ด ์žฅ์—์„œ๋Š”... 13์žฅ ๊ฐ€์„ค ๊ฒ€์ฆ ์˜๊ฐ€์„ค์„ ๊ธฐ์ค€์œผ๋กœ ๊ฒ€์ • ์ง‘๋‹จ์˜ ํ†ต๊ณ„๊ฐ€ ์–ผ๋งˆ๋‚˜ ๋ฐœ์ƒํ•˜๊ธฐ ์–ด ๋ ค์šด ๊ฒฝ์šฐ์ธ์ง€๋ฅผ ํŒ๋‹จํ•˜์—ฌ ๊ฐ€์„ค์„ ๊ฒ€์ฆ ์ด ์žฅ์—์„œ๋Š” ๊ฒฐ๊ณผ๋ฅผ ๋ถ„์„ ๊ธฐ๋Œ€ํ•˜๋Š” ๊ฒƒ๊ณผ ์‹ค์ œ๋กœ ์ผ์–ด๋‚œ ์ผ์˜ ์ฐจ์ด๋ฅผ ๋ถ„์„ํ•˜์—ฌ ๋ฌด์—‡์ธ ๊ฐ€ ์ž˜๋ชป๋˜๊ณ  ์žˆ๋‹ค๋Š” ๊ฒƒ์„ ํŒ๋‹จ ๊ทธ๋Ÿผ ๋ฌด์—‡์ด ๋‹ค๋ฅธ๊ฐ€? 13์žฅ: ๊ธฐํ•˜ ๋ถ„ํฌ, ์ดํ•ญ ๋ถ„ํฌ, ํ‘ธ์•„์†ก ๋ถ„ํฌ๋ฅผ ๋”ฐ๋ฅผ ๋•Œ ๐Œ2 ๋ถ„ํฌ: ๋ถ„ํฌ์™€ ๊ด€๊ณ„ ์—†์ด ๊ฒฐ๊ณผ๋ฅผ ๊ฐ€์ง€๊ณ  ๊ฒ€์ฆ12๋…„ 6์›” 30์ผ ํ† ์š”์ผ
  3. 3. ๋šฑ๋ณด ๋Œ„์˜ ์นด์ง€๋…ธ ์Šฌ๋กฏ๋จธ์‹  ์Šฌ๋กฏ๋จธ์‹ ์˜ ํ™•๋ฅ  ๋ถ„ํฌ X (์ˆ˜์ž…) -2 23 48 73 98 P(X=x) 0.977 0.008 0.008 0.006 0.001 1000๋ฒˆ ์‹คํ–‰ํ•œ ํ›„ ์‹ค์ œ ๊ฒฐ๊ณผ X (์ˆ˜์ž…) -2 23 48 73 98 ๋„์ˆ˜ 965 10 9 9 712๋…„ 6์›” 30์ผ ํ† ์š”์ผ
  4. 4. ๋šฑ๋ณด ๋Œ„์˜ ์นด์ง€๋…ธ ์Šฌ๋กฏ๋จธ์‹  ๊ด€์ธก๋„์ˆ˜ vs ๊ธฐ๋Œ€๋„์ˆ˜ X P(X=x) ๊ด€์ธก ๋„์ˆ˜ ๊ธฐ๋Œ€ ๋„์ˆ˜ (P(x) * 1000) -2 0.977 965 977 23 0.008 10 8 48 0.008 9 8 73 0.006 9 6 98 0.001 7 112๋…„ 6์›” 30์ผ ํ† ์š”์ผ
  5. 5. ๐Œ 2 ๊ฒ€์‚ฌ ๊ธฐ๋Œ€๋˜๋Š” ๊ฒƒ๊ณผ ์‹ค์ œ๋กœ ์–ป๊ฒŒ ๋˜๋Š” ๊ฒƒ ์‚ฌ์ด์— ์กด์žฌํ•˜๋Š” ์ฐจ ์ด๋ฅผ ํ‰๊ฐ€ ๐Œ2 = ๐›ด (O - E)2 / E O: ๊ด€์ธก ๋„์ˆ˜ E: ๊ธฐ๋Œ€ ๋„์ˆ˜ ๋šฑ๋ณด ๋Œ„์˜ ์นด์ง€๋…ธ - ๐Œ2 ๐Œ2 = (965-977)2/977 + (10-8)2/8 + (9-8)2/8 + (9-6)2/6 + (7-1)2/1 = 38.27212๋…„ 6์›” 30์ผ ํ† ์š”์ผ
  6. 6. ๐Œ 2 ๋ถ„ํฌ 2๊ฐ€์ง€ ์ฃผ์š”ํ•œ ์šฉ๋ก€ ์ ํ•ฉ๋„ ์–ด๋–ค ๋ฐ์ดํ„ฐ์˜ ์ง‘ํ•ฉ์ด ์–ด๋–ค ๋ถ„ํฌ์— ์–ผ๋งˆ๋‚˜ ์ž˜ ๋งž๋Š”์ง€ ๊ฒ€์‚ฌ ๋…๋ฆฝ์„ฑ ๋‘ ๋ณ€์ˆ˜์˜ ๋…๋ฆฝ์„ฑ์„ ๊ฒ€์‚ฌํ•˜๋Š”๋ฐ ์‚ฌ์šฉ ๐Œ2 ๋ถ„ํฌ X2 ~๐Œ2 (ฮฝ): ์ž์œ ๋„ ฮฝ๋ฅผ ๊ฐ–๋Š” ๊ฒ€์ • ํ†ต๊ณ„ X2๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค๋Š” ์˜๋ฏธ ฮฝ(nu): ์ž์œ ๋„12๋…„ 6์›” 30์ผ ํ† ์š”์ผ
  7. 7. ์ž์œ ๋„ ฮฝ ฮฝ์— ๋”ฐ๋ฅธ ๐Œ2์˜ ๋ถ„ํฌ ๊ทธ๋ฆผ์—์„œ k๋Š” ฮฝ๋ฅผ ์˜๋ฏธ ๊ทธ๋ฆผ ์ถœ์ฒ˜: http://en.wikipedia.org/wiki/Chi-squared_distribution ์ž์œ ๋„ ฮฝ์˜ ์˜๋ฏธ ๋ถ€๊ณผ๋œ ์ œ์•ฝ ์‚ฌํ•ญ์„ ๊ณ ๋ คํ•˜๋ฉด์„œ ์šฐ๋ฆฌ๊ฐ€ ๊ณ„์‚ฐํ•ด์•ผ๋งŒ ํ•˜๋Š” ๊ธฐ๋Œ€ ๋„์ˆ˜์˜ ์ˆ˜ ฮฝ = (ํด๋ž˜์Šค์˜ ์ˆ˜) - (์ œ์•ฝ์˜ ์ˆ˜) Ex) X (์ˆ˜์ž…) -2 23 48 73 98 ๋„์ˆ˜ 977 8 8 6 1 ฮฝ=5-1=412๋…„ 6์›” 30์ผ ํ† ์š”์ผ
  8. 8. ๐Œ 2์˜ ์œ ์˜์„ฑ์ด๋ž€? ๊ด€์ธก๋„์ˆ˜์™€ ๊ธฐ๋Œ€๋„์ˆ˜ ์‚ฌ์ด์— ์กด์žฌํ•˜๋Š” ์ฐจ์ด๊ฐ€ ์–ผ๋งˆ๋‚˜ ์œ ์˜ํ•œ์ง€๋ฅผ ์˜๋ฏธ ๊ธฐ๊ฐ์—ญ์€ ์ƒ์œ„ ๊ผฌ๋ฆฌ์˜ ๋‹จ์ธก ๊ฒ€์ฆ์„ ์‚ฌ์šฉ ์œ ์˜์ˆ˜์ค€ ษ‘๋ฅผ ์ด์šฉํ•ด์„œ ๐Œ2 ๊ฒ€์ •์„ ์ˆ˜ํ–‰ P(๐Œ2ษ‘(ฮฝ) โ‰ฅ x) = ษ‘ ๊ทธ๋ฆผ ์ถœ์ฒ˜: http://www.medcalc.org/manual/chi-square-table.php ๐Œ2 ํ™•๋ฅ  ํ…Œ์ด๋ธ”์„ ์‚ฌ์šฉํ•˜์—ฌ ๊ธฐ๊ฐ์—ญ์„ ๊ตฌํ•จ Ex) ์ž์œ ๋„ 4์— ๋Œ€ํ•œ ์œ ์˜์ˆ˜์ค€ 25%๋ฅผ ๊ตฌํ•จ12๋…„ 6์›” 30์ผ ํ† ์š”์ผ
  9. 9. ๐Œ2์„ ์ด์šฉํ•œ ๊ฐ€์„ค ๊ฒ€์ • ๊ฐ€์„ค ๊ฒ€์ • ๋‹จ๊ณ„ ๊ฒ€์ •์„ ์ˆ˜ํ–‰ํ•  ๊ฐ€์„ค๊ณผ ๋Œ€๋ฆฝ ๊ฐ€์„ค์„ ์„ค์ • ๊ธฐ๋Œ€ ๋„์ˆ˜์™€ ์ž์œ ๋„๋ฅผ ๊ณ„์‚ฐ ๊ฒฐ์ •์„ ๋‚ด๋ฆฌ๋Š” ๋ฐ ์‚ฌ์šฉํ•  ๊ธฐ๊ฐ์—ญ ์„ค์ • ๊ฒ€์ • ํ†ต๊ณ„ ๐Œ2์„ ๊ณ„์‚ฐ ๊ฒ€์ • ํ†ต๊ณ„๊ฐ€ ๊ธฐ๊ฐ์—ญ ์•ˆ์— ์žˆ๋Š”์ง€ ์—ฌ๋ถ€๋ฅผ ํ™•์ธ ๊ฒฐ์ •12๋…„ 6์›” 30์ผ ํ† ์š”์ผ
  10. 10. ๐Œ2์„ ์ด์šฉํ•œ ๊ฐ€์„ค ๊ฒ€์ •: ์ ํ•ฉ๋„ ๊ฒ€์ • (Ex: ๋Œ„์˜ ์Šฌ๋กฏ๋จธ์‹ ) ์œ ์˜ ์ˆ˜์ค€ 5% ์˜๊ฐ€์„ค ์„ค์ • H0: ์Šฌ๋กฏ๋จธ์‹ ์—์„œ ๊ธˆ์•ก์„ ๋”ธ ํ™•๋ฅ ์€ ์•„๋ž˜์™€ ๊ฐ™์€ ํ™•๋ฅ  ๋ถ„ํฌ๋ฅผ ๋”ฐ๋ฆ„ X (์ˆ˜์ž…) -2 23 48 73 98 P(X=x) 0.977 0.008 0.008 0.006 0.001 ๊ธฐ๋Œ€ ๋„์ˆ˜์™€ ์ž์œ ๋„ ๊ณ„์‚ฐ ๋ฐ 5% ์ˆ˜์ค€์˜ ๊ธฐ๊ฐ์—ญ ์„ค์ • ์ž์œ ๋„: 5 - 1 = 4 ๊ธฐ๊ฐ์—ญ ์˜์—ญ: ๐Œ25%(4) = 9.49 ๊ฒ€์ • ํ†ต๊ณ„ ๊ณ„์‚ฐ ๋ฐ ๊ธฐ๊ฐ์—ญ ๊ฒ€์ฆ ๐Œ2 = ๐›ด (O - E)2 / E = 38.272 > 9.49 ๊ฒฐ๋ก  ๊ธฐ๊ฐ์—ญ ์•ˆ์— ์กด์žฌํ•˜๋ฏ€๋กœ, ํ•ด๋‹น ์Šฌ๋กฏ ๋จธ์‹ ์€ ์œ„์™€ ๊ฐ™์€ ํ™•๋ฅ  ๋ถ„ํฌ๋ฅผ ๋”ฐ๋ฅด์ง€ ์•Š์Œ12๋…„ 6์›” 30์ผ ํ† ์š”์ผ
  11. 11. ๐Œ 2 ์ ํ•ฉ๋„ ๊ฒ€์ • ๋Œ€๋ถ€๋ถ„์˜ ํ™•๋ฅ  ํ†ต๊ณ„์—์„œ ์‚ฌ์šฉ ๊ฐ€๋Šฅ ์‹ค์ œ ๊ด€์ธก์„ ๊ธฐ์ค€์œผ๋กœ ํ•จ ๐Œ2 ๋ฅผ ์œ„ํ•œ ์ž์œ ๋„ ์„ค์ • ๋ถ„ํฌ ์กฐ๊ฑด ฮฝ(์ž์œ ๋„) P๋ฅผ ์•Œ๊ณ  ์žˆ์„ ๊ฒฝ์šฐ n-1 ์ดํ•ญ P์˜ ๊ฐ’์„ ๋ชจ๋ฅด๊ณ  ์žˆ์„ ๊ฒฝ์šฐ n-2 ๐œ†์˜ ๊ฐ’์„ ์•Œ๊ณ  ์žˆ์„ ๊ฒฝ์šฐ n-1 ํ‘ธ์•„์†ก ๐œ†์˜ ๊ฐ’์„ ๋ชจ๋ฅด๊ณ  ์žˆ์„ ๊ฒฝ์šฐ n-2 ํ‰๊ท ๊ณผ ๋ถ„์‚ฐ์„ ์•Œ๊ณ  ์žˆ์„ ๊ฒฝ์šฐ n-1 ์ •๊ทœ ํ‰๊ท ๊ณผ ๋ถ„์‚ฐ์„ ๋ชจ๋ฅด๊ณ  ์žˆ์„ ๊ฒฝ์šฐ n-312๋…„ 6์›” 30์ผ ํ† ์š”์ผ
  12. 12. ๐Œ2์„ ์ด์šฉํ•œ ๋…๋ฆฝ์„ฑ ๊ฒ€์ • ์–ด๋Š ๋‘ ์š”์†Œ๊ฐ€ ์„œ๋กœ ๋…๋ฆฝ์ธ์ง€๋ฅผ ๊ฒ€์ • ๋…๋ฆฝ์„ฑ ๊ฒ€์ • ๋‹จ๊ณ„ ๊ฒ€์ •์„ ์ˆ˜ํ–‰ํ•  ๊ฐ€์„ค๊ณผ ๋Œ€๋ฆฝ ๊ฐ€์„ค์„ ์„ค์ • ๊ธฐ๋Œ€ ๋„์ˆ˜์™€ ์ž์œ ๋„๋ฅผ ๊ณ„์‚ฐ ๋‹จ, ์„œ๋กœ ๋…๋ฆฝ์ด๋ผ๋Š” ๊ฐ€์„ค์— ๊ทผ๊ฑฐํ•˜์—ฌ ๊ธฐ๋Œ€ ๋„์ˆ˜๋ฅผ ๊ณ„์‚ฐ ๊ฒฐ์ •์„ ๋‚ด๋ฆฌ๋Š” ๋ฐ ์‚ฌ์šฉํ•  ๊ธฐ๊ฐ์—ญ ์„ค์ • ๊ฒ€์ • ํ†ต๊ณ„ ๐Œ2์„ ๊ณ„์‚ฐ ๊ฒ€์ • ํ†ต๊ณ„๊ฐ€ ๊ธฐ๊ฐ์—ญ ์•ˆ์— ์žˆ๋Š”์ง€ ์—ฌ๋ถ€๋ฅผ ํ™•์ธ ๊ฒฐ์ •12๋…„ 6์›” 30์ผ ํ† ์š”์ผ
  13. 13. ๋šฑ๋ณด ๋Œ„์˜ ์นด์ง€๋…ธ ๋ธ”๋ž™์žญ - ์ฟ ๋ฅดํ”ผ์—(1/3) ์ฟ ๋ฅดํ”ผ์— ํ•œ ์‚ฌ๋žŒ์ด ์‹ค์ œ๋ณด๋‹ค ๋งŽ์€ ๋ˆ์„ ์žƒ๊ณ  ์žˆ๋Š”๊ฐ€? ๊ฐ ์ฟ ํ”„ํ”ผ์—์— ๋Œ€ํ•œ ๊ด€์ธก ๊ฒฐ๊ณผ ์ฟ ๋ฅดํ”ผ์— A ์ฟ ๋ฅดํ”ผ์— B ์ฟ ๋ฅดํ”ผ์— C ์Šน๋ฆฌ 43 49 22 ๋ฌด์Šน๋ถ€ 8 2 5 ํŒจ๋ฐฐ 47 44 30 ๋งŒ์•ฝ ์ฟ ๋ฅดํ”ผ์—๊ฐ€ ๊ฒฐ๊ณผ์™€ ์„œ๋กœ ๊ด€๋ จ์ด ์—†์„ ๊ฒฝ์šฐ P(์Šน๋ฆฌ) = ์Šน๋ฆฌ์ดํ•ฉ/์ „์ฒด์ดํ•ฉ <= ์Šน๋ฆฌํ•œ ๋น„์œจ P(A) = A์ดํ•ฉ/์ „์ฒด์ดํ•ฉ <= A๊ฐ€ ๊ฒŒ์ž„ํ•œ ๋น„์œจ ์ฆ‰, ์œ„์˜ 2 ํ™•๋ฅ ์ด ์„œ๋กœ ๋…๋ฆฝ์  P(A๊ฐ€ ์ด๊ธฐ๋Š” ๋น„์œจ) = P(์Šน๋ฆฌ) * P(A) = ์Šน๋ฆฌ์ดํ•ฉ/์ „์ฒด์ดํ•ฉ * A์ดํ•ฉ/์ „์ฒด์ดํ•ฉ ๊ธฐ๋Œ€ ๋„์ˆ˜ = ์ „์ฒด ์ดํ•ฉ * P(A๊ฐ€ ์ด๊ธฐ๋Š” ๋น„์œจ) = ์Šน๋ฆฌ์ดํ•ฉ * A์ดํ•ฉ / ์ „์ฒด์ดํ•ฉ12๋…„ 6์›” 30์ผ ํ† ์š”์ผ
  14. 14. ๋šฑ๋ณด ๋Œ„์˜ ์นด์ง€๋…ธ ๋ธ”๋ž™์žญ - ์ฟ ๋ฅดํ”ผ์—(2/3) ๊ด€์ธก ๊ฒฐ๊ณผ ์ฟ ๋ฅดํ”ผ์— A ์ฟ ๋ฅดํ”ผ์— B ์ฟ ๋ฅดํ”ผ์— C ์ด๊ณ„ ์Šน๋ฆฌ 43 49 22 114 ๋ฌด์Šน๋ถ€ 8 2 5 15 ํŒจ๋ฐฐ 47 44 30 121 ์ด๊ณ„ 98 95 57 250 ๊ธฐ๋Œ€ ๋„์ˆ˜ ์ฟ ๋ฅดํ”ผ์— A ์ฟ ๋ฅดํ”ผ์— B ์ฟ ๋ฅดํ”ผ์— C ์Šน๋ฆฌ 114*98/250 = 44.688 114*95/250 = 43.32 114*57/250 = 25.992 ๋ฌด์Šน๋ถ€ 15*98/250 = 5.88 15*95/250 = 5.7 15*57/250 = 3.42 ํŒจ๋ฐฐ 121*98/250 = 47.432 121*95/250 = 45.98 121*57/250 = 27.588 ๐Œ2 = ๐›ด (O - E)2 / E = 5.00412๋…„ 6์›” 30์ผ ํ† ์š”์ผ
  15. 15. ๋šฑ๋ณด ๋Œ„์˜ ์นด์ง€๋…ธ ๋ธ”๋ž™์žญ - ์ฟ ๋ฅดํ”ผ์—(3/3) ์ž์œ ๋„ ๊ณ„์‚ฐ ์ฟ ๋ฅดํ”ผ์— A ์ฟ ๋ฅดํ”ผ์— B ์ฟ ๋ฅดํ”ผ์— C ์Šน๋ฆฌ ๋ฌด์Šน๋ถ€ ํŒจ๋ฐฐ ฮฝ = (ํด๋ž˜์Šค์˜ ์ˆ˜) - (์ œ์•ฝ์˜ ์ˆ˜) = 9 - 5 = 4 1%์˜ ์œ ์˜ ์ˆ˜์ค€์—์„œ ๋…๋ฆฝ์—ฌ๋ถ€ ํ™•์ธ ๊ธฐ๊ฐ์—ญ ์˜์—ญ: ๐Œ21%(4) = 13.28 > 5.00 ๊ฒฐ์ • ๐Œ2์ด ๊ธฐ๊ฐ์—ญ์˜ ๋ฐ–์— ์žˆ์œผ๋ฏ€๋กœ ์„œ๋กœ ์˜๊ฐ€์„ค์„ ๋ฐ›์•„ ๋“ค์ž„12๋…„ 6์›” 30์ผ ํ† ์š”์ผ
  16. 16. ์ž์œ ๋„ ์ผ๋ฐ˜ํ™” ฮฝ=k-1 ์—ด1 ... ์—ด k-1 ์—ดk ํ–‰1 ฮฝ=h-1 ฮฝ = (h - 1) * (k - 1) ์—ด1 ์—ด1 ... ์—ด k-1 ์—ดk ํ–‰1 ํ–‰1 ... ... ํ–‰ h-1 ํ–‰ h-1 ํ–‰ h-1 ํ–‰h12๋…„ 6์›” 30์ผ ํ† ์š”์ผ
  17. 17. ๐Œ 2 ๋ถ„ํฌ 2๊ฐ€์ง€ ์ฃผ์š”ํ•œ ์šฉ๋ก€ ์ ํ•ฉ๋„ ์–ด๋–ค ๋ฐ์ดํ„ฐ์˜ ์ง‘ํ•ฉ์ด ์–ด๋–ค ๋ถ„ํฌ์— ์–ผ๋งˆ๋‚˜ ์ž˜ ๋งž๋Š”์ง€ ๊ฒ€์‚ฌ ๋…๋ฆฝ์„ฑ ๋‘ ๋ณ€์ˆ˜์˜ ๋…๋ฆฝ์„ฑ์„ ๊ฒ€์‚ฌํ•˜๋Š”๋ฐ ์‚ฌ์šฉ ๐Œ2 = ๐›ด (O - E)2 / E ๐Œ2 ์˜ ๋ถ„ํฌ ์ž์œ ๋„(ฮฝ)์™€ ๋ฐ€์ ‘ํ•œ ๊ด€๋ จ์ด ์žˆ์Œ ์ž์œ ๋„(ฮฝ) = (h - 1) * (k - 1)12๋…„ 6์›” 30์ผ ํ† ์š”์ผ

ร—