2
$\begingroup$

Can someone clarify to me the difference between:

  • generating a random variable (according to a certain distribution) versus
  • generating a random number (according to a certain distribution)?

I am thoroughly confused by this concept, because my goal is simply to generate a set of data points according to a certain distribution, and every single reference out there is about generating random variables according to a certain distribution.

Mathematically speaking, A random variable is a function. A random number is a scalar. Totally different thing.

For example, this pdf (http://opim.wharton.upenn.edu/~sok/papers/s/rv.pdf) is titled "Generating a random variable" and starts an example with "the most widely used method of generating pseudo-random numbers are the congruential generator". But the notation for generating the pseudo-random number follows the convention of random variables.

In this reference, it talks about generating random variables with the rejection-sampling method. http://www.columbia.edu/~ks20/4703-Sigman/4703-07-Notes-ARM.pdf But I thought this method was used for generating random numbers (which is the end-goal for everyone)?

What is the distinction between these two concepts?

$\endgroup$
4
  • $\begingroup$ There is no distinction. "Generating a random variable" in those contexts refers to "generating a random number that follows the given distribution." $\endgroup$
    – angryavian
    Jan 29, 2019 at 22:39
  • $\begingroup$ @angryavian Then random variable == random number with a certain distribution? $\endgroup$
    – Concu Bine
    Jan 29, 2019 at 22:43
  • $\begingroup$ 'Generating a random variable' is better understood as transforming distributions, as a random variable does not (except in pathological cases) have a definite value. $\endgroup$
    – MrSlunk
    Jan 29, 2019 at 22:52
  • $\begingroup$ The result of a future coin flip (Heads or Tails) might be a random variable which is not a number $\endgroup$
    – Henry
    Jan 29, 2019 at 23:55

2 Answers 2

2
$\begingroup$

A random variable $f$ is a typically defined as a real valued measurable function. There are various characterisations, a typical one is that the set $f^{-1}((-\infty,\alpha])$ is a member of some specified $\sigma$-algebra. There is not necessarily a single distribution associated with the function. The term random is a misnomer, there is nothing random in the colloquial sense.

The constant function $f(\omega) = 1$ is a perfectly well behaved random variable with nothing random about it whatsoever.

A random variable is not generated as such, it is defined.

A random number generator is understood loosely as some process that produces a sequence of numbers whose statistics approach some specified ideal.

Aside:

Here is a nice collection of random variables (functions) stolen from Kac's wonderful monograph "Statistical Independence in Probability, Analysis and Number Theory" for your amusement.

Let $r(x) = (-1)^{\lfloor x \rfloor}$, and let $r_n(x) = r (2^n x)$ for $x \in [0,1]$ and $n \in \mathbb{N}$.

The $r_n$ are known as the the Rademacher functions. If you plot a few you will see that they are square waves of different frequencies.

Clearly there is nothing random about the $r_n$, however we can prove many results that have a probabilistic flavour, such as $\lim_{n \to \infty} {r_1(x)+\cdots + r_n(x) \over n} = 0$ for almost all $x$, or the stronger (& more difficult to prove) $\limsup_{n \to \infty} {|r_1(x)+\cdots + r_n(x) \over \sqrt{n \log(\log n)}}| = \sqrt{2}$ for almost all $x$ (cf. law of the iterated logarithm).

$\endgroup$
2
  • $\begingroup$ Thanks. Thinking about these random variables as constant functions makes more sense. However, it is rarely assumed in most of these references that the random variable is a constant. How do you explain this? $\endgroup$
    – Concu Bine
    Jan 30, 2019 at 2:01
  • $\begingroup$ Just to clarify, I am not saying that all random variables are constant, just that a constant is a random variable but clearly there is nothing random (in the quotidian sense) about a constant. I would suggest that you are placing too much emphasis on the word random. $\endgroup$
    – copper.hat
    Jan 30, 2019 at 2:06
0
$\begingroup$

I think a large part of the problem here is that there is not a general agreement on a convenient and accurate language to describe the use of pseudorandom numbers in computing. Instead, people tend to borrow words and notations from mathematical probability and abuse them mightily.

We have functions called “random number generators” (RNGs), but all they do is generate pseudorandom numbers with uniform distribution over a large but finite set of rational values. For various purposes we would like to generate random numbers according to a chosen distribution, but that’s an inconvenient phrase to have to repeat. We could abbreviate it to just “generate random numbers”, but then someone might think we mean an RNG with a uniform distribution. So sometimes someone will say “generate a random variable” because it is concise and get the point across (in context) even though it is not really correct.

There is also a long history of the use of pseudorandom numbers going back to the early years of computing, much of it done without mathematical rigor and often not well at all. It may be that some of the language we use nowadays for this purpose originated from practitioners who did not really understand how a random variable is defined mathematically, and the language “stuck” even among those who should know better due to the force of long usage.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .