Week 2 Homework

OpenIntro Statistics 3rd ed.

Practice: 2.5, 2.7, 2.19, 2.29, 2.43 Graded: 2.6, 2.8, 2.20, 2.30, 2.38, 2.44

2.5 Coin flips.

If you flip a fair coin 10 times, what is the probability of

  1. getting all tails?
  2. getting all heads?
  3. getting at least one tails?
dbinom(0, 10, .5)
## [1] 0.0009765625
dbinom(10, 10, .5)
## [1] 0.0009765625
pbinom(1, 10, .5, lower.tail = F)
## [1] 0.9892578

2.6 Dice rolls.

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?
sample.space <- rolldie(2)
sample.space$sum <- sample.space$X1 + sample.space$X2
possibilities <- nrow(sample.space)

sum(sample.space$sum==1)/possibilities
## [1] 0
sum(sample.space$sum==5)/possibilities
## [1] 0.1111111
sum(sample.space$sum==12)/possibilities
## [1] 0.02777778

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?
  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?
poverty <- .146
other.language <- .207
both <-.042

a <- "No"
#my.url <- getURLContent("https://raw.githubusercontent.com/kylegilde/D606-Stats/master/venn1.PNG")
b <- "I couldn't figure out how to print an image inside the R code. See below"
c <- poverty - both 
d <- poverty + other.language - both 
e <- 1 - d
f <- "No"

a;b;c;d;e;f
## [1] "No"
## [1] "I couldn't figure out how to print an image inside the R code. See below"
## [1] 0.104
## [1] 0.311
## [1] 0.689
## [1] "No"
b.

b.

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.

  1. What is the probability that a randomly chosen male respondent or his partner has blue eyes?
  2. What is the probability that a randomly chosen male respondent with blue eyes has a partner with blue eyes?
  3. 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?
  4. Does it appear that the eye colors of male respondents and their partners are independent?

Explain your reasoning.

a <- (114 + 108 - 78)/204
b <- 78/114
c <- 19/54
d <- "No, it appears that the eye colors of the male respondents and their partners are NOT independent. For each eye-color subset of males, it is more likely that the partners share that eye color than any of the other colors."
a;b;c;d
## [1] 0.7058824
## [1] 0.6842105
## [1] 0.3518519
## [1] "No, it appears that the eye colors of the male respondents and their partners are NOT independent. For each eye-color subset of males, it is more likely that the partners share that eye color than any of the other colors."

2.29 Chips in a bag. Imagine you have a bag containing 5 red, 3 blue, and 2 orange chips.

  1. Suppose you draw a chip and it is blue. If drawing without replacement, what is the probability the next is also blue?
  2. Suppose you draw a chip and it is orange, and then you draw a second chip without replacement. What is the probability this second chip is blue?
  3. If drawing without replacement, what is the probability of drawing two blue chips in a row?
  4. When drawing without replacement, are the draws independent? Explain.
red <- 5
blue <- 3
orange <- 2
total <- red+blue+orange

(blue -1)/(total -1)
## [1] 0.2222222
blue/(total - 1)
## [1] 0.3333333
blue/total * (blue - 1)/(total - 1)
## [1] 0.06666667

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.

Type Hardcover Paperback Total

Fiction 13 59 72

Nonfiction 15 8 23

Total 28 67 95

  1. Find the probability of drawing a hardcover book first then a paperback fiction book second when drawing without replacement.
  2. Determine the probability of drawing a fiction book first and then a hardcover book second, when drawing without replacement.
  3. 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.
  4. The final answers to parts (b) and (c) are very similar. Explain why this is the case.
books <- matrix( c(13,59,15,8), 2,2, byrow = T)
 
a <- sum(books[,1])/sum(books) * books[1,2]/(sum(books)-1)
b <- books[1,1]/sum(books) * sum(books[,1] - 1)/(sum(books)-1) + books[1,2]/sum(books) * sum(books[,1])/(sum(books)-1)
c <- sum(books[1,])/sum(books) * sum(books[,1])/sum(books)
d <- "In this scenario, drawing books w/ and w/o replacement has only the tiniest effect on the overall probability" 

a;b;c;d
## [1] 0.1849944
## [1] 0.2228443
## [1] 0.2233795
## [1] "In this scenario, drawing books w/ and w/o replacement has only the tiniest effect on the overall probability"

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.

Income Total

$1 to $9,999 or loss 2.2%

$10,000 to $14,999 4.7%

$15,000 to $24,999 15.8%

$25,000 to $34,999 18.3%

$35,000 to $49,999 21.2%

$50,000 to $64,999 13.9%

$65,000 to $74,999 5.8%

$75,000 to $99,999 8.4%

$100,000 or more 9.7%

This sample is comprised of 59% males and 41% females.

  1. Describe the distribution of total personal income.
  2. What is the probability that a randomly chosen US resident makes less than $50,000 per year?
  3. 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.
  4. 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.
perc <- c(0.022,    0.047,  0.158,  0.183,  0.212,  0.139,  0.058,  0.084,  0.097)
m <- .59
f <- .41

a <- "It's distributed vaguely normally, except that there is a lot more kurtosis in the right tail than the left tail."
b <- sum(perc[1:5])
c <- b * f
print("You have to assume that the the proportion of females is evenly distributed accoss all income brackets")
## [1] "You have to assume that the the proportion of females is evenly distributed accoss all income brackets"
d <- "That the female population is disproportionately distributed in the less than $50K brackets makes my previous assumption and calcalution incorrect."  
a;b;c;d
## [1] "It's distributed vaguely normally, except that there is a lot more kurtosis in the right tail than the left tail."
## [1] 0.622
## [1] 0.25502
## [1] "That the female population is disproportionately distributed in the less than $50K brackets makes my previous assumption and calcalution incorrect."