Dice rolls. (3.6, p. 92) If you roll a pair of fair dice, what is the probability of
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.
#install.packages("VennDiagram") # Install VennDiagram package
library("VennDiagram") # Load VennDiagram package
## Loading required package: grid
## Loading required package: futile.logger
grid.newpage()
draw.pairwise.venn(area1 = 14.6, # Create pairwise venn diagram
area2 = 20.7,
cross.area = 4.2,
col = "red",
fill = c("green", "orange"),
category = c("below poverty line", "speak foreign language"))
## (polygon[GRID.polygon.11], polygon[GRID.polygon.12], polygon[GRID.polygon.13], polygon[GRID.polygon.14], text[GRID.text.15], text[GRID.text.16], text[GRID.text.17], text[GRID.text.18], text[GRID.text.19])
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.
What is the probability that a randomly chosen male respondent or his partner has blue eyes?
Answer:
= Probability (male blue eyes or female blue eyes)
= Probability (male blue eyes ) + Probability ( female blue eyes) - (Probability (male blue eyes and female blue eyes) )
114/204 + 108/204 - 78/204
## [1] 0.7058824What is the probability that a randomly chosen male respondent with blue eyes has a partner with blue eyes?
Answer:
= Probability (male blue eyes and male blue with female blue eyes)
= Probability ( male blue with female blue eyes) / Probability (male blue eyes)
(78/204) / (114/204)
## [1] 0.6842105What 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:
Probability that a randomly chosen male respondent with brown eyes has a partner with blue eyes:
= Probability (male brown eyes and male brown with female blue eyes)
= Probability ( male brown with female blue eyes) / Probability (male brown eyes)
(19/204) / (54/204)
## [1] 0.3518519
Probability of a randomly chosen male respondent with green eyes having a partner with blue eyes:
= Probability (male green eyes and male green with female blue eyes)
= Probability ( male green with female blue eyes) / Probability (male green eyes)
(11/204) / (36/204)
## [1] 0.3055556Does it appear that the eye colors of male respondents and their partners are independent? Explain your reasoning.
Answer: Yes its not independent: If male blue eyes and female blue eyes represent events from two different and independent processes, then the probability that both male blue eyes and female blue eyes occur can be calculated as the product of their separate probabilities:
P(male blue eyes and female blue eyes) = P(male blue eyes)×P(female blue eyes)
(78/204) = (114/204) x (108/204)
0.38 = 0.55 x 0.53 0.38 != 0.29
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.
Find the probability of drawing a hardcover book first then a paperback fiction book second when drawing without replacement.
Answer:
= Probability (drawing a hardcover book and paperback fiction book second when drawing without replacement)
= Probability (drawing a hardcover book ) * P(paperback fiction book second when drawing without replacement)
(28/95) * (59/94) #94 is with reduction of 1 for non-replacement
## [1] 0.1849944Determine the probability of drawing a fiction book first and then a hardcover book second, when drawing without replacement.
Answer:
= Probability (drawing a fiction book and hardcover book second, when drawing without replacement)
= Probability (drawing a fiction book ) * P(hardcover book second, when drawing without replacement)
(72/95) * (28/94) #94 is with reduction of 1 for non-replacement
## [1] 0.2257559Calculate 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:
= Probability (drawing a fiction book and hardcover book second, when drawing with replacement)
= Probability (drawing a fiction book ) * P(hardcover book second, when drawing with replacement)
(72/95) * (28/95) #95 on both as its with replacement
## [1] 0.2233795The final answers to parts (b) and (c) are very similar. Explain why this is the case.
Answer:
The loss of 1 book is not significant against the larger set of 95 books. For this reason the change is not significant.
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.
Build a probability model, compute the average revenue per passenger, and compute the corresponding standard deviation.
Answer: Average revenue per passenger is 15.7 with Standard Deviation of 19.95 [sqrt((0-15.7)^2*.54+(25-15.7)^2*.34+(60-15.7)^2*.12))]
#vector for count of checked luggage
checked.bag.count <- c (0, 1, 2)
#vector for dollar value for checked luggage
checked.bag.value <- c ( 0, 25, 60)
#vector for probability of checked baggage count
checked.bag.prob <- c (54, 34, 12)
#average revenue per customer is
avg.revenue.pc <- sum(checked.bag.value * checked.bag.prob) / sum(checked.bag.prob)
avg.revenue.pc
## [1] 15.7
##Standard Deviation
19.95
## [1] 19.95About 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: Revenue from 120 passenger will be $1884; And with standrad deviation the revenue will be $1884 +/- $19.95
# 54% of 120 will checkin no luggage; each person pay $0. Getting the total to:
zero.luggage.revenue <- ((54/100)*120) * 0
# 34% of 120 will checkin one piece@25; each person pay $25. Getting the total to:
one.luggage.revenue <- ((34/100)*120) * 25
# 12% of 120 will checkin one piece@25 and second piece@35; each person pay $25+$35 =$60. Getting the total to:
two.luggage.revenue <- ((12/100)*120) * 60
#Total revenue will be
zero.luggage.revenue + one.luggage.revenue + two.luggage.revenue
## [1] 1884Income 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.
Describe the distribution of total personal income.
Answer: We can use a Barplot here to see the distribution of the data; we can see two peaks in the plot. With majortiy / mean being at the middle in 15k to 65k range.
barplot(c(2.2 , 4.7 , 15.8 , 18.3 , 21.2 , 13.9, 5.8, 8.4, 9.7), xlab="Income",ylab="Total",col="blue",main="Distribution of annual total personal income",border="red")
What is the probability that a randomly chosen US resident makes less than $50,000 per year?
Answer: Probability that a randomly chosen US resident makes less than $50,000 per year is 0.622 :
(2.2 + 4.7 + 15.8 + 18.3 + 21.2 ) / 100
## [1] 0.622What 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: Probability that a randomly chosen US resident makes less than $50,000 per year and is female is 0.25502 :
((2.2 + 4.7 + 15.8 + 18.3 + 21.2 ) / 100 ) * .41
## [1] 0.25502The 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: Assumption in part c is not valid as 71% of 41% of overall population is not same as the probabilty calculated in part c. 25.5% [from part c] vs 29.11% [from below]
(71/100) * ((41/100))
## [1] 0.2911