I want to understand what a discrete random variable and a continuous one are.

Let $X: \Omega \rightarrow \mathbb{R}$ be a random variable (a function). If $\text{Image} (X)$ is a countable set, then $X$ is a discrete random variable. If $\text{Image} (X)$ is a uncountable set, then $X$ is a continuous random variable. Right?

Are sets also called discrete/continuous? Or just random variables are? In the first case, discrete = countable and continuous = uncountable?

  • $\begingroup$ What do you mean by "lm(X)"? $\endgroup$
    – whuber
    Mar 3 '18 at 21:15
  • 1
    $\begingroup$ en.wikipedia.org/wiki/Image_(mathematics) $\endgroup$
    – user_anon
    Mar 3 '18 at 21:28
  • $\begingroup$ Please explain or write out any abbreviations you might be using. Although "$\mathcal{Im}$" is indeed commonplace in mathematics, it's far less common in statistics and in your case is easily confused with lower case "L" lower case "M." BTW, "discrete" means many things, but isn't a standard characterization of a set. It is the finest topology that can be defined on a set, though, so sometimes through an abuse of language sets (especially subsets of topological spaces) are termed "discrete." $\endgroup$
    – whuber
    Mar 3 '18 at 21:34

Some preliminary issues: This issue is complicated slightly by the fact that random variables are only interesting up to how they behave on a set with probability measure one - or to put it another way, random variables are uninteresting on sets with probability measure zero. For an arbitrary random variable $X: \Omega \rightarrow \mathbb{R}$ it is possible for $\text{Image}(X)$ to be uncountable, but for $X$ to still have a discrete distribution, since the uncountable part has probability measure zero. This kind of thing complicates the discussion.

To simplify this matter, it is common to categorise random variables by their probability measures, rather than by the image of the random variable in its functional mapping definition. This approach is equivalent to treating random variables in equivalence classes defined by probability measure, with two different random variables (in a sense that they are different functions on the sample space) being considered equivalent if they differ only on a set with probability measure zero.

Categorising random variables by probability measure: The above explains why we caegorise random variables as "discrete" or "continuous" based on probability measure, rather than the image of their functional definition. Even with this simplification, there is still a further complication.

The probability measure for any random variable can be written as a mixture of a continuous part and a discrete part (and in some nasty cases, a singular continuous part, which we will ignore). For an arbitrary random variable $X: \Omega \rightarrow \mathbb{R}$ we can then write:

$$\mathbb{P}(X \in \mathcal{A}) = \alpha \int \limits_\mathcal{A} f(x) d\lambda(x) + (1-\alpha) \sum_{x \in \mathcal{A} \cap \mathcal{D}} p(x).$$

The first part is the continuous part of the measure, with density $f$ and $\lambda$ being Lebesgue measure. The second part is the discrete part of the measure, with mass function $p$ and $\mathcal{D}$ being a countable set. The value $0 \leqslant \alpha \leqslant 1$ is the parameter giving the mix of continuous and discrete parts.

Discrete random variables: A discrete random variables is one where the probability measure has the above form with $\alpha = 0$. You are correct that this entails a countable set of values with probability one. Remember that this does not mean that its image is countable; it is possible that it still has an uncountable image, but its probability measure is concentrated entirely on a countable set within that image.

Continuous random variables: A continuous random variable is one where the probability measure has the above form with $\alpha = 1$. This necessitates an uncountable image, and it also means that the cumulative distribution function for the random variable will be continuous in the regular functional sense.

Mixture random variables: A mixture random variable is one where the probability measure has the above form with $0 < \alpha < 1$. This necessitates an uncountable image, but it also means that the cumulative distribution function for the random variable will not be continuous in the regular functional sense. It will have jumps at the points in the discrete part of the distribution.


Say you toss a fair coin. If it is head then you wait until the first tail of a (different) fair coin tossed once per second (that is, a geometric distribution, and if it tail, then you wait for an event with an exponential distribbution (e.g., like a lightbulb failing). Then the nontrivial support set of your waiting is uncountable, but most would not characterize this as a continuous random variable.

Instead, one way of characterizing a continuous random variable is that

$$ \forall_x P(X = x) = 0 $$

(see here, for example, as well as an alternative definition in the footnote). Conversely, if there is a countable set $E$ for which

$$ \sum_{x \in E} \left[ P(X = x) \right] = 1, $$

then it is discrete.

The above distribution, for example, would not be considered continuous or discrete - it is mixed.


It's also not about having transcendent numbers.

A variable that can take the two values 0 and pi is still discrete. It has just two levels.

It's not about infinitely many numbers in a finite interval, either.

Otherwise we would never have continuous variables, because our measurement resolution are discrete, and so are our numeric representations.

On discrete variables, the average of two values may not correspond to a real value. Say you have a binary value, less than 6 ft and over 6 ft tall, encoded as 0 and 1. If the average of two persons is 0.5, does that mean they are on average exactly 6 ft tall?

On continuous variables, it would be perfectly plausible to observe an interim value.

But even then, there is a gray area. If you consider the classic 'iris' data set. The variables are continuous. They are lengths of flower petals, so it is plausible for a flower to have any length in-between. But for many analyses, you will get artifacts from the discrete resolution of the input data, which has 0.1 mm or so as step size. This causes problems e.g. with Single-Link clustering. But this is IMHO a different kis0nd of discreteness: the values in-between make sense, it is only our input data that has a bad resolution.


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.