############################################################ # # # Virtual Laboratory of Statistics in Python # # # # Inferential statistics introduction (12.06.2017) # # # # Complutense University of Madrid, Spain # # # # THIS SCRIPT IS PROVIDED BY THE AUTHORS "AS IS" AND # # CAN BE USED BY ANYONE FOR THE PURPOSES OF EDUCATION # # AND RESEARCH. # # # ############################################################ import scipy.stats as s # Obtaining critical values in standard normal table Z:N(0,1) # CASE A: For example, for a level of significance of 5% alpha=0.05; # area is the confidence level area=1-alpha; critical_value=s.norm.ppf(area); print('Case A, -z_alpha = ', -critical_value); # CASE B: For example, for a level of significance of 5% alpha=0.05; half_alpha=alpha/2; # area is the confidence level and half of the significance level area=(1-alpha)+half_alpha; critical_value=s.norm.ppf(area); print('Case B, -z_alpha/2 = ',-critical_value," z_alpha/2 = ",critical_value); # CASE C: For example, for a level of significance of 5% alpha=0.05; # area is the confidence level area=1-alpha; critical_value=s.norm.ppf(area); print('Case C, z_alpha = ',critical_value);