Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Deriving points conforming to bell curve

  1. Jun 21, 2010 #1
    I am writing a system that collects values from our devices (CRAH, Generators, etc) compute the trend of the data, and determine if an alarm should be raised.

    For testing I have a point generator and I want it to follow fairly realistic norms. Currently I generate a new point as:

    p.Y = p'.Y + rand.NextDouble()-.5; | p' is the previous point, and Y is the value being generated (p.X is a point in time)

    This is taking the value of the last point and adding a random variant that is +- .5.

    The problem is that rand will generate a totally linear grouping of numbers. What I want to do is put that point through a computation so that the next point follows a bell curve. Therefore it is more likely to generate a difference of (say) .09 - -.09 then it is .5 and .5 is closer to a 0 chance of generation than any other point.

    I've used google and searched a few math forums but most of the discussion is from data analysis after the fact not during generation of the points.

    Any suggestions on a formulae that would produce the desired distribution?
     
  2. jcsd
  3. Jun 21, 2010 #2

    EnumaElish

    User Avatar
    Science Advisor
    Homework Helper

    Do you mean to replace p.Y = p'.Y + rand.NextDouble()-.5 with
    p.Y = p'.Y + NormallyDistributedRandomVariableWithZeroMean ?
     
  4. Jun 21, 2010 #3
    Well I guess that is what I mean. So what is the formula for that?
     
  5. Jun 21, 2010 #4

    CRGreathouse

    User Avatar
    Science Advisor
    Homework Helper

    The Box–Muller transform is a good way. But you're going to have to decide what standard deviation to use, and that depends on your application.
     
  6. Jun 21, 2010 #5

    EnumaElish

    User Avatar
    Science Advisor
    Homework Helper

    Generally speaking, you need to apply the inverse-normal (inverse Gaussian) transformation to a random variable between 0 and 1; one way is to use the algorithm CRGreathouse suggested.
     
  7. Jun 21, 2010 #6
    Thanks for the input. Looking at the Box Muller transform, it is aimed at creating an x,y point in a two dimensional space. Since I was only interested in generating points along the x-axis I used the s1 part of the transform.

    p.Y = p'.Y + (Math.Sqrt( -2 * Math.Log( rand.NextDouble( ) ) ) * Math.Cos( 2 * Math.PI * rand.NextDouble( ) )) - .5;

    where each rand.NextDouble() supplies the random x1 and y1 from the evenly distributed range of points between 0 and 1.

    plugged it into the formula and will begin testing soon to see how it goes.

    Thanks.
     
  8. Jun 21, 2010 #7

    CRGreathouse

    User Avatar
    Science Advisor
    Homework Helper

    The s2 is just another random normal variable. You get two for the price of one. If speed is an issue, generate them two at a time; if not, the formula you have works.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Deriving points conforming to bell curve
  1. Risk curve (Replies: 0)

  2. Grading on a curve (Replies: 3)

Loading...