๐จ๐พ๐ฌ sample data ์๊ฐ ์ปค์ง์๋ก, sample์ ํต๊ณ์น๋ ์ ์ ๋ชจ์ง๋จ์ ๋ชจ์์ ๊ฐ์์ง๋ค๋ ๋ป!
โ ๊ตฌ์ฒด์ ์ด๊ฒ ๋งํ๋ฉด 'the mean of your sample is going to converge to the true mean of the population or to the expected value of the random variable'
๐จ๐พ๐ฌ ์ผ๋ฐ์ ์ผ๋ก sample์ ์๊ฐ 30๊ฐ ์ด์์ด๋ฉด ํฐ ์์ ๋ฒ์น์ด ์ ์ฉ๋๋ค๊ณ ํ๋ค
๐จ๐พ๐ฌ ๋๋ฌด๋ ๋น์ฐํ ๋ด์ฉ์ด๋ฏ๋ก..! ๋น ๋ฅด๊ฒ ํ๊ณ ๋์ด๊ฐ์ ๐ง๐พ
concepts
- wikipedia -
'In probability theory, the law of large numbers (LLN) is a theorem that describes the result of performing the same experiment a large number of times. According to the law, the average of the results obtained from a large number of trials should be close to the expected value and tends to become closer to the expected value as more trials are performed.'
๐จ๐พ๐ฌ ์๋ฐํ ๋งํ๋ฉด sample์ ํ๊ท ์ด sample ๊ฐฏ์๊ฐ ์ปค์ง์๋ก, ๋ฌดํํ ๊ฐ์๋ก ์ ์ฒด ๊ธฐ๋๊ฐ(๋ชจ์)์ ๊ฐ๊น์์ง๋ค๋ ๋ป์ด๋ค (ํ๊ท ํ์ )
๐จ๐พ๐ฌ stable long-term results๋ฅผ ๋ณด์ฅํด์ฃผ๋ law์ด๊ธฐ์ ์ค์ํ๊ฒ ์ฐ์ (ํนํ randomํ๊ฒ ๋ฐ์ํ๋ event์ ๊ด๋ จํ ๋)
๐จ๐พ๐ฌ ๋น์ฐํ ๋ง์ ๊ด์ธก์น๋ค(์๋๋ค)์ด ๋ณด์ฅ๋์ด์ผ ํจ
๐จ๐พ๐ฌ ์ด ๋, gambler's fallacy(Monte Carlo fallacy) ใํน์ event์ ๊ณผ๊ฑฐ๋น๋๊ฐ ๋์๋ค๋ฉด ๋ฏธ๋์๋ ๋๊ฒ ๋ฐ์ํ๊ฑฐ๋, ๊ฑฐ๊พธ๋ก ํจ์ฌ ์ ๊ฒ ๋ฐ์ํ๋ค๊ณ ์์ธกํ๋ fallacyใ์ ์ํด ๊ณผ๊ฑฐ ์ฌ๊ฑด์ ์ํฅ์ ๋ฐ์ ์์ธก๋๋ค๊ณ ์๊ฐํด์๋ ์๋๋ค. LLN์ ๋งค event๋ผ๋ฆฌ ์๋ก ์ํฅ์ ์๋ฐ๊ณ ๋
๋ฆฝ์ ์ผ๋ก, ๋งค ๊ฒฐ๊ณผ๋ ์์ธก๋ถ๊ฐ๋ก randomํ๊ฒ ๋์จ๋ค๊ณ ๊ฐ์
๐จ๐พ๐ฌ Weak LLN vs. Strong LLN?
→ WLLN์ ๋ฌดํ๋์ the number of sample์ด ์กด์ฌํ ๊ฒฝ์ฐ ๋ชจํ๊ท ๊ณผ sample mean์ ์ฐจ์ด๊ฐ ๊ทธ ์ด๋ค ์์ ε๋ณด๋ค๋ ์์ ๊ฒฝ์ฐ๊ฐ ๋ฐ๋์(์๋ Pr์ด 1์ด ๋๋ค๊ณ ์ ์๋จ) ์กด์ฌํ๋ค๋ ๋ป
→ SLLN์ ๋ฌดํ๋์ the number of sample์ด ์กด์ฌํ๋ค๋ฉด sample mean์ ๋ฌด์กฐ๊ฑด ๋ชจํ๊ท ์ด ๋๋ค๋ ๋ป
→ ๊ทธ๋์ WLLN์ด ์ข ๋ ์ฝํ๊ฒ ๋ชจํ๊ท ์ ๋ํํ๋ค๊ณ ์ฃผ์ฅํ๋ค๊ณ ๋งํ ์ ์๋ค!
- (์ผ์ชฝ๋ถํฐ) LLN Form - WLLN - SLLN -
w/code
โ ํ๊ท ์ด 50์ด๊ณ ํ์คํธ์ฐจ๊ฐ 10์ธ 2๋ง๊ฐ์ sample์ด ๋ฐ๋ฅด๋ ์ ๊ท๋ถํฌ๋ฅผ ๋ชจ์ง๋จ์ผ๋ก ๊ฐ์
population = np.random.normal(50, 10, 20000) #mean 50, std 10, 1000 samples normal distribution
population.mean()
#50.03223541665855
โก sample size๋ฅผ 5 ๊ฐ๊ฒฉ์ผ๋ก 5์์ 19995๊น์ง ๋๋ฆฌ๋ฉด์ sample์ mean์ ์ธก์ & ์๊ฐํ
dat = []
for i in np.arange(start = 5, stop = 19995, step = 5) :
s = np.random.choice(population, i)
dat.append(s.mean())
dat
#method chaining ์ฌ์ฉ - ๋ฉ์๋๊ฐ ๊ฐ์ฒด๋ฅผ ๋ฐํํ๊ฒ ๋๋ฉด, ๋ฉ์๋์ ๋ฐํ ๊ฐ์ธ ๊ฐ์ฒด๋ฅผ ํตํด ๋ ๋ค๋ฅธ ํจ์๋ฅผ ํธ์ถ
(pd
.DataFrame(dat)
.plot(figsize=(7,7))
.axhline(y = 50, color = '#F80909')
);
โข ์๊ฐํ ๊ฒฐ๊ณผ> ์ฐ๋ฆฌ๋ sample mean์ด ์ ์ฒด ๋ชจํ๊ท ์ธ 50์ ํฅํด ์ ์ convergeํจ์ ๊ทธ๋ฆผ์ ํตํด ์ ์ ์๋ค! ๐คฉ
* ์ถ์ฒ2) https://en.wikipedia.org/wiki/Law_of_large_numbers
'Statistics > Concepts(+codes)' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
distributionใbinomial distribution (์ดํญ๋ถํฌ) (0) | 2022.05.06 |
---|---|
Central Limit Theorem (CLT; ์ค์ฌ๊ทนํ์ ๋ฆฌ) (0) | 2022.05.05 |
f distribution (0) | 2022.05.04 |
Two-Samples ๐2 test (0) | 2022.05.03 |
๐2 distribution + One-Sample ๐2 test (0) | 2022.05.02 |
๋๊ธ