Marginal generally refers to something that's a small effect, something that's on the outside of a bigger system. It tends to diminish the importance of whatever is described as "marginal".

So how does that apply to the probability of a subset of random variables?

Assuming that words get used because of their meaning can be a risky proposition in mathematics, so I know there isn't necessarily an answer here, but sometimes the answer to this sort of question can help you to gain genuine insight, hence why I'm asking.


Consider the table below (copied from this website) representing joint probabilities of outcomes from rolling two dice:

two die rolls

In this common and natural way of showing the distribution, the marginal probabilities of the outcomes from the individual dice are written literally in the margins of the table (the highlighted row/column).

Of course we can't really construct such tables for continuous random variables, but anyway I'd guess that this is the origin of the term.

  • 2
    $\begingroup$ For 2d continuous variables, the equivalent would be some form of density plot (possibly using colour to represent density), with the marginal distributions literally in the margins of the plot $\endgroup$ – user36196 May 15 at 9:00

To add to Jake Westfall's answer (https://stats.stackexchange.com/q/408410), we can consider the marginal density as integrating out the other variable. In detail, if we have $(X, Y)$ being two random variables, then the density of $X$ at $x$ is $$ p(x) = \int p(x, y)dy = \int p(x | y)p(y)dy, $$ which when the variables are discrete, for example if $X$ and $Y$ only take on values of $1, \dots, 6$, then finding the probability of $$ p(X = 1) = \sum_{y = 1}^6 p(X = 1, Y = y) $$ which is the same as summing the elements in the first row ($i = 1$) of his table.

I think it's easier to view this in terms of a plot though. Below is a plot of the joint density when sampling from a mixture of two Gaussians, the marginal of $X$ and $Y$ to the top and on right respectively

Same plot with smoothed densities (you can think of this as the same but with $X$ and $Y$ now being continuous, in which case you can still find the marginal, but we will use an integral instead of summing)

Both of these plots were generated using the jointplot function from seaborn (https://seaborn.pydata.org/generated/seaborn.jointplot.html#seaborn.jointplot).

Hope this helps!

  • 1
    $\begingroup$ phwoah! nice chart. helpful indeed :) $\endgroup$ – stephan May 16 at 7:24
  • $\begingroup$ @stephan thank you! It's very simple to make, seaborn is very nice for doing aesthetically pleasing and informative plots. $\endgroup$ – white_noise May 16 at 14:54

Your Answer

