To first provide some context, I have two boxplots (displaying median, 25th, and 75th percentiles), and I'm wondering what a boxplot of the difference between these two boxplots would look like. The random variables (RV's) aren't necessarily distributed normally. Specifically, the "random variables" are samples from posterior distributions, but I think my question is ultimately pretty generic.

Since I have many samples from these 2 RV's, one way to do this would be to compute the differences between randomized pairings, then compute the quantile of interest from these differences. Because my statistical terminology might be flawed, let me say this in the R language:

X <- rnorm(10, 1000) # The first RV, a numeric vector of length 1000
Y <- rnorm(20, 1000) # The second RV
Qs <- quantile(X-Y, probs=c(0.25, 0.5, 0.75) #The quantiles of their difference

However, I was wondering if there could be a way to compute the quantile of the difference between these RV's without going back to the original data. For example, from some combination of summary statistics (means, medians, variances, other quantiles, etc) computed from X and Y.

An example of something that does not give the correct answer, but which might shed light onto what I'm looking for:

wrong_Qs <- quantile(X, probs=c(0.25, 0.5, 0.75)) - quantile(Y, probs=c(0.25, 0.5, 0.75))

I am looking for something akin to the formulas for the propagation of uncertainty (variance) , but I haven't found anything yet.

The more I think about this, the more I'm thinking that there isn't a way to do what I'm asking. Any thoughts?

  • $\begingroup$ What it looks like depends on the joint distribution of the two variables, something you can't infer from the full marginals, let alone what's effectively a 5-number summary of them (the boxplot). $\endgroup$
    – Glen_b
    Aug 12, 2013 at 2:23

1 Answer 1


There is no generic way to get the boxplot of the differences from two boxplot summaries. The same marginal boxplots are compatible with quite different sets of differences.

Here is a simple example: Values $X = 1,2,3,4,5$ and $Y = 5,4,3,2,1$ produce the same box plot, but the differences are $4,2,0,-2,-4$. Let $Z$ be another copy of either $X$ or $Y$; then necessarily the differences between $X$ and $Z$ or $Y$ and $Z$ are $0,0,0,0,0$.

Nothing depends on how these values were produced, so origin in a Bayesian problem is quite immaterial.

(UPDATE) The same argument applies to histograms or any other univariate plot, the principle (as concisely expressed by @Glen_b) being that properties of joint distributions don't follow from properties of marginal distributions.

Strictly, what this implies is that juxtaposing or superimposing marginal distributions as a way of comparing groups is insufficient, and the corollary that you should plot differences directly leads to other plots, notably plots of differences versus means. Whenever variables occur in pairs (e.g. husbands and wives, before and after) which differences to plot is easy to answer. When there are several variables, there are usually too many possible pairwise plots to handle, however.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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