Graded: 2.6, 2.8, 2.20, 2.30, 2.38, 2.44

2.6 Dice rolls. If you roll a pair of fair dice, what is the probability of

  1. getting a sum of 1?

A pair of dice will only sum 2-12. The porobability of a sum of 1 is 0.

  1. getting a sum of 5?

There are 36 total possible outcomes from rolling a pair of dice Out of those 36 a sum of 5 is possible with the following combinations: {(1,4), (2,3), (3,2), (4,1)} The probability is 4/36 = 1/9

  1. getting a sum of 12?

12 = {(6,6),(6,6)} The probability of rolling a sum of 2 with a pair of dice is 2/36 = 1/18

2.8 Poverty and language. The American Community Survey is an ongoing survey that provides data every year to give communities the current information they need to plan investments and services. The 2010 American Community Survey estimates that 14.6% of Americans live below the poverty line, 20.7% speak a language other than English (foreign language) at home, and 4.2% fall into both categories

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

No, the description states that 4.2% fall into both categories, meaning they are not disjoint.

  1. Draw a Venn diagram summarizing the variables and their associated probabilities.
library(VennDiagram)
## Loading required package: grid
## Loading required package: futile.logger
library(grid)
library(futile.logger)
library(grid)
library(futile.logger)
library(VennDiagram)
venn.plot <- draw.pairwise.venn(area1 = 14.6, area2 = 20.7, cross.area = 4.2, category = c("Poverty","Foreign Lang"), scaled = TRUE)

grid.newpage()
grid.draw(venn.plot)

  1. What percent of Americans live below the poverty line and only speak English at home?

10.4%

  1. What percent of Americans live below the poverty line or speak a foreign language at home?

31.1%

  1. What percent of Americans live above the poverty line and only speak English at home?

68.9%

  1. Is the event that someone lives below the poverty line independent of the event that the person speaks a foreign language at home?
prob_PL <- .146
prob_FL <- 0.207
prob_both <- 0.042

# Multiplicative rule
independent <- (prob_PL*prob_FL == prob_both)
independent
## [1] FALSE

FALSE

2.20 Assortative mating. Assortative mating is a nonrandom mating pattern where individuals with similar genotypes and/or phenotypes mate with one another more frequently than what would be expected under a random mating pattern. Researchers studying this topic collected data on eye colors of 204 Scandinavian men and their female partners. The table below summarizes the results. For simplicity, we only include heterosexual relationships in this exercise.

r1 <- c(78,23,13,114)
r2 <- c(19,23,12,54)
r3 <- c(11,9,16,36)
totals <- c(108,55,41,204)
eye_color_table <- t(data.frame(r1,r2,r3,totals))
colnames(eye_color_table) <- c("Blue (Partner)", "Brown (Partner)", "Green (Partner)", "Total (Partner)")
rownames(eye_color_table) <- c("Blue (male)", "Brown (male)", "Green (male)", "Total (male)")

eye_color_table
##              Blue (Partner) Brown (Partner) Green (Partner)
## Blue (male)              78              23              13
## Brown (male)             19              23              12
## Green (male)             11               9              16
## Total (male)            108              55              41
##              Total (Partner)
## Blue (male)              114
## Brown (male)              54
## Green (male)              36
## Total (male)             204
  1. What is the probability that a randomly chosen male respondent or his partner has blue eyes?

= P(blue(male)) + P(Blue(Partner)) - P(blue(male) and blue(partner))

prob_couple_blue <- (eye_color_table["Blue (male)", "Total (Partner)"] + eye_color_table["Total (male)", "Blue (Partner)"] - eye_color_table["Blue (male)","Blue (Partner)"])/204
prob_couple_blue
## [1] 0.7058824
  1. What is the probability that a randomly chosen male respondent with blue eyes has a partner with blue eyes?

= P(Blue (male) and Blue (Partner)) / P(Blue (Partner))

prob_both_blue <- eye_color_table["Blue (male)", "Blue (Partner)"]/eye_color_table["Blue (male)", "Total (Partner)"]
prob_both_blue
## [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(Blue (Partner) | Browne (male))

brown_blue <- eye_color_table["Brown (male)", "Blue (Partner)"]/eye_color_table["Brown (male)", "Total (Partner)"]
brown_blue
## [1] 0.3518519

= P(Blue (Partner) | Green (male))

green_blue <- eye_color_table["Green (male)", "Blue (Partner)"]/eye_color_table["Green (male)", "Total (Partner)"]
green_blue
## [1] 0.3055556
  1. Does it appear that the eye colors of male respondents and their partners are independent? Explain your reasoning.

Check if P(Blue (Partner | Blue (male))) = P(Blue (Partner))

idependent <- (eye_color_table["Blue (male)", "Blue (Partner)"] / eye_color_table["Blue (male)", "Total (Partner)"]) == (eye_color_table["Total (male)", "Blue (Partner)"] / 204)
independent
## [1] FALSE

FALSE

2.30 Books on a bookshelf. The table below shows the distribution of books on a bookcase based on whether they are nonfiction or fiction and hardcover or paperback.

fiction <- c(13,59,72)
nonfiction <- c(15,8,23)
totalformat <- c(28,67,95)

book_df <- t(data.frame(fiction, nonfiction, totalformat))
colnames(book_df) <- c("Hardcover", "Paperback", "Total Types")
book_df
##             Hardcover Paperback Total Types
## fiction            13        59          72
## nonfiction         15         8          23
## totalformat        28        67          95
  1. Find the probability of drawing a hardcover book first then a paperback fiction book second when drawing without replacement.

P(Hardcover) * P(fiction and paperback)

prob_a <- (book_df["totalformat", "Hardcover"]/95) * (book_df["fiction", "Paperback"])/94
prob_a
## [1] 0.1849944
  1. Determine the probability of drawing a fiction book first and then a hardcover book second, when drawing without replacement.

There are 2 outcomes for drawing a fiction book first, either paperback or hardcover. If we draw paper back, the oddds of drawing a hardcover book next are simply 28/94. However, if we draw a hardcover fiction book, the odds of drawing a hardcover book next are now 27/94.

prob_b <- (book_df["fiction", "Paperback"]/95) * (book_df["totalformat", "Hardcover"])/94 + (book_df["fiction", "Hardcover"]/95)*(book_df["totalformat", "Hardcover"] - 1)/94
prob_b
## [1] 0.2243001
  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.

In this case, we place the book back so we now do not have to worry about the case where a hardcover fiction book is selected first and then affecting the odds of a hardcover book being selected next.

prob_c <- (book_df["fiction", "Total Types"]/95) * (book_df["totalformat", "Hardcover"])/95
prob_c
## [1] 0.2233795
  1. The final answers to parts (b) and (c) are very similar. Explain why this is the case.

The explanations are written prior to the code. In (b), we must worry about 2 cases i) fiction is paperback, which does not affect lower the total number of hardcover books availible to be selected in the second event, and ii) the case where the fiction book that is selected first is a hardcover, which then lowers the number of hardcover books availible for event number 2. In (c), we allow for replacement which eliminates the need to worry about selecting a hardover fiction book in the first event causing the second event to lower in probability.

2.38 Baggage fees. An airline charges the following baggage fees: $25 for the first bag and $35 for the second. Suppose 54% of passengers have no checked luggage, 34% have one piece of checked luggage and 12% have two pieces. We suppose a negligible portion of people check more than two bags.

  1. Build a probability model, compute the average revenue per passenger, and compute the corresponding standard deviation.
passengers = 1
revenue <- .34*passengers*25 + (.12*passengers*25 + .12*passengers*35) 
avg_rev_per_pass <- .34*25 + .12*25 + .12*35
avg_rev_per_pass
## [1] 15.7
# 60 is because of the 12% of customer paying for 2 bags, 25+35 = $60
std_dev <- sqrt(.54*(0-15.7)^2 + .34*(25-15.7)^2 + .12*(60-15.7)^2)
std_dev
## [1] 19.95019
  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.

standard deviation will be the same as ii) or (a), $19.95

passengers = 120
revenue <- .34*passengers*25 + (.12*passengers*25 + .12*passengers*35) 
revenue
## [1] 1884

2.44 Income and gender. The relative frequency table below displays the distribution of annual total personal income (in 2009 inflation-adjusted dollars) for a representative sample of 96,420,486 Americans. These data come from the American Community Survey for 2005-2009. This sample is comprised of 59% males and 41% females.

( a) Describe the distribution of total personal income.

The distribution seems pretty normal. The right end down have a high nunber of Americans making 100k compared to those making less than 10k. Can even be considered bimodal

library(ggplot2)
groups <- c(.022, .047, .158, .183, .212, .139, .058, .084, .097)
totals_per_group <- 96420486*groups
name_groups <- c("$1 to $9,999", "$10,000 to $14,999","$15,000 to $24,999", "$25,000 to $34,999", "$35,000 to $49,999", "$50,000 to $64,999", "$65,000 to $74,999", "$75,000 to $99,999", "$100,000 or more")

table <- data.frame(name_groups,totals_per_group)
table
##          name_groups totals_per_group
## 1       $1 to $9,999          2121251
## 2 $10,000 to $14,999          4531763
## 3 $15,000 to $24,999         15234437
## 4 $25,000 to $34,999         17644949
## 5 $35,000 to $49,999         20441143
## 6 $50,000 to $64,999         13402448
## 7 $65,000 to $74,999          5592388
## 8 $75,000 to $99,999          8099321
## 9   $100,000 or more          9352787
barplot(totals_per_group, xlab = "Different income ranges")

  1. What is the probability that a randomly chosen US resident makes less than $50,000 per year?

This is the sum of the first 5 categories = .022 + .047 + .158 + .183 + .212 = 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.

We assume that females are paid equally to men, so the probability = 0.622 * .41 = .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 in (c) is incorrect based off of the data sources