# Question about random variables and the distribution of the sample mean

I'm new to statistics. I am so confused as to why the Xbar (the random variable describing the sample mean) can be found by taking the average of all the X's. From what I understand the capital X's represent random variables. Random variables don't represent numbers, e.g. X1 ≠ 5 or whatever. When I see a random variable, I just think: probability distribution. But how could you possibly add probability distributions together?! I would prefer if you gave the most simple answers as possible. Thank you!

• Your question equates "random variables" with "probability distributions." They are related but distinct concepts. See stats.stackexchange.com/questions/331973 for instance, which has extensive discussions comparing and contrasting the two in the context of adding random variables. – whuber Dec 3 '19 at 21:13

You may be confused about the distinction between a random variable and a realization of a random variable.

If $$X_1, X_2, ..., X_n$$ are the random variables representing the first, second, ..., $$n$$th observations in a sample and $$x_1, x_2, ..., x_n$$ are their corresponding realizations (the actual numbers in your sample - once you observe it), then $$\bar{X}$$ is the random variable that is average of the random variables $$X_1, ..., X_n$$ and $$\bar{x}$$ is the actual sample mean (both the realization of $$\bar{X}$$ and the average of $$x_1, ..., x_n$$).

$$\bar{X}$$ is not a number (you might think of it as a random outcome) but $$\bar{x}$$ is a number.

It's important to keep these concepts distinct. If you want to figure out the properties/behavior of means of random samples you deal with the first sort of thing. If you want to talk about what happened in a particular sample, you need the second sort of thing.

When you add $$X_1$$ and $$X_2$$ you are not computing the sum of their distributions. You are computing the distribution of their sum.

In general such a calculation involves an integral on the joint distribution. If they're independent, as here, this simplifies to a convolution of their densities (pmfs for discrete variates). There are a variety of other ways to compute this though - you might use MGFs for example (where they exist in a neighborhood of 0), or characteristic funtions.

• I understand the difference between realisations and random variables and I understand that Xbar is not a number. That's why I am confused. How can you create Xbar by computing the distribution of their sum of X1, ... , Xn if X1, ..., Xn aren't even numbers? How do you sum things that aren't numbers? Thanks for your response. – Will Dec 3 '19 at 7:01

Trying to repeat Glen's answer in another way:

The collection of random variables $$X_1,\ldots,X_n$$ is a sequence of measurable functions \begin{align*} X_i\,:\ &\Omega\longmapsto\mathbb R\\&\omega\longmapsto X(\omega) \end{align*} that turns the same realisation of a "fundamental" random event, $$\omega$$, into the realisations $$X_1(\omega)=x_1,\ldots,X_n(\omega)=x_n$$. Therefore, $$\bar X_n$$ is also a function on $$\Omega$$ that turns one realisation $$\omega$$ into a real number.

If this sounds too abstract, consider the example of an iid sequence of Normal $$\mathcal N(0,1)$$ random variables $$X_1,\ldots,X_n$$. They can be constructed as the functions \begin{align*} X_i\,:\ \Omega=(0,1)&\longmapsto\mathbb R\\\omega&\longmapsto X_i(\omega)=\Phi^{-1}(\sigma_i(\omega)) \end{align*} where $$\Phi$$ denotes the Normal $$\mathcal N(0,1)$$ cdf and $$\sigma_i\,:\ (0,1)\longmapsto(0,1)$$ is a deterministic transform that keeps the Uniform $$(0,1)$$ distribution invariant (for instance, a permutation of the machine binary digits of $$\omega$$ or the $$i$$-th call to the Uniform random generator). To produce simultaneously all realisations of $$X_1,\ldots,X_n$$ and $$\bar X_n$$, one only needs to draw $$\omega$$ from the available random generator and then compute $$x_1,\ldots,x_n,\bar x_n$$ as the above transforms. As in the R code below

set.seed(1234)
n=10
unifs=runif(n)
X=rep(0,n)
for (i in 1:n) X[i]=qnorm(unifs[i])
xbar=mean(X)


You’re hung up on a particular interpretation of what “+” can mean. The operator “+” acting between two random variables yields the random variable whose realizations are generated by adding the realizations of the constituents. It’s just a definition/convention.

We can form linear combinations of matrices, elements of R3, elements of Hilbert spaces, generators of Lie algebras etc. etc. None of the things are numbers, but each of them have definitions for what “+” means between their elements.

• Ahhhh, I see. So, let's say that the random variable X is given by the sum of two random variables Y and Z, X = Y + Z. From what I understand, x1 (the first realization of X) would be given by y1 + z1? – Will Dec 5 '19 at 7:24
• @Will yes, that’s pretty much it – Dave Dec 5 '19 at 19:03