运行 ❯
获取您自己的
Python
服务器
×
更改方向
更改主题,深色/浅色
转到 Spaces
import scipy.stats as stats import math # Specify the number of occurences (x), the sample size (n), and the proportion claimed in the null-hypothesis (p) x = 10 n = 40 p = 0.45 # Calculate the sample proportion p_hat = x/n # Calculate and print the test statistic print((p_hat-p)/(math.sqrt((p*(1-p))/(n))))
-2.542566904654913