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)