Converting between a z-score and p-value - Weblogs at Harvard
Converting between a z-score and p-value
June 28, 2020
[9]: # The following code will ask the user for a p-value # on a normal distribution curve and return the # corresponding z-score.
# Reference: how-to-calculate-the-inverse-of-the-normal-cumulative-distribution-function-in-p
import scipy.stats from scipy.stats import norm
print('1 = Convert a z-score to p-value on a normal curve') print('2 = Convert a p-value to z-score on a normal curve')
number = input('Enter your choice: ') choice = int(number)
if choice == 1: b = input("What is the z-score? ") z_score = float(b) one_sided_pvalue = round(scipy.stats.norm.sf(abs(z_score)),5) if z_score > 0.5: print('The corresponding one-sided (right-tailed) p-value
is',one_sided_pvalue,'.') elif z_score < 0.5: print('The corresponding one-sided (left-tailed) p-value
is',one_sided_pvalue,'.') else: print('The corresponding one-sided p-value is',one_sided_pvalue,'.')
elif choice == 2: a = input("What is the p-value? ") p_value = float(a) # ppf stands for "percent point function" z_score = norm.ppf(p_value) print('The corresponding z-score is',z_score,'.')
else: print('Invalid selection.')
1 = Convert a z-score to p-value on a normal curve
1
2 = Convert a p-value to z-score on a normal curve Enter your choice: 2 What is the p-value? 0.005 The corresponding z-score is -2.575829303548901 . [ ]:
2
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- normal distribution empirical rule z scores word problems
- stu z table university of arizona
- z scores correlation z scores an example university of dayton
- standard normal distribution table rochester institute of
- z scores discovering statistics
- descriptive statistics and psychological testing
- z score table university of pennsylvania
- descriptive statistics z scores princeton university
- converting between a z score and p value weblogs at harvard
- z scores university of west georgia
Related searches
- z score to p value
- z and p value table
- z score and percentile table
- how to use a z score table
- how to read a z score chart
- finding z score from p value
- z score to p value calculator
- using a z score table
- z score and probability calculator
- how to read a z score table
- z score and normal distribution calculator
- z test and p value approach calculator