0

I'm struggling to generate a completely accurate normal distribution in R.

The command rnorm(n, mean, sd) creates a sample drawn from a normal distribution, but the mean and sd are rarely exactly what is specified in the command(even at very high sample size). How should I go about generating a population with an exact mean/sd?

Thanks in advance.

Ludus
  • 1
  • 3
    Random sampling from a normal distribution will give you an exactly mean and sd approximately 0% of the time. Same is true for any continuous distribution. What you are asking for doesn't make a lot of sense. You can center and scale a set of values to whatever mean and variance you want, but then they are no longer sampled from a particular statistical distribution. – MrFlick Oct 23 '15 at 20:16
  • Ok, thank you. To be clear: there is no way to generate a perfect representation of a normal distribution using r? – Ludus Oct 23 '15 at 20:20
  • there are *some* reasonable use cases for this sort of thing (see linked duplicate) – Ben Bolker Oct 23 '15 at 20:22
  • 2
    That wound't be a perfect representation at all. There is no such thing as a perfect representation. You'd need an infinite number of points. – MrFlick Oct 23 '15 at 20:22
  • the other interpretation of this question would be to sample evenly spaced values from the quantiles, e.g. `x <- qnorm(seq(1/(n+1),n/(n+1),length=n))`, but I'm not sure this actually gets you the right SD ... – Ben Bolker Oct 23 '15 at 20:25
  • I'm sure the qnorm could be adjusted so it output the desired SD. The linked page is exactly what I needed, as well. Thank you for your help, Ben! – Ludus Oct 23 '15 at 21:07

0 Answers0