> Home > Statistics Notes > Probability > Sample Mean as a Random Variable

## The Sample Mean as a random variable

If I just have some data set, I can certainly utilize the sample mean as a summary of the data. It provides useful information in its own right, and it need not be interpreted in the light of a probability model.
But often we do wish to think of the sample mean as a random variable. If I take a certain number of random variables and average them, then this average is also a random variable. It is a random variable, and it has its own distribution.
Exercise:
We're going to generate 10 binomials with N=51 and p=0.03, and average them. In fact we're going to do this several times, and observe the variability in the values. Because each of the 10 random variables we generate is random, the average of them is also random and will exhibit fluctuation. Remember, never enter the prompt symbols which may be > or +, depending on whether the computer is expecting a new command or the continuation of an old one.
 ` > ` ` xmeans<-1:20` ` > ` ` for (j in 1:length(x)) {` ` + ` `   xmeans[i] <- mean(rbinom(10,size=51,prob=0.03))` ` + ` ` }` ` > ` ` xmeans`

Let's try this again. Except now we'll draw 100 binomials and average them all:
``` > xmeans2<-1:20 > for (j in 1:length(x)) { + xmeans2[j] <- mean(rbinom(100,size=51,prob=0.03)) + } > xmeans2 ```
There is much less variability in the means that come from larger samples. There is much more that will be said about this sort of thing.

On to more on expectation values.