Dice rolls. (3.6, p. 92) If you roll a pair of fair dice, what is the probability of

  1. getting a sum of 1?
  2. getting a sum of 5?
  3. getting a sum of 12?
diceSides <- 6
twoDice <- matrix(nrow = diceSides, ncol = diceSides)
for (die1 in 1:diceSides) {
  for (die2 in 1:diceSides) {
    twoDice[die1, die2] = die1 + die2
  }
}
outcomes <- diceSides * diceSides
glue("(a) P(die1 + die2 == 1) is {round(sum(twoDice == 1) / outcomes, 3)}")
## (a) P(die1 + die2 == 1) is 0
glue("(b) P(die1 + die2 == 5) is {round(sum(twoDice == 5) / outcomes, 3)}")
## (b) P(die1 + die2 == 5) is 0.111
glue("(c) P(die1 + die2 == 12) is {round(sum(twoDice == 12) / outcomes, 3)}")
## (c) P(die1 + die2 == 12) is 0.028

Poverty and language. (3.8, p. 93) 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?
  2. Draw a Venn diagram summarizing the variables and their associated probabilities.
  3. What percent of Americans live below the poverty line and only speak English at home?
  4. What percent of Americans live below the poverty line or speak a foreign language at home?
  5. What percent of Americans live above the poverty line and only speak English at home?
  6. Is the event that someone lives below the poverty line independent of the event that the person speaks a foreign language at home?
print("(a) They aren't disjoint, because some people fall into both groups.")
## [1] "(a) They aren't disjoint, because some people fall into both groups."
poverty <- .146
language <- .207
overlap <- .042

grid.newpage()
v <-draw.pairwise.venn(area1 = poverty,                       
                   area2 = language,
                   cross.area = overlap,
                   fill = c('green', 'blue'),
                   category = c('poverty', 'foreign \nlanguage'),
                   )

glue("(c) {100 * (poverty - overlap)}%")
## (c) 10.4%
glue("(d) {100 * (language + poverty - overlap)}%")
## (d) 31.1%
glue("(e) {100 * (1 - poverty - language + overlap)}%")
## (e) 68.9%
glue("(f) The probability of speaking a foreign language at home is {language}.
     If you live below the poverty line, the probability that you speak a
     foreign language at home is {round(overlap / poverty, 3)}.  So the two events are
     not independent.")
## (f) The probability of speaking a foreign language at home is 0.207.
## If you live below the poverty line, the probability that you speak a
## foreign language at home is 0.288.  So the two events are
## not independent.

Assortative mating. (3.18, p. 111) 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.

  1. What is the probability that a randomly chosen male respondent or his partner has blue eyes?
(108 + 114 - 78) / 204
## [1] 0.7058824
  1. What is the probability that a randomly chosen male respondent with blue eyes has a partner with blue eyes?
78 / 114
## [1] 0.6842105
  1. Whatistheprobabilitythatarandomlychosenmalerespondentwithbrowneyeshasapartner 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
  1. Does it appear that the eye colors of male respondents and their partners are independent? Explain your reasoning.
glue("The proportion of female partners that has blue eyes is
    {round(108 / 204, 3)}, but if you know the color of the male partner's 
    eyes, the female blue proportions go as high as .684 (male blue)
    or as low as .305 (male green).  So no, they don't appear independent.")
## The proportion of female partners that has blue eyes is
## 0.529, but if you know the color of the male partner's 
## eyes, the female blue proportions go as high as .684 (male blue)
## or as low as .305 (male green).  So no, they don't appear independent.

Books on a bookshelf. (3.26, p. 114) The table below shows the distribution of books on a bookcase based on whether they are nonfiction or fiction and hardcover or paperback.

  1. Find the probability of drawing a hardcover book first then a paperback fiction book second when drawing without replacement.
(28 / 95) * (59 / 94)
## [1] 0.1849944
  1. Determine the probability of drawing a fiction book first and then a hardcover book second, when drawing without replacement.
fiction <- (72 / 95)
hard_if_hard_drawn_first <- (13 / 72) * (27 / 94)
hard_if_paper_drawn_first <- (59 / 72) * (28 / 94)
fiction * (hard_if_hard_drawn_first + hard_if_paper_drawn_first)
## [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.
(72 / 95) * (28 / 95)
## [1] 0.2233795
  1. The final answers to parts (b) and (c) are very similar. Explain why this is the case.
glue("The first condition is the same in both cases.  You drew a fiction book
     off the shelf.  The probability of that fiction book being a paperback is 
     {round(59 / 72, 3)}.  The overall proportion of paperbacks is 
     {round(67 / 95, 3)}, which is close enough that for the most part
     you don't affect your chances much of drawing a hardcover on your second
     draw, if you put the book back (although since the odds are slightly
     higher that it's a paperback once you know it's fiction, you're better 
     off not replacing it, if you want to draw a hardcover next).  Also
     important is the fact that 28 out of 95 books are hardcovers, so even
     if most fiction books were hardcovers instead of paperbacks, the 
     probability of drawing a hardcover after a fiction book would change by
     less than 1/28 due to your choice of replacing or not after the first draw.")
## The first condition is the same in both cases.  You drew a fiction book
## off the shelf.  The probability of that fiction book being a paperback is 
## 0.819.  The overall proportion of paperbacks is 
## 0.705, which is close enough that for the most part
## you don't affect your chances much of drawing a hardcover on your second
## draw, if you put the book back (although since the odds are slightly
## higher that it's a paperback once you know it's fiction, you're better 
## off not replacing it, if you want to draw a hardcover next).  Also
## important is the fact that 28 out of 95 books are hardcovers, so even
## if most fiction books were hardcovers instead of paperbacks, the 
## probability of drawing a hardcover after a fiction book would change by
## less than 1/28 due to your choice of replacing or not after the first draw.

Baggage fees. (3.34, p. 124) 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.
avg <- .34 * 25 + .12 * 60
vary <- .54 * avg^2 + .34 * (25 - avg)^2 + .12 * (60 - avg)^2
std <- sqrt(vary)
glue("(a)  Avg.rev/passenger is ${format(round(avg, 2), nsmall = 2)}, 
     with a std.deviation of ${(format(round(std, 2), nsmall = 2))}")
## (a)  Avg.rev/passenger is $15.70, 
## with a std.deviation of $19.95
  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.
glue("About ${format(round(120 * avg, 2), nsmall = 2)} would be the expected 
     revenue, with about ${format(round(sqrt(120 * vary), 2), nsmall = 2)} 
     std.deviation.")
## About $1884.00 would be the expected 
## revenue, with about $218.54 
## std.deviation.
This assumes the amount of baggage that each passenger checks is independent of the other passengers, which of course isn’t completely true, but seems justified to me, for lack of a better estimator. Probably a bigger factor making the calculation inaccurate is that the numbers we’re using are averages, and it’s very conceivable that longer flights receive more checked bags per passenger, where shorter ones receive fewer. So you’d need a separate mean and std.dev. for each flight to be more accurate in your expected values.

Income and gender. (3.38, p. 128) 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.

  1. Describe the distribution of total personal income.

It looks somewhat normally distibuted, with a median a little over $40K, perhaps, near the peak, and with the mean a bit higher due to a long tail to the right (so I guess a right skew).

  1. What is the probability that a randomly chosen US resident makes less than $50,000 per year?
.622
  1. What is the probability that a randomly chosen US resident makes less than $50,000 per year and is female?
glue("{.622 * .41}, assuming gender is independent from income.")
## 0.25502, assuming gender is independent from income.

Note any assumptions you make.

  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.
This percentage shows that my assumption was invalid. 62.2% of all Americans make less than 50K, but 71.8% of females do, so gender isn’t independent from income.