BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
AlexeyS
Pyrite | Level 9

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

 

1 ACCEPTED SOLUTION

Accepted Solutions
PGStats
Opal | Level 21

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
PG

View solution in original post

4 REPLIES 4
PaigeMiller
Diamond | Level 26

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;
--
Paige Miller
AlexeyS
Pyrite | Level 9
Thank you
PaigeMiller
Diamond | Level 26

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;
--
Paige Miller
PGStats
Opal | Level 21

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
PG

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 2147 views
  • 0 likes
  • 3 in conversation