Lab 2C
Directions: Follow along with the slides, completing
the questions in blue on your
computer, and answering the questions in red in your
journal.
Space, Click, Right Arrow or swipe left to move to
the next slide.
39/100
, 0.39
or
39%
.R
.rap
songs using the
repeat rep()
function.rap
songs.rock
songs in our playlist of 100.c()
in
R
.songs
into the console and hit
enter to see your individual songs."rap"
songs you drew from the
10.
R
to do()
multiple repetitions for us.
do
the
sample
code from the previous slide 50
times:Recall that we need to store our results to be able to perform analysis.
Assign the 50 selected songs the name
draws
and then View
your file.
What is the variable name?
R
defaulted to naming the variable based on the
function used. You may use the data cleaning skills you learned in lab
1F to rename
the variable if you wish.Fill in the blank below to tally
how often each genre was selected:
"rap"
songs for your
50 draws and find out if the range for your class’s proportions
is bigger or smaller than when we drew 10 songs."rap"
.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()
.## [1] "rap"
set.seed
then redo the simulation of 50 songs.
set.seed(___)
just before
simulating the 50 draws.set.seed(___)
should be the same number
for both partners."rap"
songs.set.seed(___)
.
set.seed
that give different
answers?If we select a student at random, what is the probability that this student is one of those who went to the movies last Friday?
set.seed(123)
in your code
before you do
500 repeated samples.