2.6 Dice rolls. If you roll a pair of fair dice, what is the probability of (a) getting a sum of 1? Answer: Probability of getting sum 1 is 0.
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: Living below the poverty line and speaking a foreign language at home disjoint. (b) Draw a Venn diagram summarizing the variables and their associated probabilities.
# install.packages("VennDiagram")
library(VennDiagram)
## Loading required package: grid
## Loading required package: futile.logger
draw.pairwise.venn(14.6, 20.7, cross.area = 4.2, c("Poverty", "Foreign Language"), fill=c("red","green"), cat.dist=-0.08)
## (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])
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. 65 Partner (female) Blue Brown Green Total Blue 78 23 13 114 Self (male) Brown 19 23 12 54 Green 11 9 16 36 Total 108 55 41 204 (a) What is the probability that a randomly chosen male respondent or his partner has blue eyes? Answer: P(male = blue or female = blue) = P(male=blue)+P(female=blue) - P(male = blue and female = blue) = 114/204 + 108/204 - 78/204 =0.7058824 (b) What is the probability that a randomly chosen male respondent with blue eyes has a partner with blue eyes? Answer: P(famale have blue eyes | male had blue eyes) = P(female and male both have blue eyes)/P(male have blue eyes) = (78/204)/(114/204) = 0.68 (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? Answer: P(famale have blue eyes | male had brown eyes) = P(female blue and male brown eyes)/P(male have brown eyes) = (19/204)/(54/204) = 0.3518519
P(famale have blue eyes | male had green eyes) = P(female blue and male green eyes)/P(male have green eyes) = (11/204)/(36/204) = 0.3055556 (d) Does it appear that the eye colors of male respondents and their partners are independent? Explain your reasoning Answer: If this were the case than P(Male eye color)P(Female eye color) = P(Male and female same eye color). But this is not the case.For example P(Male blue eye)P(Female blue eye) = 0.2958478 is not equal to P(male and female blue color) = 0.3823529. 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. Format Hardcover Paperback Total Type Fiction 13 59 72 Nonfiction 15 8 23 Total 28 67 95 (a) Find the probability of drawing a hardcover book first then a paperback fiction book second when drawing without replacement. Answer:P(Hardcover book first) P(Fiction book second)= 28/9559/94 = 0.1849944 (b) Determine the probability of drawing a fiction book first and then a hardcover book second, when drawing without replacement. Answer:P( fiction book first) P(hardcover book second)= 72/9528/94 = 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. Answer:P( fiction book first) P(hardcover book second)= 72/9528/95 = 0.2233795 (d) The final answers to parts (b) and (c) are very similar. Explain why this is the case Answer: Since weโre taking out only 1 book this will not change the probaiblity with and without replacement very much. 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. Answer:
df <- data.frame("Num of Bags" = c(0,1,2), "Cost"=c(0,25,35),"Probability"=c(0.54,0.34,0.12))
df
## Num.of.Bags Cost Probability
## 1 0 0 0.54
## 2 1 25 0.34
## 3 2 35 0.12
Average Revenue per passenger
avg_rev <- sum(df$Cost*df$Probability)
avg_rev
## [1] 12.7
Standard Deviation
sqrt(sum(df$Probability*(df$Cost-avg_rev)^2))
## [1] 14.07871
The standard deviaiton is 14.07871. (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. Answer:
avg_rev*120
## [1] 1524
14.07871 * sqrt(120)
## [1] 154.2245
The airline should expect to earn 1524 for 120 passengers.With 154.2245 standard deviation by using central limit theorme. Here sample size is approximately large.
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.
df <- data.frame("Income" =c("$1 to $9,999 or loss",
"$10,000 to $14,999",
"$15,000 to $24,999",
"$25,000 to $34,999",
"$35,000 to $49,999",
"$50,000 to $64,000",
"$65,000 to $74,999",
"$75,000 to $99,999",
"$100,000 or more"), "Total" = c(.022, .047, .158, .183, .212, .139, .058, .084, 0.097))
df
## Income Total
## 1 $1 to $9,999 or loss 0.022
## 2 $10,000 to $14,999 0.047
## 3 $15,000 to $24,999 0.158
## 4 $25,000 to $34,999 0.183
## 5 $35,000 to $49,999 0.212
## 6 $50,000 to $64,000 0.139
## 7 $65,000 to $74,999 0.058
## 8 $75,000 to $99,999 0.084
## 9 $100,000 or more 0.097
library(ggplot2)
ggplot(df, aes(Income,Total))+geom_bar(stat = "identity")+theme_classic()+theme(
axis.text.x = element_text(angle = 90)
)
From the graph we can see that income is normally distributed. (b) What is the probability that a randomly chosen US resident makes less than $50,000 per year? Answer:
sum(df$Total[1:5])
## [1] 0.622
The probability is 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. Answer: Assuming income and gender are independent
sum(df$Total[1:5])*0.41
## [1] 0.25502
The probability is 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: The assumption is not correct. Probability of female is 0.41 * Probability of earning less than 50K is 71.8. = 0.29438 is not equal to the probability of female and earning less than 50K is 0.25502.