In: Statistics and Probability
6.12.
Use R to pick 5 cards from a deck of 52. Did you get a pair or better? Repeat until you do. How long did it take?
6.9.
How much area is to the right of 1.5 for a normal (0,2)?
Solve using R software
Part 6.12
First we create a vector in R that resembles a deck of 52 cards.
R-code:
suits <- rep(c("Club", "Spade", "Diamond",
"Hearts"),each=13)
value <- rep(c("Ace", "Two", "Three", "Four", "Five", "Six",
"Seven", "Eight", "Nine", "Ten", "Jack", "Queen",
"King"),times=4)
cards <- paste(value,"of",suits)
An example value of 'cards' vector is "Queen of Hearts"
Now we will use the 'sample' function in R to simulate a sample draw. We say it is a pair, when two same value come up in the sample. We use the sample function without replacement option.
R-code:
sample(cards, size = 5,replace = FALSE)
For my simulation it took 2 tries for me to get a pair.
Part 6.9:
Let us say X is a random variable, such that
Area to the right of 1.5 means, we have to find
Using 'pnorm' function of R, we get
R-Code:
pnorm(1.5, mean=0, sd=2,lower.tail=F)
So the area to right of 1.5 for a N(0,2) is 0.2266274.