0
$\begingroup$

I want to sample a 1-dimensional Gaussian, for this I need to generate random numbers in a certain range which will be used as function input.

The function is $$\mathcal{N}(x|0,1) = \frac{1}{(|2 \pi|)^\frac{1}{2}} \cdot exp(- \frac{1}{2} x^2)$$

Plotting it I get the following result:

plotting gaussian N(x|0,1)

This however does not help me in the decision in which number range I should use, maybe $[-2,2]$? This seems too arbitrary, what is the correct approach here?


In my programming langauge I have a random generator for generating normal variates.

  • 0
    What do you mean by 'will be used as function input', can you talk more about the specific sampling that you're planning on doing? There are several well-established techniques for generating normal deviates; see, e.g., http://en.wikipedia.org/wiki/Normal_distribution#Generating_values_from_normal_distribution ...2012-05-29
  • 0
    @StevenStadnicki I have defined the 1-dimensional Gaussian function in my question. In order to sample it, I need input values $x$ in order to get a sample result. That's what I meant.2012-05-29
  • 0
    If you are doing things from scratch, I would suggest the Box-Muller Method, easy to find on the web. Various pieces of software, like Excel, will also do the job, with minimal programming. Calculating the *density* for various input values $x$ is not too useful, unless you are merely graphing.2012-05-29
  • 0
    @AndréNicolas I am not doing this from scratch. My programming language has already a function for generating normal variates.2012-05-29
  • 1
    @Mahoni: If your programming language has a function, let it do its stuff. It will presumably not limit outputs to $[-2,2]$, since such events, for $P(|Z|>2)$, though smallish, is non-zero.2012-05-29
  • 0
    @AndréNicolas Okay then I got it!2012-05-29

1 Answers 1

0

If this is a standard normal [-2, 2] only contains 95.4 percent of the data [-4, 4} puts it well over 99%. Six sigma would be [-6, 6].