Chapter 13 Simulations

I decided to put this unit in here because I want to know how to simulate data for both my RMS classes and this class if I want to give you random stuff to do. So, here we go.


  • use the sample function when working with nominal or ordinal data to…..take a sample…..of a defined dataset

  • use replicate to run your sample a specific number of times

  • run a Monte Carlo simulation with 10k samples

  • graph the outcomes of your simulations with ggplot

  • use rnorm to simulate continuous data that fall on a normal distribution

  • Simulate a dataset of a continuous variable with 5k observations

  • use the rep function to repeat a number or character string x amount of times

  • create datasets from objects that have the same number of rows using tibble