ABSTRACT

This chapter provides examples of six simulations that illustrate a number of functions that are available in R. The simulations are intended for estimation of a probability. The examples of simulations are ordered from basic, simulating coin flips, to the complicated simulation in the deadly board game, while including some classic probability problems such as the Buffon needle problem. The chapter explains the use of R code in finding probabilities for an elevator problem, Monty Hall problem, and Chuck-A-Luck casino game. The simulations are illustrated using the replicate, sapply, and apply functions, along with other functions that generate random values.