Computing Chances

STAT 20: Introduction to Probability and Statistics

Agenda

  • Concept Questions
  • Break
  • Handout: PS 3.3a (computing probabilities)
  • Break
  • Two useful R functions
  • Digital worksheet: PS 3.3b (simulating probabilities)

Concept Questions

01:00

I have a box with 12 cards in it. Four of the cards are red, four are blue, and four are green. I shuffle the cards in the box, and draw one out at random. The outcome of the card being green and the outcome of the card being red are _____.

02:00

The Houston Astros beat the Philadelphia Phillies in the 2022 World Series. The winners in the World Series have to win a majority of 7 games, so the first team to win 4 games wins the series (best of 7). The Astros were heavily favored to win, so the outcome wasn’t really a suprise. Suppose we assumed that the probability that the Astros would have beaten the Phillies in any single game was estimated at 60%, independently of all the other games, what was the probability that the Astros would have won in a clean sweep?

(Clean sweep means that they won in the first 4 games - which didn’t happen, they won in 6 games.)

01:00

Suppose we assume, instead, that the probability that the Astros would have beaten the Phillies in any single game was 50%, independently of all the other games. In this case, was the probability that the series would have gone to 6 games higher than the probability that the series would have gone to 7 games, given that 5 games were played?

03:00

On each turn of a game, I toss a coin as many times as the number of spots I get when I roll a die. On a turn what is the probability that all my tosses land heads? Is it true that it is \(\left(\frac{1}{2}\right)^k\), where \(k\) is the number of spots from the die I just rolled? (Be careful! are you being asked for a conditional probability?)

03:00

A rare condition affects 0.2% of the population. A test for this condition is 99% accurate: this means that the probability that a person with the condition tests positive is 99% and the probability that a person without the condition tests negative is 99%. What is the probability that a person who tests positive has the condition?

Break

05:00

PS 3.3a (paper handout)

25:00

Two useful R functions

seq()


Creates a sequence of numbers that can be defined by their first and last number and the space between each number (or the total numbers in the sequence): seq(from, to, by)


Code Along

How can you use seq() to generate the following sequence: 1, 1.25, 1.5, 1.75, 2 and call it a?

01:00

sample()


Used to take a random sample of a vector with or without replacement: sample(x, size, replace = FALSE)

Code Along

How can you use sample() to create the following vector from a: 1.25, 1.25, 1.50.

a <- seq(from = 1, to = 2, by = .25)

When we want a specific sample, or want the same sample every time we run our code, we use the function set.seed(). This initializes R’s pseudorandom number generator, so that when you are running simulations or code that requires random sampling, you can reproduce your results.

Break

05:00

PS 3.3b (digital handout)

30:00