This is the code I typed in to get the p value, but I got an error. Can someone pls help me? Find the p-value for:
𝐻0 : 𝑝=0.44 vs. 𝐻𝑎 : 𝑝>0.44
𝑝̂ =0.51
𝑛=38
import numpy
import scipy
p = 0.44
p_hat = 0.51
n = 38
SE = numpy.sqrt((p*(1-p))/n)
z = (p_hat-p)/SE
p_value = 1 - stats.norm.cdf(z)
print(p_value)
round(p_value, 6)
AttributeError Traceback (most recent call last)
<ipython-input-8-5cd3d51cd0b9> in <module>
7 SE = numpy.sqrt((p*(1-p))/n)
8 z = (p_hat-p)/SE
----> 9 p_value = 1 - stats.norm.cdf(z)
10 print(p_value)
11 round(p_value, 6)
AttributeError: module 'scipy' has no attribute 'norm'
source https://stackoverflow.com/questions/70146660/i-am-trying-to-find-the-p-value-using-python-but-i-have-problems
Comments
Post a Comment