0

I'm trying to convert a series of Z scores into 2-tailed P values in MATLAB. I can see many solutions online that use the MATLAB statistics toolbox, but I don't have this additional package. How can convert my Z scores to p values using only functions in core MATLAB?

user2524828
  • 181
  • 1
  • 4
  • 15
  • If all you really need is `normcdf` from the Statistics Toolbox, you can find another implementation for it (or, if you have the toolbox and just lack the license, you can simply copy MATLAB's implementation into a new function and use that instead). – buzjwa Apr 19 '14 at 10:23

1 Answers1

0

This is going to come down to finding the area under the standard normal curve. If you let Y be a continuous random variable, finding the probability of your two tails comes down to the following:

Equation

Approximating these integrals is what the statistics toolbox would've done for you. The easiest thing to do would be a rectangle-rule type approximation of the integral. They only take a few minutes to code, and can be very accurate. Here is an explanation of the method, as well as error you can expect:

http://en.wikipedia.org/wiki/Rectangle_method

Of course, the easiest thing to do is find another implementation of normpdf!

mkierc
  • 1,193
  • 2
  • 15
  • 28