sailorCat
작성일
2021. 12. 17. 14:19
작성자
sailorCat
728x90

표본분포 Sampling Distribution

 

표본조사를 통해 모집단에 대한 해석

전수조사가 실제로 불가능한 경우 

ex) 선거 출구조사

 

표본조사는 전체 모집단에 대한 전수조사가 아니기 때문에, 오차가 발생한다.

 

 

 

단순랜덤추출법 Random Sampling

 

난수표 사용

랜덤넘버 생성 사용

https://colab.research.google.com 

 

Google Colaboratory

 

colab.research.google.com

 

import random

[random.randint(1, 10) for i in range(10)]

 

 

표본 평균의 분포

 

표본조사를 통해 모수 Parameter을 알아낸다.

모수 Parameter

- 모평균

- 모분산

- 모비율

 

모수를 측정하기 위해 표본을 선택하여 표본평균과 표본분산을 계산한다.

통계량 Statistics

- 표본평균

- 표본분산

- 표본의 특성값

 

 

표본의 평균은 표본의 선택에 따라 달라지며 표본평균도 확률변수이다.

표본평균도 확률분포를 가니다.

 

통계량의 확률분포는 표본분포 Sampling Distribution이다.

 

표본평균

- 모평균을 알아내는데 쓰이는 통계량

 

표본평균의 분포

- 정규 모집단에서 추출된 표본의 측정값

 

import numpy as np

xbars = [np.mean(np.random.normal(size = 10)) for i in range(10000)]

np.mean(xbars)

np.var(xbars)

 

import matplotlib as plt

xbars = [np.mean(np.random.normal(loc = 10, scale = 3, size = 10)) for i in range(10000)]

np.mean(xbars)

np.var(xbars)

h = plt.pyplot.hist(xbars, range = (5, 15), bins = 30)

그래프 출력

bins 30개 막대지표 5에서 15

 

 

 

 

 

중심극한정리 Central Limit Theorem

 

- 모집단이 정규분포를 따르지 않을 경우

 n>=30 이상이 되면(n이 충분히 크면) 정규분포를 따르게 된다.

 

모집단이 정규분포를 따르지 않으면 30개 이상의 표본을 선택하면 된다.

 

import numpy as np

import matplotlib as plt

n = 3

xbars = [np.mean(np.random.rand(n)*10) for i in range(10000)]

h = plt.pyplot.hist(xbars, range = (0, 10), bins = 100)

 

n=10 n=30... n 값을 늘려가며 그래프 비교

 

 

import numpy as np

import matplotlib as plt

n = 2

xbars = [np.mean(np.random.exponential(scale = 3, size = n)) for i in range(10000)]

h = plt.pyplot.hist(xbars, range = (0, 10), bins = 100)

 

지수분포의 확률

 

728x90