Question 2.6 Dice Rolls

If you roll a pair of fair dice, what is the probability of

  1. getting a sum of 1? 0%

  2. 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
  1. getting a sum of 12? 2.78%

Question 2.8 Poverty and language

  1. Are living below the poverty line and speaking a foreign language at home disjoint?

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.

  1. Draw a Venn diagram summarizing the variables and their associated probabilites
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])
  1. What percent of Americans live below the poverty line and only speak english at home?
Question28c <- .146-.042
Question28c
## [1] 0.104
  1. What percent of Americans live below the poverty line or speak a foreign language at home?
Question28d <- (.146-.042)+(.207-.042)
Question28d
## [1] 0.269
  1. What percent of Americans live above the poverty line and only speak English at home?
#Cannot Calculate Accurately because may not be independent factors
Question28e <- (1-.146)*(1-.207)
Question28e
## [1] 0.677222
  1. Is the event that someone lives below the poverty line independent of the event that the person speaks a foreign language at home?

No, because there are people that are in both categories, and one factor may influence the other.

Question 2.20 Assortive Mating

  1. What is the probability that a randomly chosen male respondent or his partner has blue eyes?
Blue_Eyes <- 78+23+13+19+11
Probabiliy_Blue_Eyes <- (Blue_Eyes/204)
Probabiliy_Blue_Eyes
## [1] 0.7058824
  1. What is the probability that a randomly chosen male respondent with blue eyes has a partner with blue eyes?
#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
  1. What is the probability that a randomly chosen male respondent with brown eyes has a partner with blue eyes? What about the probability of a randomly chosen male respondent with green eyes having a partner with blue eyes?
#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
  1. Does it appear that the eye colors of male respondents and their partners are independent? Explain your reasoning.

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.

Question 2.30 Books on a bookshelf

  1. Find the probability of drawing a hardcover book first then a paperback fiction book second when drawing without replacement.
Hardcover_First <- 28/95
Paperback_Second <- 67/94
Question230a <- Hardcover_First*Paperback_Second
Question230a
## [1] 0.2100784
  1. Determine the probability of drawing a fiction book first and then a hardcover book second, when drawing without replacement.
#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
  1. Calculate the probability of the scenario in part (b), except this time complete the calculations under the scenario where the first book is placed back on the bookcase before randomly drawing the second book.
#Process is independent
Fiction_First_c <- 72/95
Hardcover_Second_c <- 28/95
Question230c <- Fiction_First_c*Hardcover_Second_c
Question230c
## [1] 0.2233795
  1. The final answers to parts (b) and (c) are very similar. Explain why this is the case.

Because the probability is very similar when only adding back one book to the problem

Question 2.38 Baggage Fees

  1. Build a probability model, compute the average revenue per passenger, and compute the corresponding standard deviation.
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
  1. About how much revenue should the airline expect for a flight of 120 passengers? With what standard deviation? Note any assumptions you make and if you think they are justified.
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

Question 2.44 Income and Gender

  1. Describe the distribution of total personal income.

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.

  1. What is the probability that a randomly chosen US resident makes less than $50,000 per year?
fiftyk_or_less <- .022 + .047 + .158 + .183 + .212
fiftyk_or_less
## [1] 0.622
  1. What is the probability that a randomly chosen US resident makes less than $50,000 per year and is female? Note any assumptions you make.

Assuming that females and males would have a similar distribution of incomes

fiftyk_female <- fiftyk_or_less * .41
fiftyk_female
## [1] 0.25502
  1. The same data source indicates that 71.8% of females make less than $50,000 per year. Use this value to determine whether or not the assumption you made in part (c) is valid.

The assumption is not valid because more females make less than 50,000 a year than males do.