rnorm is an R language function defined as:

rnorm.X generates multivariate normal random variates in the space X.

Consider rnorm(1000, 50, 5), drawing 1000 values from a normal distribution with mean 50 and standard deviation 5.

Are these 1000 values iid? If they are then the sampling is done with replacement. Are rnorm and runif samples generated with replacement or without replacement?

  • $\begingroup$ That is not the normal distribution in base R package stats. $\endgroup$ – Rui Barradas Feb 29 at 14:54
  • $\begingroup$ @RuiBarradas Care to explain? rnorm is the way you draw random numbers from a normal distribution in base R. $\endgroup$ – Ingolifs Feb 29 at 21:14
  • 2
    $\begingroup$ @Ingolifs The link is to a function in a contributed package, that help page list 9 rnorm.X, functions, not rnorm, the base R function. $\endgroup$ – Rui Barradas Feb 29 at 22:54

Both the normal and uniform distributions are continuous; ie, any particular value has probability of zero. Obviously there is numerical precision and other considerations involved with a machine-specific implementation but for all intents and purposes, you can suppose that $\mathbb P(X = x) = 0$ for any particular $x$; ie, the probability that you randomly draw a value identical to any particular point you specify is $0$. Further, if you have any countable (ie, you could count it out, possibly infinite) or finite (ie, you have a set with a fixed number of elements) set $\mathcal X$, $\mathbb P(X \in \mathcal X) = 0$ as well. That is, for any countable set of real numbers within the support of the distribution (for the uniform case, this would be $[0, 1]$, and for the normal case, the support is just all of the reals) there is also a probability of $0$ that a "new draw" or any finite number of draws will be equal to any of them (this applies for all continuous distributions; one can define mixed distributions in which this is NOT the case, but for continuous random variables, this is always the case as by definition a continuous distribution is defined over uncountably infinitely many points). There is no such thing as "with replacement" and "without replacement" if the distn function is continuous; further, if the distribution is discrete "without replacement" explicitly violates $iid$ (as you are specifically and deliberately omitting values from the possible sets of values based completely on the values you have already obtained). rnorm and runif generate $iid$ samples.


For "with replacement" and "without replacement" to be distinct, you'd need a finite population. If you have a finite population, you don't have a normal distribution (nor any other continuous distribution).

[Implementation wise, however, there's only a finite number of different values that it's possible to generate on a computer -- at any fixed number of bits, the computer can only represent a finite number of different values, so in that sense you have a finite population, and strictly speaking the distribution is discrete rather than continuous. However the normal model is itself continuous even though we don't have a way to practically generate values that are truly/perfectly from it.]


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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