1) ํ๋ณธ์ด ์๋ก ๋
๋ฆฝ์ ์ด์ฌ์ผ ํ๋ค.
2) ํ๋ณธ์ด ์ ๊ท๋ถํฌ๋ฅผ ์ด๋ค์ผ ํ๋ค.
from scipy.stats import normaltest
import numpy as np
sample = np.random.normaal(size = 1000) # normal ๋ถํฌ๊ฐ ์๋
normaltest(sample)
3) ๋น๊ตํ๋ ๋ ํ๋ณธ์ ๋ถ์ฐ์ด ํต๊ณ์ ์ผ๋ก ์ ์ฌํด์ผํ๋ค. (p > 0.05)
1) Categorical ๋ฐ์ดํฐ์ ์ ํฉํ ๋ชจ๋ธ๋ง์ด ๊ฐ๋ฅํจ
2) ๊ทน๋จ์ outlier๊ฐ ์๋ ๊ฒฝ์ฐ์๋ ์ฌ์ฉํ ์ ์์
3) distribution free method๋ผ๊ณ ๋ ๋ถ๋ฆ
๊ท๋ฌด๊ฐ์ค : ๋ฐ์ดํฐ๊ฐ ์์๋๋ ๋ถํฌ์ ์ ์ฌํ ๋ถํฌ๋ฅผ ๊ทธ๋ฆด ๊ฒ์ด๋ค.
๋๋ฆฝ๊ฐ์ค : ๋ฐ์ดํฐ๊ฐ ์์๋๋ ๋ถํฌ์ ์ ์ฌํ์ง ์์ ๊ฒ์ด๋ค.
์์๋๋ ๋ถํฌ๋ ๋๊ฐ ๋ฐ์ดํฐ์ ํ๊ท ์ ์ฌ์ฉํจ
๐2 = โ(๐๐๐ ๐๐๐ฃ๐๐iโ๐๐ฅ๐๐๐๐ก๐๐๐)^2 / (๐๐ฅ๐๐๐๐ก๐๐๐)
ns_obs = np.array([[5, 23, 26, 19, 24, 23]])
import numpy as np
from scipy.stats import chisquare
chisquare(a, axis=None)
ex1) ๋ง์คํฌ ์ฐฉ์ฉ ์ฌ๋ถ์ ์ฝ๋ก๋19 ๊ฐ์ผ ์ฌ๋ถ
ex2) ํผ์ธ ์ฌ๋ถ์ ๋ฐ๋ฅธ ์ฌ๊ฐ ๋น์ฉ
from scipy.stats import chi2_contingency
a= pd.crosstab(customer['marriage'], customer['consum_alchol'])
print(chi2_contingency(a)