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?

    impossible, the least we can get is a 2.
  2. getting a sum of 5?

    there are 4 possible rolls that produce a sum of 5. thus the probability is 4/36 or 11.11%
  3. getting a sum of 12?

    There is only one possible roll that produce a sum of 12. The probability is 1/36 or 2.78%

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.

poverty<- .146 lang_other<-.207 both<- .042

#install.packages("VennDiagram")
#install.packages("formattable")
library(VennDiagram)
## Warning: package 'VennDiagram' was built under R version 3.5.3
## Loading required package: grid
## Loading required package: futile.logger
## Warning: package 'futile.logger' was built under R version 3.5.3
library(xtable)
## Warning: package 'xtable' was built under R version 3.5.3
library(formattable)
## Warning: package 'formattable' was built under R version 3.5.3
## 
## Attaching package: 'formattable'
## The following object is masked from 'package:xtable':
## 
##     digits
  1. Are living below the poverty line and speaking a foreign language at home disjoint?

    No. There are those who speak a foreign language at home and live below poverty line.
  2. Draw a Venn diagram summarizing the variables and their associated probabilities.

grid.newpage()
draw.pairwise.venn(14.6, 20.7, 4.2, category = c("Poverty", "Other Language"), lty = rep("blank",2), fill = c("blue", "red"), 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(Poverty) ??? P(Poverty and Foreign) = 14.6 ??? 4.2 = 10.4%
  2. What percent of Americans live below the poverty line or speak a foreign language at home?

    P(Poverty) + P(Foreign) ??? P(Poverty and Foreign) = 14.6 + 20.7 ??? 4.2 = 31.1%
  3. What percent of Americans live above the poverty line and only speak English at home?

    P(English and NoPoverty)= 100 ??? P(Povery) + P(Other) ??? P(Poverty and Other) = 100 ??? (20.7 + 14.6 ??? 4.2) = 68.9
  4. Is the event that someone lives below the poverty line independent of the event that the person speaks a foreign language at home?

    P(Poverty|Engish) = 10.4 /(69.9+10.4) = 0.1295143 
    P(Poverty|NonEnglish) = 4.2 / (16.5 + 4.2) = 0.2028986
    
    There is a higher probability of being in Poverty given NonEnglish @ (20.3%) versus Poverty given English @ (12.9%), thus these events are         dependednt. we expect similar results for independed events.

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.

f_blue <- 108 / 204
f_green <- 41 / 204
f_brown <- 55 / 204

m_blue <- 114 / 204
m_green <- 36 / 204
m_brown <- 54 / 204

both_blue <- 78 / 204
both_green <- 16 / 204
both_brown <- 23 / 204
  1. What is the probability that a randomly chosen male respondent or his partner has blue eyes?
either_blue <- f_blue + m_blue - both_blue
either_blue
## [1] 0.7058824
  1. What is the probability that a randomly chosen male respondent with blue eyes has a partner with blue eyes?
m_blue_both_blue <- both_blue/m_blue
m_blue_both_blue
## [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?
f_blue <- 108 / 204
f_green <- 41 / 204
f_brown <- 55 / 204

m_blue <- 114 / 204
m_green <- 36 / 204
m_brown <- 54 / 204

both_blue <- 78 / 204
both_green <- 16 / 204
both_brown <- 23 / 204

m_green_f_blue <- m_green * f_blue
m_green_f_blue
## [1] 0.09342561
  1. Does it appear that the eye colors of male respondents and their partners are independent? Explain your reasoning.

if the two events were independent we would expect to see similar proportions between the eye colors of both partners but this is not the case. We thus conclude that these events are not 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.
total <- 95
prob_Hc <- 28 / total
no_rep_total <- total - 1 # Without replacment, we removed 1 book
prob_pb_fict <- 59 / no_rep_total
final <- prob_Hc * prob_pb_fict
final
## [1] 0.1849944
  1. Determine the probability of drawing a fiction book first and then a hardcover book second, when drawing without replacement.
total <- 95
prob_fict <- 72 / total
no_rep_total <- total - 1 # Without replacment, we removed 1 book
prob_Hc <- 28 / no_rep_total
final <- prob_fict * prob_Hc
final
## [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.
total <- 95
prob_fict <- 72 / total
no_rep_total <- total # With replacment, we put back the first book
prob_Hc <- 28 / no_rep_total
final <- prob_fict * prob_Hc
final
## [1] 0.2233795
  1. The final answers to parts (b) and (c) are very similar. Explain why this is the case.

    we have a sample size of 95 which is large enough. the loss of 1 book means that only 1% is lost which is not significant enough to               adversely affect the sample.

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.
fees <- c(0, 25, 35)
portions <- c(0.54, 0.34, 0.12)
model <- fees * portions

mean(model)
## [1] 4.233333
sd(model)
## [1] 4.250098
  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.
sum(model*120)
## [1] 1524

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.
inc <- c(5, 12.5, 20, 29.5, 42.5, 57.5, 70, 88, 110)
tot <- c(0.022, 0.047, 0.158, 0.183, 0.212, 0.139, 0.058, 0.084, 0.097)

barplot(tot, inc)

    The data is right skewed with a long tail to the right, it is unimodal with only one prominent peak.
  1. What is the probability that a randomly chosen US resident makes less than $50,000 per year?
sum(tot)       # Should add up to 100% (minor differences might be due to rounding off errors)
## [1] 1
p_earn_less_than_50 <- sum(tot[0:5])  # sum the first 5 probabilities to get the prob of making less than 50k
p_earn_less_than_50
## [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.
p_earn_less_than_50_F <- sum(tot[0:5]) * 0.41
p_earn_less_than_50_F
## [1] 0.25502
    my assumption is gender and income are independent. Though this is definitely not the case.
  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.

    71.8% is significantly higher than 25%. this suggests a strong correlation between income and gender.