In [2]:
import scipy.stats as s
from scipy.stats.mstats import zscore
import numpy as np
One-tailed test: A test in which the values of the parameter being studied under the alternative hypothesis, are allowed to be either greater than or less than the values of the parameter under the null hypothesis, but not both.
Two-tailed test: A test in which the values of the parameter being studied under the alternative hypothesis could be greater than or less than the values of the parameter under the null hypothesis.
In [4]:
def calculate_zscore():
pass
def calculate_zscore_pvalue(Z,two_tailed=True):
if Z > 0:
pval = 1.0 - s.norm.cdf(Z)
else:
pval = s.norm.cdf(Z)
if two_tailed:
pval = 2.0 * pval
return pval
Z = 2.0
print(calculate_zscore_pvalue(Z))
In [ ]: