Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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.

share|improve this question
    
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., en.wikipedia.org/wiki/… ... –  Steven Stadnicki May 29 '12 at 19:55
    
@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. –  Mahoni May 29 '12 at 19:57
    
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. –  André Nicolas May 29 '12 at 19:58
    
@AndréNicolas I am not doing this from scratch. My programming language has already a function for generating normal variates. –  Mahoni May 29 '12 at 20:03
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. –  André Nicolas May 29 '12 at 20:10

1 Answer 1

up vote 0 down vote accepted

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].

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.