_대문 | 방명록 | 최근글 | 홈피소개 | 주인놈
FrontPage › Python-비율검정

Contents

[-]
1 one-sample
2 two-sample


1 one-sample #

A중학교에는 100명 중에 45명이 흡연을 한다. 국가 통계를 보니 중학생 흡연율은 35%라고 한다. 같나?
import numpy as np
from statsmodels.stats.proportion import proportions_ztest

count = np.array([45])
nobs = np.array([100])
val = 0.35

z, p = proportions_ztest(count=count, nobs=nobs, value=val)
print(z)
print(p)

2 two-sample #

복날에 A회사 사람들 300명 중 100명이 삼계탕을 먹었고, B회사 사람들 400명 중 170명이 삼계탕을 먹었다. 율이 같냐?
import numpy as np
from statsmodels.stats.proportion import proportions_ztest

count = np.array([100, 170])
nobs = np.array([300, 400])

z, p = proportions_ztest(count=count, nobs=nobs, value=0)
print(z)
print(p)
EditText : Print : Mobile : FindPage : DeletePage : LikePages : Powered by MoniWiki : Last modified 2018-04-13 23:12:53

누군가가 나에게 일러주었네. 나는 난쟁이보다 작지도 않고 거인보다 크지도 않음을...(난쟁이가 쏘아 올린 공중에서)