Generating the Bernoulli random variable is very easy and is better than actually tossing a coin many times. This video illustrates Exercise 2.1 from my book: how to use Excel RAND() and IF functions to simulate the coin in Excel

Simulation steps

RAND() (with empty parentheses) is the Excel function to generate a uniformly distributed random variable on the interval . If you enter the command =RAND() in two different cells, the generated variables will be independent. The generated values will be recalculated each time you change the spreadsheet, unless the Recalculate option is off.

The IF function has three arguments. The first argument is a condition. If the condition is satisfied, the IF function supplies the second argument. If not, the third argument is produced. For example, the command =IF(RAND()>0.3,1,0) simulates an unfair coin: the value 1 is taken 70% of the time.

The RAND() command is also used to generate normally distributed variables. A similar construction allows one to simulate any random variable with an invertible cumulative distribution function, see Exercise 7.6 in my book.

[…] of elementary statistics don't know that all simulation can be done in Excel. See examples: Exercise 2.1, Exercise 2.2, Exercise 2.3, Exercise 2.4, Example 2.2, and this post about active […]

[…] of elementary statistics don't know that all simulation can be done in Excel. See examples: Exercise 2.1, Exercise 2.2, Exercise 2.3, Exercise 2.4, Example 2.2, and this post about active […]

[…] 1; it has jumps at points that have a positive probability attached. We illustrate this using a Bernoulli variable such that […]