Graded Exercises

2.6 Dice rolls

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

  1. getting a sum of 1?
P(sum=1) = Zero, the minimum sum is 2 (getting two 1’s)
  1. getting a sum of 5?
Dice combinations suming 5: (2,3), (1,4), (4,1) and (3,2), 4 out of a total of 36. P(sum=5) = 4/36 = 0.11
  1. getting a sum of 12?
Dice combinations summing 12: (6,6). 1 out of a total of 36. P(sum=12) = 0.27

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, although small percentage, 4.2% falls within both categories.
  1. Draw a Venn diagram summarizing the variables and their associated probabilities
install.packages('VennDiagram')
## Installing package into 'C:/Users/humberh/Documents/R/win-library/3.5'
## (as 'lib' is unspecified)
## Warning: unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.5:
##   cannot open URL 'http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.5/PACKAGES'
## package 'VennDiagram' successfully unpacked and MD5 sums checked
## 
## The downloaded binary packages are in
##  C:\Users\humberh\AppData\Local\Temp\RtmpsvpQoX\downloaded_packages
library(VennDiagram)
## Loading required package: grid
## Loading required package: futile.logger
grid.newpage()
draw.pairwise.venn(14.6, 20.7, 4.2, category = c("Below Poverty Line", "Speak Foreign Language"), fill = c("blue", "green"), alpha = rep(0.5, 2), cat.pos = c(0, 0), cat.dist = rep(0.025, 2))

## (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?
P(Below_Poverty) = 14.6, P(Speak_English_Only) = 100 - 20.7 = 79.3. P(both) = (14.6*79.3)/100 = 11.6%
  1. What percent of Americans live below the poverty line or speak a foreign language at home?
P(Below_Poverty) = 14.6, P(Speak_Foreign) = 20.7, P(Both) = 4.2. P(BP or SP) = 14.6 + 20.7 - 4.2 = 31.1%
  1. What percent of Americans live above the poverty line and only speak English at home?
P(Above_Poverty) = 100 - 14.6 = 85.4, P(Speak_English_Only) = 100 - 20.7 = 79.3. P(Both) = (85.4*79.3)/100 = 67.7%
  1. Is the event that someone lives below the poverty line independent of the event that the person speaks a foreign language at home?
P(Below_Poverty|Speaks_Foreign) = (P(BP) and P(SF))P(SF) = 4.2/20.7 = 20.3 (almost the same as P(BP), therefore the events are independent)

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

library("png")
pp <- readPNG("AssortMating.png")
plot.new() 
rasterImage(pp,0,0,1,1)

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

P(MBlue or FBlue) = 114/204 + 108/204 - 78/204 = 0.70

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

P(FBlue | MBlue) = 78/114 = 0.68

  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(FBlue | MBrown) = 19/54 = 0.35

P(FBlue | MGreen) = 11/36 = 0.30

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

No, the highest frequency and probability are for Male Blue Eyes and Females Blue Eyes

2.30 Books on a bookshelf

The table below shows the distribution of books on a bookcase based on whether they are non???ction or ???ction and hardcover or paperback

library("png")
pp <- readPNG("Books.png")
plot.new() 
rasterImage(pp,0,0,1,1)

  1. Find the probability of drawing a hardcover book ???rst then a paperback ???ction book second when drawing without replacement
P(Hardcover) * P(PaperFiction) = 28/95 * 59/94 = 0.185
  1. Determine the probability of drawing a ???ction book ???rst and then a hardcover book second, when drawing without replacement
P(Fiction) * P(Hadcover) = 72/95 * 28/94 = 0.225
(P(FictionHardcover) + P(FictionPaper)) * P(Hardcover) = ((13/95) + (59/95)) * 28/94 = 0.225
P(FictionHardcover and Hardcover) + P(FictionPaper and Hardcover) = ((13/95)27/94) + ((59/95)28/94) = 0.224
  1. Calculate the probability of the scenario in part (b), except this time complete the calculations under the scenario where the ???rst book is placed back on the bookcase before randomly drawing the second book
P(Fiction) * P(Hardcover) = 72/95 * 28/95 = 0.223
  1. The ???nal answers to parts (b) and (c) are very similar. Explain why this is the case.
Replacement influences the probabilities, as the outcome of the first draw do not affect the outcome of the second draw in (c - w/replacement) as it did in (b - w/o replacement)

2.38 Baggage fees

An airline charges the following baggage fees: $25 for the ???rst 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
passgrbags <- c(0,1,2)
fees <- c(0, 25, 35)
passprop <- c(0.54, 0.34, 0.12)
passrev <- passprop*fees
## Example with 10 passengers sample
passrev10 <- passrev*10
avgrev10 <- mean(passrev10)
sdrev10 <- sd(passrev10)
avgrev10
## [1] 42.33333
sdrev10
## [1] 42.50098
10 Passengers sample - Avg. Rev Per Passenger: $42.33; SD: 42.50
  1. About how much revenue should the airline expect for a ???ight of 120 passengers? With what standard deviation? Note any assumptions you make and if you think they are justi???ed
## Example with 120 passengers sample
passrev120 <- passrev*120
avgrev120 <- mean(passrev120)
sdrev120 <- sd(passrev120)
avgrev120
## [1] 508
sdrev120
## [1] 510.0118
120 Passengers sample - Avg. Rev Per Passenger: $508; SD: 510.01

2.44 Income and gender

The relative frequency table below displays the distribution of annual total personal income (in 2009 in???ation-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

library("png")
pp <- readPNG("IncomeGender.png")
plot.new() 
rasterImage(pp,0,0,1,1)

  1. Describe the distribution of total personal income
incomelabels <- c("$1 to $9,999 or less", 
            "$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")
incomebuckets <- c(1,10,15,25,35,50,65,75,100)
incomepcts <- c(2.2,4.7,15.8,18.3,21.2,13.9,5.8,8.4,9.7)
barplot(incomepcts, main = "Income Distribution", names.arg=incomelabels, las=2)

Normal distribution (with the last 2 buckets showing higher frequency than the previous one, but still mode, mean and median aligned to the center)
  1. What is the probability that a randomly chosen US resident makes less than $50,000 per year?
P(1-9999) + P(10K-14999) + P(15K-24999) + P(25K-34999) + P(35K-49999) = 62.2%
sum(incomepcts[1:5])
## [1] 62.2
  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
(P(1-9999) + P(10K-14999) + P(15K-24999) + P(25K-34999) + P(35K-49999)) * P(Female) = 62.2% * 41% = 25.5%
  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.
No, the assumption in (c) was equal distribution of females and Males across the data set. With the additional stat provided, the probability needs to be adjusted
(P(1-9999) + P(10K-14999) + P(15K-24999) + P(25K-34999) + P(35K-49999)) * P(Female_less50K) = 62.2% * 71.8% = 44.6%