0

I want to create a function that does hypothesis testing. One of the parameter is alpha, given alpha I want to get rejection region (by lookin up z-score table) how can I do this using python?

for example: if I input alpha=0.05 it should return [-1.96, 1.96]

haneulkim
  • 4,406
  • 9
  • 38
  • 80

1 Answers1

1

You can do it like this:

from scipy.stats import norm

def get_rejection_region(alpha):
    percentile = norm.ppf(1-alpha/2)
    rejection_region = [-percentile, percentile]
    return rejection_region

print(get_rejection_region(0.05))
David M.
  • 4,518
  • 2
  • 20
  • 25