The new forums will be named Coin Return (based on the most recent vote)! You can check on the status and timeline of the transition to the new forums here.
The Guiding Principles and New Rules document is now in effect.

Stat help! Need a math nerd!

RhinoRhino TheRhinLOLRegistered User regular
edited July 2007 in Help / Advice Forum
I'm learning stats, on my own. I need to build a normal distribution curve.

For the most part I think I understand how it works.

basically I need to find a probability of something using this curve.

For example, say you got a stock with a 15% vol - what this means is that a 15% move in the stock will fall within one STD. I can more or less calculate this, but I need to calculate it from 0% to 200%.

so for example a $100.00 stock at 15% vol means that from $85.00 to $115.00 will occur 68.26894921371% percent of the time. Yea?

or to say it another way, their is a 34.134% (apox) chance that the stock will drop to $85.00

So basically what I need to do is say:

at 15% vol, the probability of the stock going to X is Y

Where X is a number like $72.25 and Y is the probability.

Anyone know a formula for this? It should go out using all STDs if applicable.

(warning, I'm very bad at math; take it slow please! thanks).

93mb4.jpg
Rhino on

Posts

  • HiroconHirocon Registered User regular
    edited July 2007
    The formula for the probability density function of a normal distribution with mean (mu) and standard deviation (sigma) is

    [1/((sigma)(squareroot(2pi)))] e^[-((x-(mu))^2)/(2((sigma)^2))].
    This formula is very difficult to make readable in text like this. I suggest you look at the formula here. In your case mu is 100 and sigma is 15, if I understand the problem correctly.

    Call the above function f. f is a probability density function. It does NOT mean that the probability of the random variable taking value x is f(x). It means that the probability of the random variable taking a value in the range [x, x+epsilon), divided by epsilon, approaches f(x) as epsilon approaches 0 from the right. If that is too complicated, think of it this way: there are infinitely many values that the random variable can take. The random variable could take the value 85, or it could take the value 85.0001, 85.00000001, 85.00000000031425463267, or uncountably many other values. There are so many values it could take that the probability of it EXACTLY taking the value 85 is essentially zero. It's really meaningless to talk about the probability of the variable taking some exact value. Instead, you can talk about the probability of the variable taking values in some range. The formula for the probability that the variable will take a value in the range [a, b) is

    (integral from a to b) f(x)dx.

    So, in your stock example, the probability of the stock falling below 85 is

    (integral from negative infinity to 85) f(x)dx.

    Unfortunately I don't know of a closed form solution for the integral of the normal distribution density function. Instead you can use tables like this one to get the integral from negative infinity to x of the standard normal distribution (mean 0, standard deviation 1). Call the function given in the first of those linked tables Phi.

    The probability of a variable X with normal distribution with mean (mu) and standard deviation (sigma) taking a value in the range [mu - a*sigma, mu + b*sigma) is equal to

    probability (X < mu + b * sigma) - probability (X < mu - a * sigma)

    = Phi(b) - (1 - Phi(a))

    = Phi(b) + Phi(a) - 1.

    Unfortunately it looks like you want to calculate the probability that the stock will take values from $0 to $200, which is a swing of 6.67 standard deviations on either side, and the table I linked to doesn't give values past 3.09 (and I can't find table that give values much higher than that), but the probability that a normal random variable won't go higher than 3.09 standard deviations above mean is already extremely close to 1. If you found the actual values and rounded to a reasonable number of places, you would likely find that the probability of the stock price falling in the range ($0, $200) is 1.

    EDIT: Looking at the SECOND table in the link above, it looks like they do indirectly show higher values for the Phi function. Actually, the second table shows values for 1 - Phi(x). You want Phi(6.67), and the closest value they have is 6.5. Using this value, the probability of the stock falling in the range (0, 200) is approximately

    1 - 2 * 4.016 * 10^(-11) = 0.99999999992.

    Technically, if you break from the pure normal distribution representation and realize that the stock price can never fall below 0, the probability becomes

    1 - 4.016 * 10^(-11) = 0.99999999996.

    Hirocon on
  • GoodOmensGoodOmens Registered User regular
    edited July 2007
    One quick note: you state that there is a 34% chance that it will drop to $85. That's not quite correct...a key aspect of the normal distribution is that the probability of any specific value is 0. The stock will not drop to $85 dollars; instead, you need to think in terms of "the probability that it will be less than 85$" or "more than 85$" or "between 2 values," maybe using 84.9-85.1 or something like that.

    That said, I'm assuming you're learning from a textbook. That textbook should have a normal distribution chart somewhere (appendix, or an inside cover) which allows you to find probabilities for different values of z. Z is a value representing how many standard deviations a value is from the mean. To find z, use this:

    z=(value-mean)/standard deviation

    Then just look for that value of z on the chart, and it will give you the appropriate probability. You need to check the chart to find out how the chart is organized; most will give the probability of having that z value or lower.

    You can use the horrible equation that Hirocon gave, but it's truly horrible, and I'm assuming that you don't know about integrals. Other people have done that work for you in setting up the chart, there's no point in reinventing the wheel.

    GoodOmens on
    steam_sig.png
    IOS Game Center ID: Isotope-X
  • RhinoRhino TheRhinLOL Registered User regular
    edited July 2007
    GoodOmens wrote: »
    One quick note: you state that there is a 34% chance that it will drop to $85. That's not quite correct...a key aspect of the normal distribution is that the probability of any specific value is 0. The stock will not drop to $85 dollars; instead, you need to think in terms of "the probability that it will be less than 85$" or "more than 85$" or "between 2 values," maybe using 84.9-85.1 or something like that.

    Yea, that's exactly what I need actucally. The probability of it falling in a certain price range. The probability of it landing on EXACTLY on $85.00 is low, be need to figure out the probability of it landing above or below it.
    That said, I'm assuming you're learning from a textbook. That textbook should have a normal distribution chart somewhere (appendix, or an inside cover) which allows you to find probabilities for different values of z. Z is a value representing how many standard deviations a value is from the mean. To find z, use this:

    z=(value-mean)/standard deviation

    So, Z is equal to $100 - $85.00 / 68.x (34.x ?) ? Is that right?
    Then just look for that value of z on the chart, and it will give you the appropriate probability. You need to check the chart to find out how the chart is organized; most will give the probability of having that z value or lower.

    You can use the horrible equation that Hirocon gave, but it's truly horrible, and I'm assuming that you don't know about integrals. Other people have done that work for you in setting up the chart, there's no point in reinventing the wheel.

    Either of you have the formula in a programming language? C, Java, Javascript, perl, other? I think that would be easier to understand.

    Rhino on
    93mb4.jpg
  • MeetElwoodMeetElwood Registered User regular
    edited July 2007
    To solve for Z, look for the difference between the two values of the range you're trying to figure out, and divide by the standard deviation.

    If you're looking for the range of $85 to $100
    Z = (100-85)/15 = 1
    If you look up a Z of 1 on a Z table (http://www.isixsigma.com/library/content/zdistribution.asp), you get .3413, or 34.13%. That means 34.13% of the time the stock will change to a value between $85 and $100.

    If you're looking for the range of $72.25 to $100
    Z = (100-72.25)/15 = 1.85
    Look up a Z of 1.85 on a Z table and you get .4678, or 46.78%. That means 46.78% of the time the stock will change to a value between $72.25 and $100.

    MeetElwood on
  • RhinoRhino TheRhinLOL Registered User regular
    edited July 2007
    MeetElwood wrote: »
    To solve for Z, look for the difference between the two values of the range you're trying to figure out, and divide by the standard deviation.

    If you're looking for the range of $85 to $100
    Z = (100-85)/15 = 1
    If you look up a Z of 1 on a Z table (http://www.isixsigma.com/library/content/zdistribution.asp), you get .3413, or 34.13%. That means 34.13% of the time the stock will change to a value between $85 and $100.

    If you're looking for the range of $72.25 to $100
    Z = (100-72.25)/15 = 1.85
    Look up a Z of 1.85 on a Z table and you get .4678, or 46.78%. That means 46.78% of the time the stock will change to a value between $72.25 and $100.

    Brilliant!

    That makes perfect sense.

    First thing I've understood in this entire thread. Thanks.

    so, at the risk of confusing the shit out of myself; how do I calculate Z?

    Rhino on
    93mb4.jpg
  • RhinoRhino TheRhinLOL Registered User regular
    edited July 2007
    MeetElwood wrote: »
    To solve for Z, look for the difference between the two values of the range you're trying to figure out, and divide by the standard deviation.

    If you're looking for the range of $85 to $100
    Z = (100-85)/15 = 1
    If you look up a Z of 1 on a Z table (http://www.isixsigma.com/library/content/zdistribution.asp), you get .3413, or 34.13%. That means 34.13% of the time the stock will change to a value between $85 and $100.

    If you're looking for the range of $72.25 to $100
    Z = (100-72.25)/15 = 1.85
    Look up a Z of 1.85 on a Z table and you get .4678, or 46.78%. That means 46.78% of the time the stock will change to a value between $72.25 and $100.

    also would it be correct to assume that if:

    $85.00 is 34.13% and
    $72.25 is 46.78 %
    That

    From there is a 12.65% chance of
    of it landing between $72.25 to $85.00 ?

    I don't think that is right (just subtracting the values). But that would be useful also, just punching in a range of numbers and getting the expected probability.

    Rhino on
    93mb4.jpg
  • MeetElwoodMeetElwood Registered User regular
    edited July 2007
    Now you've done it. You've unleashed the stat nerd and shitty artist in me.

    shittydiagramns0.jpg

    So basically yeah, you were right on.

    Stats is actually really easy. I'll probably get flak for this, but it's smart people that make it hard.

    MeetElwood on
Sign In or Register to comment.