I am looking at a reference for sampling from a distribution, and the first step of the so-called algorithm states:http://www.columbia.edu/~ks20/4703-Sigman/4703-07-Notes-ARM.pdf

  1. Generate a random variable $Y$ from distribution $G$.

How does this sentence make sense to people in statistics?

To me, a random variable is a function or mapping from the set of outcomes $\xi$ to a real number $y$. That is, $Y: \xi \mapsto y$.

What then, does it mean to generate a "random variable"?

It would mean to synthesize a function. I fail to see how this is even programmability feasible. For instance, what does it mean to generate "sine" function in Python? The most I could do is to provide you some samples from that sine function, but I could never provide the function itself, which is an abstract thing.

In addition, to generate something from distribution to me means to "produce a number".

So the wording is very confusing to me. Because a function is not a number.

Can someone clarify this idea for me?

  • 2
    $\begingroup$ If you generate it, it's not random any more is it? That's inconsistent language as far as I'm concerned. I'd prefer, "Draw observations from the random variable Y having distribution G" or "Simulate draws from" or "Generate realizations from" etc. $\endgroup$
    – AdamO
    Jan 29, 2019 at 22:43
  • 1
  • 1
    $\begingroup$ Your problem might be that in conceiving of the probability distribution you see a function where the value of the draw is the output. For a PDF or CDF the value of the draw in the input, and the probability density of that draw or the probability that another draw will be lesser is the output. The mapping is value -> likelihood. $\endgroup$ Jan 29, 2019 at 23:03
  • 2
    $\begingroup$ The random variable is a collection of tickets in a box, where each ticket has a number (or vector) written on it. The "generate a random variable" phrase you quote likely is an unfortunate way of asking you to draw a ticket from that box. (Although it's not the case here, there is an alternative interpretation that takes this phrase literally: the tickets might bear the names of random variables. Thus, when you draw one such ticket, you have produced an entire random variable. This is a standard setting for Bayesian analyses.) $\endgroup$
    – whuber
    Feb 1, 2019 at 15:41

1 Answer 1


What you're actually generating is a realization of a random variable. The random variable $Y$ has distribution $G$ but its realization, $y$, is just a number.

On the other hand if you generate a sequence of such realizations, $y_1,y_2,y_3...$, and then calculate the empirical cdfs ($\hat{G}_n(t)$ being the proportion of the sample $y_1,y_2,y_3,..., y_n$ that is $\leq t$), then in the limit as $n\to\infty$, $\hat{G}_n$ will converge to $G$.

plot of density, cdf of a gamma(2,1), and ecdf of 1,10,100 and 1000 realizations showing approach to the cdf
(click image for a larger version)


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.