Prob1a : Rolling 2 fair Dices and getting sum of 1
answer: You will always be getting greater than 1
# require(dice)
#
# my.sum <- readline(prompt="The Sum You like to use: ")
# my.sum <- as.integer(my.sum)
# print(paste("You entered,", my.sum))
#
# two.dice <- function(){
# dice <- sample(1:6, size = 2, replace = TRUE)
# return(sum(dice))
# }
#
# s <-two.dice()
# s
# if(s==my.sum)
# {
# print(sprintf("The sum is %s", my.sum))
#
# prob = (my.sum-1)/36
#
# print(sprintf("The prob is %s", prob))
# }else
# {
# print(sprintf("The sum is %s", s))
#
# prob = (my.sum-1)/36
#
# print(sprintf("The prob is %s", prob))
# }
#
Prob 1b,c: Rolling 2 fair Dices and getting sum of 5 & sum of 12 using 100,000 repetition for “long run average”
1b, answer: For sum of 5, based on 100000 repittions, the prob of getting a sum of 5 is 0.11
1c, answer:
For sum of 12, based on 100000 repittions, the prob of getting a sum of 5 is 0.0269
## Loading required package: dice
## Loading required package: gtools
## sims
## 2 3 4 5 6 7 8 9 10
## 0.02753 0.05598 0.08414 0.11123 0.13803 0.16525 0.13986 0.11047 0.08431
## 11 12
## 0.05464 0.02856
Probability prob statment: School absences. Data collected at elementary schools in DeKalb County, GA suggest
that each year roughly 25% of students miss exactly one day of school, 15% miss 2 days, and 28%
miss 3 or more days due to sickness.
prob 2.1:
P(1)= 0.25 P(2)=0.15 P(>=3)=0.28
P(0)+P(1)+P(2)+P(>=3)=1.0 Therefore, P(0) = 1-0.25-0.15-0.28 = 0.32
Prob2.2: (b) What is the probability that a student chosen at random misses no more than one day?
P(1)+P(2) =0.32+0.25=0.57
Prob2.3: (c) What is the probability that a student chosen at random misses at least one day?
P(1)+P(2)+P(>=3)=0.25+0.15+0.28=0.68
Prob2.4: (d) If a parent has two kids at a DeKalb County elementary school, what is the probability that neither kid will miss any school? Note any assumption you must make to answer this question.
Let A be one of the kids and B be the other kid
P(A)and P(B)= P(0)XP(0)=0.32*0.32 = 0.1024
This assumes the two children getting sick (events) are independent
Prob2,5: (e) If a parent has two kids at a DeKalb County elementary school, what is the probability that both kids will miss some school, i.e. at least one day? Note any assumption you make.
From part C, P(at least one day missing)=0.68
P(A)and P(B)= P(at least 1 day missing)*P(at least 1 day missing)=0.4624
This assumes the two children getting sick (events) are independent
Prob 3:
P(excellent)=0.023+0.2099=0.2329 P(health coverage)=0.2099+0.3123+0.2410+0.0817+0.0289=0.8738 For Not mutually exclusive:
PP(excellent and health coverage) <> zero
P(excellent or health coverage)=P(excellent)+P(health coverage)-P(excellent and health coverage) = 0.8738
What is the probability that a randomly chosen individual has excellent health? 0.023+0.2099 =0.2329
What is the probability that a randomly chosen individual has excellent health given that he has health coverage? P(excellent and health coverage)=0.2099 P(coverage) = 0.8738
P(excellent|health coverage)=P(excellent and health coverage)/P(coverage) = 0.2099/0.8738= 0.2665
P(excellent and no coverage) = 0.0230 P(no coverage) = 0.1263
P(excellent|No health coverage)=P(excellent and no coverage)/P(no coverage)
= 0.0230/0.1263=0.1821
From part c: P(excellent|health coverage)=P(excellent and health coverage)/P(coverage) = 0.2099/0.8738= 0.266
P(health coverag|excellent)=P(excellent and health coverage)/P(excellent)
=0.2009/0.2329=0.8626
mat=matrix(c(.023, 0.0364, 0.0427, 0.0192, 0.0050,0.2099, 0.3123 ,0.2410 ,0.0817,0.0289), byrow=TRUE, nrow=2)
colnames(mat)=c("Excellent", "Very Good","Good", "Fair","Poor")
rownames(mat)=c("No Coverage","Coverage")
mat
## Excellent Very Good Good Fair Poor
## No Coverage 0.0230 0.0364 0.0427 0.0192 0.0050
## Coverage 0.2099 0.3123 0.2410 0.0817 0.0289
Prob 4: Exit poll conditional probablity
P(voted scott)= 0.53 P(against scott)=1-0.53=0.47 (degree|Scott’) = 0.44
P(scott|degree)=P(degree|scott)P(Scott)/(P(degree|scott)P(Scott)+(P(degree|scott’)*P(Scott’))
=(0.37)(0.53)/(0.37)(0.53)+(0.44)*(0.47)
=0.48672
Prob 5: (a) Find the probability of drawing a hardcover book first then a paperback fiction book second when drawing without replacement. (28/95) * (59/94) = .185
(72/95) * (28/94) = .2258
(72/95) * (28/95) = .2234
The probability with and without replacement is very small because the no. of fiction and nonfiction books very close. So the difference in chances of drawing a fiction hardcover vs. nonfiction harcover is relatively small
mymat2=matrix(c(13,59,15,8),nrow=2,byrow=TRUE)
colnames(mymat2)=c("hard","paper")
rownames(mymat2)=c("fiction","nonfiction")
mymat2
## hard paper
## fiction 13 59
## nonfiction 15 8
Prob 6: (a) Create a probability model and find Andy’s expected profit per game. For $2 dollar bet
P( 2 - 10) = 36 / 52 = 9 / 13 => $0 (No profit) P(J, Q, K) = 12 / 52 = 3 / 13 => $3 ($1 profit) P(Ace) = 4 / 52 = 1 / 13 => $5 ($3 Profit) P(Ace of Clubs) = 1 / 52 => $20 ($18 Profit)
P = (-2)(9/13) + 1(3/13) + 3(1/13) + 18(1/52) -1.3846 + 0.2308 + 0.2308 + 0.3462 Expected Earnings = -0.578
prob7: (a) An entire box of ice cream, plus 3 scoops from a second box is served at a party. How much ice cream do you expect to have been served at this party? What is the standard deviation of the amount of ice cream served?
48+3*2=54 ounces
For independent variables: Var1+var2 +var3 +..
Therefore, Var of 1 box + var of 3 scopes = 1 + 0.06253 The Std Dev = sqrt (1+ 30.0625) =1.089
"1 Box - 1 scoop = 48 - 2=46
same reasoning as previous part, adding variances together: sqrt(1 + .0625)=1.038
Since each scoop is randomly sampled, whether we add or subtract from the pile, the variance increases; more variability has been introduced into the system.
mymat3=matrix(c(48,1,1, 2,.25,.0625), nrow=2, byrow=TRUE)
colnames(mymat3)=c("mean", "SD", "Var")
rownames(mymat3)=c("X, In Box","Y, Scooped")
mymat3
## mean SD Var
## X, In Box 48 1.00 1.0000
## Y, Scooped 2 0.25 0.0625