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

a) getting a sum of 1?

Answer: The probablity of getting sum of 1 is Zeor. Because Minimum number with the pair of dice is 2.

b) getting a sum of 5?

Answer: Combinations are (1,4), (2,3), (3,2), (4,1). So probability of getting a sum of 5 is 4/36 = 1/9

c) getting a sum of 12?

Answer: Combinations are (6,6). So probability of getting a sum of 12 is 1/36

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.

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

Answer: No, because both may occur at the same time

b, Draw a Venn diagram summarizing the variables and their associated probabilities

library(VennDiagram)
## Loading required package: grid
## Loading required package: futile.logger
vennn <- draw.pairwise.venn(14.6, 20.7,cross.area=4.2, c("Poverty", "Non-English"), fill=c("red", "blue"), cat.dist=-0.08, ind=FALSE)
grid.draw(vennn)

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

print(paste((.146 - .042) * 100, "%" ))
## [1] "10.4 %"

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

print(paste((.146 + .207 - .042) * 100, "%" ))
## [1] "31.1 %"

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

print(paste((1 - (.146 + .207 - .042)) * 100, "%" ))
## [1] "68.9 %"

f, Is the event that someone lives below the poverty line independent of the event that the person speaks a foreign language at home?

print(paste((.207 * .146) * 100, "%" ))
## [1] "3.0222 %"

Answer: because 3.0222% < 4.2%, so poverty is not randomly associated with language.

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.

a, What is the probability that a randomly chosen male respondent or his partner has blue eyes?

(114 + 108)/204 - 78/204
## [1] 0.7058824

b, What is the probability that a randomly chosen male respondent with blue eyes has a partner with blue eyes?

78/204
## [1] 0.3823529

c, 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?

19/54
## [1] 0.3518519
11/36
## [1] 0.3055556

d, Does it appear that the eye colors of male respondents and their partners are independent?Explain your reasoning.

Answer: the eye colors of male respondents and their partners are NOT independent. Because P(blue male | blue female) = P(blue male) * P(blue female) (78/204) = (114/204) * (108/204). Since these are not equal The eye colors of male respondents and their partners are NOT independent

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.

a, Find the probability of drawing a hardcover book first then a paperback fiction book second when drawing without replacement.

(28/95) * (59/(95-1))
## [1] 0.1849944

b,Determine the probability of drawing a fiction book first and then a hardcover book second,when drawing without replacement.

(72/95) * (28/(95-1))
## [1] 0.2257559

c, 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

(72/95) * (28/95)
## [1] 0.2233795

d, The final ansewrs to parts (b) and (c) are very similar. Explain why this is the case.

Answer: The only difference is the replacement which simply changes the denominator of the second book selection by 1. Number of books on the bookcase (94 vs 95) has very little effect.

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.

a, Build a probability model, compute the average revenue per passenger, and compute the corresponding standard deviation.

prob <- c(0.54, 0.34, 0.12)
bag <- c(0, 1, 2)
fee <- c(0, 25, 25 + 35)
df_rev <- data.frame(prob, bag, fee)
df_rev$pf <- df_rev$prob * df_rev$fee
df_rev
##   prob bag fee  pf
## 1 0.54   0   0 0.0
## 2 0.34   1  25 8.5
## 3 0.12   2  60 7.2
avgRevPerPax <- sum(df_rev$pf)
avgRevPerPax
## [1] 15.7
df_rev$DiffMean <- df_rev$pf - avgRevPerPax
df_rev$DMSqr <- df_rev$DiffMean ^ 2
df_rev$DMSP  <- df_rev$DMSqr * df_rev$prob
df_rev
##   prob bag fee  pf DiffMean  DMSqr     DMSP
## 1 0.54   0   0 0.0    -15.7 246.49 133.1046
## 2 0.34   1  25 8.5     -7.2  51.84  17.6256
## 3 0.12   2  60 7.2     -8.5  72.25   8.6700
var <- sum(df_rev$DMSP)
sd <- sqrt(var)
sd
## [1] 12.62538

b, 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.

pax <- 120
avgFltRev <- avgRevPerPax * pax
avgFltRev
## [1] 1884
var1 <- (pax ^ 2) * var
sd1 <- sqrt(var1)
sd1
## [1] 1515.046

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.69

a, Describe the distribution of total personal income

income <- 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")

total <- c(2.2,4.7,15.8,18.3,21.2,13.9,5.8,8.4,9.7)

distribution <- data.frame(income, total)
distribution
##               income total
## 1       $1 to $9,999   2.2
## 2 $10,000 to $14,999   4.7
## 3 $15,000 to $24,999  15.8
## 4 $25,000 to $34,999  18.3
## 5 $35,000 to $49,999  21.2
## 6 $50,000 to $64,999  13.9
## 7 $65,000 to $74,999   5.8
## 8 $75,000 to $99,999   8.4
## 9   $100,000 or more   9.7
barplot(distribution$total, names.arg=income)

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

sum(distribution[1:5,2]/100)
## [1] 0.622

c, 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.

0.622 * 0.41
## [1] 0.25502

d, 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.

Answer: If 71.8% of females make less than $50,000 per year the the equation will be 0.718 = 0.622 * 0.41, which is not correct, so we can conclude that the assumption we made for step (c) is wrong. Withe the equation it looks like events are not independent.