Directions: Follow along with the slides and answer the questions in red font in your journal.
rapsongs, we'll use the repeat (
rap <- rep("rap", times = 39)
songs <- __(rap, ____)
songsinto the console and hit enter to see your individual songs.
sample(songs, size = 1, replace = TRUE)
"rap"songs you drew from the 10.
do()multiple repetitions for us.
samplecode from the previous slide 50 times run:
do(___) * sample(___, ___ = ___, ___ = ___)
draws. Then fill in the blank below to tally how often each genre was selected:
tally(~___, data = draws)
"rap"songs for your 50 draws and find out if the range for your class' proportions is bigger or smaller than when we drew 10 songs.
When using simulations to estimate probabilities, using a large number of repeats is better because the estimates have less variability and so we can be confident we're closer to the actual value.
set.seed(123) sample(songs, size = 1, replace = TRUE)
set.seedthen redo the simulation of 50 songs.
set.seed(___)just before simulating the 50 draws.
set.seed(___)should be the same number for both partners.
set.seedthat give different answers?
If we select a student at random, what is the probability that this student is one of the one's who went to the movies last Friday?
set.seed(123)in your code before you
do500 repeated samples.