#54 red marbles, 9 white marbles, and 75 blue marbles
TM = 54 + 9 + 75
#Total Marbles
TM
## [1] 138
#Probability its red or blue
round( ((54/TM) * (75/TM)),4)
## [1] 0.2127
#Total number of balls :
TB = 19+20+24+17
TB
## [1] 80
#Number of red balls = 20
RB = 20
#Probability of getting a red ball:
RB/TB
## [1] 0.25
m <- c(81, 116, 215, 130, 129)
f <- c(228, 79, 252, 97, 72)
class <- c("Apartment", "Dorm", "With Parent(s)", "Sorority/Fraternity House", "Other")
df <- data.frame(class, m, f)
names(df) <- c("Class", "Males", "Females")
df
## Class Males Females
## 1 Apartment 81 228
## 2 Dorm 116 79
## 3 With Parent(s) 215 252
## 4 Sorority/Fraternity House 130 97
## 5 Other 129 72
#Probability that a customer is not Male and does not live with their parents
# Using Compliment rule
#Number of males living with parents =
MP = 215
#Total males and females
TMF = sum(df$Males) + sum(df$Females)
PE= MP/TMF
#The compliment of that event will be People that are not Male and does not live with their parents.
1-PE
## [1] 0.8463188
Determine if the following events are independent. Going to the gym. Losing weight.
Answer: A) Dependent B) Independent
ANS: Yes the the events are independent. example: Suppose we have two person A and B. Person A goes daily to gym whereas Person B goes only 2 days a week. Its independent of each person’s workout time and several other parameters.
A veggie wrap at City Subs is composed of 3 different vegetables and 3 different condiments wrapped up in a tortilla. If there are 8 vegetables, 7 condiments, and 3 types of tortilla available, how many different veggie wraps can be made?
\[ Total different veggie wraps = (Selecting 3 vegetable out of 8)*(selecting 3 condiments out of 7)*(select 1 tortilla out of 3)\]
choose(8,3) * choose(7,3) * choose(3,1)
## [1] 5880
Determine if the following events are independent. Jeff runs out of gas on the way to work. Liz watches the evening news.
Answer: A) Dependent B) Independent
The events could be Dependent provided there is a connecting relation between two events.
The newly elected president needs to decide the remaining 8 spots available in the cabinet he/she is appointing. If there are 14 eligible candidates for these positions (where rank matters), how many different ways can the members of the cabinet be appointed?
# 14 eligible candidates
# 8 spots available
# Number of ways members can be appointed is:
choose(14,8)
## [1] 3003
ANS: Total = 9 Red + 4 Orange + 9 Green =22
4 is with drawn out of 22 = 22C4 ways
Select 4 jelly beans in a way that there are 0 red and 3 green and 1 orange.
(choose(9,3) * choose(4,1)) / choose(22,4)
## [1] 0.04593301
factorial(11) / factorial(7)
## [1] 7920
Describe the complement of the given event. 67% of subscribers to a fitness magazine are over the age of 34.
34 % of subscribers are below age 34.
If you throw exactly three heads in four tosses of a coin you win $97. If not, you pay me $30.
Step 1. Find the expected value of the proposition. Round your answer to two decimal places.
ANS: 3 heads in 4 tosses = \[(1/2)^3 =1/8 \] Probability of win \[ $97 = 1/8 \] Probability of lose \[ $30 =1-1/8 =7/8 \] Expected value of the proposition
( (1/8) * 97) + ( (7/8)*(-30))
## [1] -14.125
Step 2. If you played this game 559 times how much would you expect to win or lose? (Losses must be entered as negative.)
#Playing this game 559 times
559 * (-14.25)
## [1] -7965.75
Step 1. Find the expected value of the proposition. Round your answer to two decimal places.
#Expected value. Using binomial
pwin<-pbinom(4,size=9, prob=0.5)
pwin
## [1] 0.5
expval<-round(23*pwin - 26*(1-pwin))
expval
## [1] -2
Step 2. If you played this game 994 times how much would you expect to win or lose? (Losses must be entered as negative.)
# Playing 994 times
# Lose is:
994 * expval
## [1] -1988
L=Liar, D=Detected as Liar
\[ P(L|D) = P(D \cap L)/P(D) = P(D|L)P(L) / ( P(D|L)P(L) + P(D|L`)P(L`) ) \] \[ 0.59*0.2 / ( 0.59*0.2 + 0.1*0.8) \]
0.59*0.2 / ( 0.59*0.2 + 0.1*0.8)
## [1] 0.5959596
\[ P(L`|D`) = P(D' \cap L)/P(D') = P(D`|L`)P(L`) / ( P(D|L)P(L) + P(D`|L`)P(L`) ) \] \[ 0.9*0.8 / ( (1 - 0.59)*0.2 + 0.9*0.8) \]
0.9*0.8 / ( (1 - 0.59)*0.2 + 0.9*0.8)
## [1] 0.8977556
\[ P(L) + P(L`|D) \]
\[ P(L`|D) = P(D \cap L`) / P( D) \]
\[ P(D|L`) P(X`) / P(D|X)P(X) + P(D|L`) P(X`) \]
B = 0.1*0.8 / ( (0.59*0.2) +( 0.1*0.8))
0.2 + B
## [1] 0.6040404