If you roll a pair of fair dice, what is the probability of
getting a sum of 1? 0%
getting a sum of 5? 11.11%
Potential_Sums <- c(12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2)
Times_Sum_Occurs <- c(1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1)
Probability <- Times_Sum_Occurs/sum(Times_Sum_Occurs)
df = data.frame(Potential_Sums, Probability)
df
## Potential_Sums Probability
## 1 12 0.02777778
## 2 11 0.05555556
## 3 10 0.08333333
## 4 9 0.11111111
## 5 8 0.13888889
## 6 7 0.16666667
## 7 6 0.13888889
## 8 5 0.11111111
## 9 4 0.08333333
## 10 3 0.05555556
## 11 2 0.02777778
Two outcomes are disjoint or mutually exclusive if they cannot both happen. Someone can live below the poverty line and speak a foreign language at home.
library(VennDiagram)
## Loading required package: grid
## Loading required package: futile.logger
grid.newpage()
draw.pairwise.venn(area1 = .146, area2 = .207, cross.area = .042, category = c("Live Below Poverty Line", "Speak Foreign Langauge at Home"))
## (polygon[GRID.polygon.1], polygon[GRID.polygon.2], polygon[GRID.polygon.3], polygon[GRID.polygon.4], text[GRID.text.5], text[GRID.text.6], text[GRID.text.7], text[GRID.text.8], text[GRID.text.9])
Question28c <- .146-.042
Question28c
## [1] 0.104
Question28d <- (.146-.042)+(.207-.042)
Question28d
## [1] 0.269
#Cannot Calculate Accurately because may not be independent factors
Question28e <- (1-.146)*(1-.207)
Question28e
## [1] 0.677222
No, because there are people that are in both categories, and one factor may influence the other.
Blue_Eyes <- 78+23+13+19+11
Probabiliy_Blue_Eyes <- (Blue_Eyes/204)
Probabiliy_Blue_Eyes
## [1] 0.7058824
#P(Partner Blue Eyes | Self Blue Eyes)
# = # partner blue eyes and self blue eyes / # self blue eyes
P_partnerblue_given_selfblue = (78/114)
P_partnerblue_given_selfblue
## [1] 0.6842105
#P(Partner Blue Eyes | Self Brown Eyes)
# = # partner blue eyes and self brown eyes / # self brown eyes
P_partnerblue_given_selfbrown = (19/54)
P_partnerblue_given_selfbrown
## [1] 0.3518519
#P(Partner Blue Eyes | Self Green Eyes)
# = # partner blue eyes and self green eyes / # self green eyes
P_partnerblue_given_selfgreen = (11/36)
P_partnerblue_given_selfgreen
## [1] 0.3055556
They are not independent because females with blue eyes are twice as likely to go out with males with blue eyes than with any other color.
Hardcover_First <- 28/95
Paperback_Second <- 67/94
Question230a <- Hardcover_First*Paperback_Second
Question230a
## [1] 0.2100784
#Process is not independent
# P(Fiction_First and Hardcover_Second) = P(Fiction_First | Hardcover_Second) * P(Hardcover_Second)
Fiction_First_b <- 72/95
Hardcover_Second_b <- 28/94
Question230b <- ((Fiction_First_b*Hardcover_Second_b)/Hardcover_Second_b)*(Hardcover_Second_b)
Question230b
## [1] 0.2257559
#Process is independent
Fiction_First_c <- 72/95
Hardcover_Second_c <- 28/95
Question230c <- Fiction_First_c*Hardcover_Second_c
Question230c
## [1] 0.2233795
Because the probability is very similar when only adding back one book to the problem
revenue <- c(0, 25, 35)
checked_bags <- c(0, 1, 2)
probability <- c(.54, .34, .12)
expected_value <- c(crossprod(probability, revenue))
value <- data.frame(checked_bags, probability, revenue)
value
## checked_bags probability revenue
## 1 0 0.54 0
## 2 1 0.34 25
## 3 2 0.12 35
expected_value
## [1] 12.7
variance <- c(crossprod(((value$revenue-expected_value)^2), value$probability))
standard_dev <- sqrt(variance)
standard_dev
## [1] 14.07871
revenue_120 <- c(0*120, 25*120, 35*120)
checked_bags_120 <- c(0, 1, 2)
probability_120 <- c(.54, .34, .12)
expected_value_120 <- c(crossprod(probability_120, revenue_120))
value_120 <- data.frame(checked_bags_120, probability_120, revenue_120)
value_120
## checked_bags_120 probability_120 revenue_120
## 1 0 0.54 0
## 2 1 0.34 3000
## 3 2 0.12 4200
expected_value_120
## [1] 1524
variance_120 <- c(crossprod(((value_120$revenue_120-expected_value_120)^2), value_120$probability_120))
standard_dev_120 <- sqrt(variance_120)
standard_dev_120
## [1] 1689.445
The distribution appears normal but slightly skewed to the left with the most people making an average amount but more making 100,000 or more than $1 to $9,999 or less.
fiftyk_or_less <- .022 + .047 + .158 + .183 + .212
fiftyk_or_less
## [1] 0.622
Assuming that females and males would have a similar distribution of incomes
fiftyk_female <- fiftyk_or_less * .41
fiftyk_female
## [1] 0.25502
The assumption is not valid because more females make less than 50,000 a year than males do.