# How does the concept of a random variable come into play when sampling?

I have an (intuitive) understanding of what a random variable and a sample are. However, I am not sure how a random variable is related to a sample.

Suppose we have a population of people. Sampling from that population means to take a subset (which we call "sample") of those people.

What can be considered a random variable while sampling, once we have a sample and when we take an element from this sample? How many random variables are involved in the process of sampling or once we have the sample?

I would appreciate seeing many real-world examples of the sampling process where you explain which and how many random variables are involved.

Notes

1. This question is different from What is the difference between random variable and random sample?.

2. Please, avoid defining what a random variable and sample are. I already know what they are and, if I forget the definitions, I can look them up again!

• Tell us how you count random variables and then we can tell you the answer! For instance, when sampling tickets from a box, suppose each ticket has two values written on it, labeled $X_1$ and $X_2$. From your perspective, would that be two random variables or a single random variable $(X_1,X_2)$? – whuber Mar 21 '18 at 13:30
• @whuber That's also what I am asking. We could have a Bernoulli (so that to represent the two different values on the ticket) r.v. for each ticket in the box. However, if the values on tickets are not important, I am not sure if it's a good idea to model each ticket as an r.v. In that case, how would we model the sampling process? – nbro Mar 21 '18 at 14:20
• Despite your request to not define random variables, your question and your comments suggest you do not have the same understanding of a random variable as many others do. It might help to state what you believe it to be. – whuber Mar 21 '18 at 14:47
• @whuber A r.v. is a measurable function which maps outcomes to probabilities. Why would this definition be inconsistent with my comments? – nbro Mar 21 '18 at 14:48
• You give a mathematical definition, but the concern in your question is how the mathematics is used to model sampling. Your comment about being unsure about "model[ing] each ticket as an r.v." is inconsistent with a correct application of the math. The tickets model the outcomes; the measurable function writes numbers on the tickets. Thus, values on the tickets are the opposite of "not important": they are crucial. The sampling process consists of pulling a ticket out of the box. – whuber Mar 21 '18 at 14:53

Let us take a human population of $N$ persons. Among that population $N_0$ persons have blue eyes and let's call $p=\dfrac{N_0}{N}$ the proportion of blue-eyes persons.

If you pick « randomly » somebody in that population and associate the value 1 if that person has blue eyes and 0 otherwise, you are constructing a real random variable $X$ because il has uncertain issue.

To make it simple $X$ takes two values and $P(X=1)=p$, $P(X=0)=1-p$ ($P$ being a measure of probability, the existence/construction of such a probability is a big step, not necessary here, where the intuition makes it understable/acceptable).

For your sample, the $i$-th person picked is associated with a random variable $X_i$. All the $X_i$ follow the same law (of probability) called $B(p)$ (Bernoulli) : 1 with probability $p$, 0 with probability $1-p$).

So if you have a $n$-sample, you have a $n$ random variables associated and what you handle in your real sample are issues of that variables: $X_1(\omega)=0$, $X_2(\omega)=1$, $\dots$, $X_n(\omega)=0$ (for example)

Then the theory of probabilities give you some information like $\dfrac{\sum\limits_{i=1}^nX_i}{n}\to p$ in a sense if the variables are independant which in that case would be picking each time a new personn in the whole population, otherwise they are dependant but if the $n$-sample picked is small in comparison with $N$ then you can approximate with independance.

To finish you get : $x_1,\dots x_n$ in your sample and the probability model consider it as $X_1(\omega),X_2(\omega),\dots,X_n(\omega)$ where the $X_i$ follow the same law of probability and are most of the time mutually independants (or so-approximated)

• Why do we associate one r.v. (among $n$ r.v.s $X_i$, for $i=1,\dots, n$) to each of the elements of the sample? Why not just somehow associating one (maybe differently defined?) r.v. to the whole sample? – nbro Mar 19 '18 at 13:47
• each choice of element of your sample is made independantly of the others, the results are thus independant and each is associated with a RV. You can associate a RV to the whole sample but it is of the form $(X_1,X_2,\dots,X_n)$ a $n$-uple of real RV, it doesn't change anything. You have result – Robien1 Mar 19 '18 at 16:05