0

I'd like to make an array of random samples from a Gaussian distrubution.

Mean value is 0 and variance is 1.

If I take enough samples, I would think my maximum value of a sample can be 0+1=1. However, I find that I get values like 4.2891 ...

My code:

x = 0+sqrt(1)*randn(100000,1);
mean(x)
var(x)
max(x)

This would give me a mean like 0, a var of 0.9937 but my maximum value is 4.2891?

Can anyone help me out why it does this?

4
  • 2
    A variance of 1 doesn't imply that the maximum value is 1. Gaussian distributions spread out to infinity in both directions so in theory it is possible to draw any real number from them. Commented Dec 15, 2014 at 19:25
  • 1
    Max value can be even bigger. Have a look at min(x). It would be nearly -max(x). Variance doesn' t mean the up/down bound. so "0 + 1 = 1" doesn' t make any sense in this case. Commented Dec 15, 2014 at 19:26
  • I suspect you might've confused x and y in the probability density function - Here x is uncapped unlike y (See en.wikipedia.org/wiki/Normal_distribution). Commented Dec 15, 2014 at 19:28
  • 1
    This question appears to be about the mathematics/statistics of the Normal distribution and is thus off-topic for StackOverflow. Commented Dec 15, 2014 at 22:16

2 Answers 2

1

As others have mentioned, there is no bound on the possible values that x can take on in a gaussian distribution. However, the farther x is from the mean, the less likely it is to be drawn.

To give you some intuition for what the variance actually means (for any distribution, not just the gaussian case), you can look at the 68-95-99.7 rule. The rule says:

  • about 68% of the population will be within one sigma of the mean
  • about 95% of the population will be within two sigma's of the mean
  • about 99.7% of the population will be within three sigma's of the mean

Here sigma = sqrt(var) is the standard deviation of the distribution.

So while in theory it is possible to draw any x from a gaussian distribution, in practice it is unlikely to draw anything past 5 or 6 standard deviations away for a population of 100000.

Sign up to request clarification or add additional context in comments.

Comments

0

This will yield N random numbers using the gaussian normal distribution.

N = 100;
mu = 0;
sigma = 1;
Xs = normrnd(mu, sigma, N);

EDIT: I just realized that your code is in fact equivalent to what I've written. As others already pointed out: variance is not the maximum distance a sample can deviate from the mean! (It is just the average of the squares of those distances)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.