Hello, i don't know where is my error.
Suppose i have a normal distribution, and to calculate critical values :
data criticalvalue;
alpha=0.05;
normal_left = round(quantile('NORMAL', alpha), .001);
normal_right = round(quantile('NORMAL', 1-alpha), .001);
normal_two = round(quantile('NORMAL', 1-alpha/2), .001);
run;
Now, i wan to calculate p-values, based on critical values :
data p_values;
zstat = -1.645;
normal_left = probnorm(zstat);
normal_right = probnorm(abs(zstat));
normal_two = 2*(1 - probnorm(abs(zstat)));
run;
My question is : why p-value normal_two is not equal to probability for two_sided when i calculated critical value(1-alpha/2)
? In p-value i got 0.1, and probability for critical value i got 0.975. So, what's wrong?
Thank you
Or to show the symmetry:
71 data _null_; 72 alpha=0.05; 73 q_left = round(quantile('NORMAL', alpha), .001); 74 q_right = round(quantile('NORMAL', 1-alpha), .001); 75 q_two = round(quantile('NORMAL', 1-alpha/2), .001); 76 p_left = probnorm(q_left); 77 p_right = 1 - probnorm(q_right); 78 p_two = 2 * (1 - probnorm(q_two)); 79 put (_all_) (=/); 80 run; alpha=0.05 q_left=-1.645 q_right=1.645 q_two=1.96 p_left=0.0499849055 p_right=0.0499849055 p_two=0.0499957903
It's not a linear translation, you have the wrong value of zstat.
data p_values;
zstat = -1.645;
normal_left = probnorm(zstat);
normal_right = probnorm(abs(zstat));
normal_two = 1-probnorm(1.96);
run;
Or another solution
data p_values;
zstat = -1.645;
normal_left = probnorm(zstat);
normal_right = probnorm(abs(zstat));
normal_two = 1-probnorm(quantile('NORMAL', 1-alpha/2));
run;
Or to show the symmetry:
71 data _null_; 72 alpha=0.05; 73 q_left = round(quantile('NORMAL', alpha), .001); 74 q_right = round(quantile('NORMAL', 1-alpha), .001); 75 q_two = round(quantile('NORMAL', 1-alpha/2), .001); 76 p_left = probnorm(q_left); 77 p_right = 1 - probnorm(q_right); 78 p_two = 2 * (1 - probnorm(q_two)); 79 put (_all_) (=/); 80 run; alpha=0.05 q_left=-1.645 q_right=1.645 q_two=1.96 p_left=0.0499849055 p_right=0.0499849055 p_two=0.0499957903
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.