Page 1 of 2 12 LastLast
Results 1 to 15 of 18

Math Help - Z-Score to Percentile Formula?

  1. #1
    Newbie
    Joined
    Sep 2012
    From
    Uk
    Posts
    11

    Z-Score to Percentile Formula?

    I am looking for a formula to convert a z-score into the percentile or confidence interval.

    for example a z-score of 1 would give 68%, a z-score of 2 would give 95%

    what is the formula/equation for this?

    I do not want to use an online z-score to percentile calculator, and I do not want to use a table or graph. I want to use a formula to convert my z-score to a percentile.
    Follow Math Help Forum on Facebook and Google+

  2. #2
    MHF Contributor MarkFL's Avatar
    Joined
    Dec 2011
    From
    St. Augustine, FL.
    Posts
    1,988
    Thanks
    734

    Re: Z-Score to Percentile Formula?

    To find the area A under the standard normal curve between two zscores symmetric about the mean, you can use:

    A=\sqrt{\frac{2}{\pi}}\int_0^z e^{-\frac{x^2}{2}}\,dx

    Note: this will require numeric integration to obtain an approximation.

    You may also use Taylor polynomials to approximate this as well.
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Newbie
    Joined
    Jan 2013
    From
    Adelaide
    Posts
    12

    Re: Z-Score to Percentile Formula?

    G-day MarkFL2, cheers for putting up this equation, I've been scouring the web for hours looking for this. I was wondering if you might be able to clarify it a bit, I attempting to use the standard deviation and mean from some data to classify the probability (as a %) that a new value belongs to that data, i can calculate the z score (by subtracting the mean from the potential new value and dividing by SD) but need to use an equation to convert the z score to a % as my data-set has approximately 40 billion points ruling out the manual table method (i could use some kind of automated table lookup but a smaller equation would be preferable). For this purpose is the equation above the equation i should be using? if so I'm assuming in the equation z is the calculated z score and x is the new potential value but what do the e and dx signify? i know this has something to do with anti-derivatives but everything i look at on the net regarding these makes my brain hurt, can you dumb it down a notch? or point be in the right direction to a site that does?


    P.S. If any other lads or ladies out there have any idea's please let me know
    Follow Math Help Forum on Facebook and Google+

  4. #4
    MHF Contributor MarkFL's Avatar
    Joined
    Dec 2011
    From
    St. Augustine, FL.
    Posts
    1,988
    Thanks
    734

    Re: Z-Score to Percentile Formula?

    The equation I gave will give you the area between -z and z. x is a "dummy" variable, dx is the differential, and e is a noteworthy transcendental constant (the base of the natural logarithm). I am assuming you are using a programming language, and it may have an intrinsic function that will calculate this for you.
    Follow Math Help Forum on Facebook and Google+

  5. #5
    Newbie
    Joined
    Jan 2013
    From
    Adelaide
    Posts
    12

    Re: Z-Score to Percentile Formula?

    I am using some programing language but I'd really like to wrap my head around the maths beforehand. I'm afraid my knowledge of calculus is rather infantile (i.e. a couple of hours so far) but i think I follow that the equation is finding the anti-derivative of the equation/function of a bell curve, or in this case a segment of a bell curve as defined by the upper and lower levels of integration (0 and z), i reckon whats throwing me is the equation for the bell curve, would it be possible for you to put up the original function you used for the bell curve (as the ones on the net are confusing in the context of this equation) and explain how you rearranged it?

    P.S. apologies for my mathematical incompetence...
    Follow Math Help Forum on Facebook and Google+

  6. #6
    Super Member ILikeSerena's Avatar
    Joined
    Dec 2011
    Posts
    733
    Thanks
    121

    Re: Z-Score to Percentile Formula?

    Hi Mattrnfnr!

    Using functions that are available on graphical calculators, the formula would be:
    p = \text{normcdf}(z) - \text{normcdf}(-z)
    The inverse is:
    z = \text{norminv}(\frac 1 2 p + \frac 1 2)

    So if you want a 95% confidence interval, you need:
    z = \text{norminv}(\frac 1 2 \cdot 0.95 + \frac 1 2) = \text{norminv}(0.975)


    Btw, the normcdf(z) function is defined as:

    \text{normcdf}(z) = \frac{1}{\sqrt{2\pi}}\int_{-\infty}^z e^{- \dfrac 1 2 x^2} dx

    Another name for the same function is \Phi(z).
    This is the formula Mark referred to (with a few slight modifications... )
    Follow Math Help Forum on Facebook and Google+

  7. #7
    Newbie
    Joined
    Jan 2013
    From
    Adelaide
    Posts
    12

    Re: Z-Score to Percentile Formula?

    Itís handy to know how to double check using the graphics calculator for small data-sets but I have 40 billion data points and need to write code using the underlying mathematics, this is where my issue is I need to interpret the equation in a way that I can use, such that I can calculate the % confidence interval associated with the z value for the given data point in a given data-set.

    If I'm going to calculate a value i can't use an equation with infinity in it:

    Z-Score to Percentile Formula?-equation-2.png

    So I'd have to use the original equation:

    Z-Score to Percentile Formula?-equation-1.png

    but i don't understand how to interpret it as something in which i can put values:

    I understand this segment:

    Z-Score to Percentile Formula?-equation-fragment-1.png

    (Although I've no idea why I'm taking the square root of 2 divided by pi)

    but not this segment:

    Z-Score to Percentile Formula?-equation-fragment-2.png

    i have the z value, the sample size, the mean, standard deviation and the subject data value and need the confidence as a % that the subject data value fits the trend...
    Follow Math Help Forum on Facebook and Google+

  8. #8
    Super Member ILikeSerena's Avatar
    Joined
    Dec 2011
    Posts
    733
    Thanks
    121

    Re: Z-Score to Percentile Formula?

    The proper bell curve with a mean \mu and a standard deviation \sigma is (see wiki):
    f(x)= \frac{1}{\sigma\sqrt{2\pi}} e^{- \dfrac{(x-\mu)^2}{2\sigma^2}}

    The constant \sqrt{\frac 2 \pi} is wrong. It is a typo.
    The reason for the \frac 1 {\sqrt{2\pi}} is to make sure that when all possible z-values are integrated (from -\infty to +\infty), we find a probability of exactly 1.



    Your 95% interval corresponds with:
    \frac{1}{\sqrt{2\pi}} \int_{-z}^{+z} e^{-\frac 1 2 x^2} dx = 0.95

    The corresponding z-value is z=1.96.



    The section e^{-\frac 1 2 x^2} is the exponential function.

    An alternative way to write it, is: \exp(-\frac 1 2 x^2).
    All programming languages support this \exp() function.
    Last edited by ILikeSerena; February 16th 2013 at 04:23 PM.
    Follow Math Help Forum on Facebook and Google+

  9. #9
    Newbie
    Joined
    Jan 2013
    From
    Adelaide
    Posts
    12

    Re: Z-Score to Percentile Formula?

    So if I understand correctly (and history suggests I donít) an equation for the % confidence that a new value belongs to the data-set, would vaguely resemble:

    [1/(SQRT(2*π))]*[(exp(-(1/2*(+z^2)))) - (exp(-(1/2*(-z^2))))]

    Where z = ((new value Ė mean of existing data)/standard deviation of the existing data)
    Follow Math Help Forum on Facebook and Google+

  10. #10
    MHF Contributor MarkFL's Avatar
    Joined
    Dec 2011
    From
    St. Augustine, FL.
    Posts
    1,988
    Thanks
    734

    Re: Z-Score to Percentile Formula?

    Quote Originally Posted by ILikeSerena View Post
    ...
    The constant \sqrt{\frac 2 \pi} is wrong. It is a typo...
    Just so the OP understands, I used the even function rule to state:

    \frac{1}{\sqrt{2\pi}}\int_{-z}^z e^{-\frac{x^2}{2}}\,dx=\frac{2}{\sqrt{2\pi}}\int_{0}^z e^{-\frac{x^2}{2}}\,dx=\sqrt{\frac{2}{\pi}}\int_{0}^z e^{-\frac{x^2}{2}}\,dx
    Follow Math Help Forum on Facebook and Google+

  11. #11
    Super Member ILikeSerena's Avatar
    Joined
    Dec 2011
    Posts
    733
    Thanks
    121

    Re: Z-Score to Percentile Formula?

    Quote Originally Posted by MarkFL2 View Post
    Just so the OP understands, I used the even function rule to state:

    \frac{1}{\sqrt{2\pi}}\int_{-z}^z e^{-\frac{x^2}{2}}\,dx=\frac{2}{\sqrt{2\pi}}\int_{0}^z e^{-\frac{x^2}{2}}\,dx=\sqrt{\frac{2}{\pi}}\int_{0}^z e^{-\frac{x^2}{2}}\,dx
    Oops. Sorry. It was not a typo.
    Follow Math Help Forum on Facebook and Google+

  12. #12
    Super Member ILikeSerena's Avatar
    Joined
    Dec 2011
    Posts
    733
    Thanks
    121

    Re: Z-Score to Percentile Formula?

    Quote Originally Posted by Mattrnfnr View Post
    So if I understand correctly (and history suggests I donít) an equation for the % confidence that a new value belongs to the data-set, would vaguely resemble:

    [1/(SQRT(2*π))]*[(exp(-(1/2*(+z^2)))) - (exp(-(1/2*(-z^2))))]

    Where z = ((new value Ė mean of existing data)/standard deviation of the existing data)
    Hmm, you left out the integral sign.
    It means the result will be wrong.

    You would get something with an expression in (+z) from which you subtract the same expression in (-z).
    And yes, this is more or less how the formula can be programmed in a programming language.
    You do need to take care with the parentheses.
    As it is you need a couple of extra near -z: it should be (-z)^2 instead of just -z^2.

    Let's take a look at an example.
    Suppose you have z=1.
    Then the corresponding confidence interval has a probability of 68%.
    If we fill it in in your formula, we'd get:

    [1/(SQRT(2*π))]*[(exp(-(1/2*((+1)^2)))) - (exp(-(1/2*((-1)^2))))]

    = [1/(SQRT(2*π))]*[exp(-1/2) - exp(-1/2)]

    = [1/(SQRT(2*π))]*[ 0 ]

    = 0

    No, this does not look like the right result.
    Follow Math Help Forum on Facebook and Google+

  13. #13
    Newbie
    Joined
    Jan 2013
    From
    Adelaide
    Posts
    12

    Re: Z-Score to Percentile Formula?

    I'm not sure what you mean by 'left out the integral sign', isn't this expression [(exp(-(1/2*((+1)^2)))) - (exp(-(1/2*((-1)^2))))] equivalent to the integral section? the upper integration limit plugged into the expression after the integral sign - the lower integration limit plugged into the expression after the integral sign?

    I see I'm getting the wrong value, I'm just not sure what i need to do about it...
    Follow Math Help Forum on Facebook and Google+

  14. #14
    Newbie
    Joined
    Jan 2013
    From
    Adelaide
    Posts
    12

    Re: Z-Score to Percentile Formula?

    P.S. once again i apologize for my tenuous grasp of mathematics...
    Follow Math Help Forum on Facebook and Google+

  15. #15
    Super Member ILikeSerena's Avatar
    Joined
    Dec 2011
    Posts
    733
    Thanks
    121

    Re: Z-Score to Percentile Formula?

    Quote Originally Posted by Mattrnfnr View Post
    I see I'm getting the wrong value, I'm just not sure what i need to do about it...
    Find a library that calculates the normcdf function I mentioned earlier.
    Follow Math Help Forum on Facebook and Google+

Page 1 of 2 12 LastLast

Similar Math Help Forum Discussions

  1. Formula to find cumulative probability from z-score
    Posted in the Advanced Statistics Forum
    Replies: 3
    Last Post: March 29th 2011, 05:26 PM
  2. Z score, t score, CLT? I don't remember.
    Posted in the Advanced Statistics Forum
    Replies: 5
    Last Post: June 24th 2010, 07:01 PM
  3. n-th percentile
    Posted in the Statistics Forum
    Replies: 5
    Last Post: June 7th 2010, 12:28 PM
  4. Percentile
    Posted in the Statistics Forum
    Replies: 1
    Last Post: June 23rd 2009, 02:37 PM
  5. percentile
    Posted in the Algebra Forum
    Replies: 1
    Last Post: August 3rd 2008, 09:14 PM

Search Tags


/mathhelpforum @mathhelpforum