# Meaning of iid random variables (plural)

1. Dec 7, 2008

### Sumanta

Hello,

Can somebody pls explain to me what is the difference between generating random numbers and random variables. The confusion is mainly because most of the time texts write that for n (iid) random variables in the limiting sense reaches the expectation of the first random variable.

I am trying to use R and used the function dbinom(40:60, 100, 0.5). Now the numbers that are generated are what? Are all the numbers random variables.

- Thanks.

Sumanta

2. Dec 8, 2008

### HallsofIvy

Staff Emeritus
Well, first, numbers are not variables! A variable means a quantity that may change. A number never changes.

The difficulty may be the misleading term "random number". A single number is NEVER "random". What we mean when we talk about random numbers are randomly selected numbers.

I have no idea what "dbinom(40:60, 100, 0.5)" means or what it returns. What is its definition?

3. Dec 8, 2008

### mathman

The term "random numbers" refers to a special class of random variables, namely those which have a distribution uniform in the interval [0,1]. In other words with a probability density function f(x), where f(x) = 0 outside the interval [0,1] and f(x) = 1 inside [0,1].

The term is widely used in Monte Carlo computer simulations, where "psuedo-random numbers" refer to machine generated sequences of numbers which look like (statistically) random numbers.

4. Dec 19, 2008

The command " dbinom(40:60, 100, 0.5)" will return a string containing $$P(X = i)$$ for each $$i \in 40, 41, \dots, 60$$, calculated using the binomial distribution with $$n = 100, p = 0.5$$. These are not random numbers, they are probabilities.

You can use R to generate random numbers from any distribution. Picking on the binomial distribution (since you referred to it), consider the following setup.

* We are interested generating a random sample of values from a binomial distribution with n = 100, p = .5
* We want to generate a random sample of 25 values from this distribution.

Here is the appropriate R command (I'm storing the numbers in the R variable named a)

a<-rbinom(25,100,.5)

Here is the result I just obtained from my copy of R

44 57 47 44 41 52 47 46 45 51 52 56 48 46 53 54 40 43 54 56 42 48 43 47 54

What might these represent? Think of flipping a fair coin 100 times, and counting the number of heads that occur. These numbers represent results we might see from 25 repetitions of this experiment: the first set of flips gives 44 Heads, the second set gives 57 heads, and so on. THESE are random numbers generated from this particular binomial distribution.

As an incredibly non-mathematical description of random variables, think this way: a random variable is the IDEA behind the numerical results of an experiment. In my coin experiment, the random variable is "the number of heads that occur when a fair coin is flipped 100 times". The 25 numbers generated represent the act of measuring this random variable 25 times.

Does this help?