p value to z score

66 views (last 30 days)
Nuchto
Nuchto on 2 Aug 2012
Commented: Star Strider on 25 Aug 2020
How do I determine the z score from a p value? Thanks!

Accepted Answer

Star Strider
Star Strider on 3 Aug 2012
Edited: Star Strider on 3 Aug 2012
Using the ‘erfcinv’ function (part of core MATLAB) and writing it as an anonymous function:
z = @(p) -sqrt(2) * erfcinv(p*2);
where ‘p’ is the probability.
So:
zscore = z([0.025 0.5 0.975])
produces:
zscore =
-1.9600e+000 0.0000e+000 1.9600e+000
  12 Comments
Star Strider
Star Strider on 25 Aug 2020
Rik —
Interesting function! Thanks for the citation!

Sign in to comment.

More Answers (1)

Oleg Komarov
Oleg Komarov on 3 Aug 2012
Edited: Oleg Komarov on 3 Aug 2012
Use icdf() from the Statistics Toolbox.
For (standard) normal:
icdf('normal',[0.005 0.995],0,1)
  2 Comments
Oleg Komarov
Oleg Komarov on 3 Aug 2012
Which distribution?

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!