Dice rolls. (3.6, p. 92) If you roll a pair of fair dice, what is the probability of
getting a sum of 5?
Ways to get 5:
1 and 4: 1/6 * 1/6
2 and 3: 1/6 * 1/6
3 and 2: 1/6 * 1/6
4 and 1: 1/6 * 1/6
4*(1/36) = 4/36
So 1/9 is probability to get 5getting a sum of 12?
Ways to get 12:
6 and 6: 1/6 * 1/6
1/36 is probability to get sum 12Poverty 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.
Are living below the poverty line and speaking a foreign language at home disjoint?
No, they are not disjoint/mutually exclusive because both can be true.Draw a Venn diagram summarizing the variables and their associated probabilities.
grid.newpage()
grid.draw(venn.plot);
## Error in grid.draw(venn.plot): object 'venn.plot' not found
venn.plot <- draw.pairwise.venn(area1 = 14.6,
area2 = 20.7,
cross.area = 4.2,
category = c("Poverty", "Foreign"))
What percent of Americans live below the poverty line and only speak English at home?
10.4%What percent of Americans live below the poverty line or speak a foreign language at home?
14.6% + 16.5% = 31.1%What percent of Americans live above the poverty line and only speak English at home?
100% - 14.6% - 16.5% = 68.9%Is the event that someone lives below the poverty line independent of the event that the person speaks a foreign language at home? ``` Independence rules: P(A and B) = P(A) * P(B) P(A|B) = P(A)
let P(A) = P(Poverty), P(B) = P(Foreign)
P(Poverty and Foreign) = 14.6% * 20.7% = 3.0222% != 4.2% P(Poverty|Foreign) = 4.2%/20.7% = 20.28986% != 14.6% = P(Poverty) Independence rules are violated so poverty and foreign are not independent.
--------------------------------------------------------------------------------
\clearpage
**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.
\begin{center}
\begin{tabular}{ll ccc c}
& & \multicolumn{3}{c}{\textit{Partner (female)}} \\
\cline{3-5}
& & Blue & Brown & Green & Total \\
\cline{2-6}
& Blue & 78 & 23 & 13 & 114 \\
\multirow{2}{*}{\textit{Self (male)}} & Brown & 19 & 23 & 12 & 54 \\
& Green & 11 & 9 & 16 & 36 \\
\cline{2-6}
& Total & 108 & 55 & 41 & 204
\end{tabular}
\end{center}
(a) What is the probability that a randomly chosen male respondent or his partner has blue eyes?
P(M-Blue) or P(F-Blue) - P(M-Blue & F-Blue): 114/204 + 108/204 - 78/204 = 0.7058824 = 70.58824%
(b) What is the probability that a randomly chosen male respondent with blue eyes has a partner with blue eyes?
P(F-Blue|M-Blue): 78/114 = 0.6842105 = 68.42105%
(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?
P(F-Blue|M-Brown): 19/54 = 0.3518519 = 35.185195%
P(F-Blue|M-Green): 11/36 = 0.3055556 = 30.555565%
(d) Does it appear that the eye colors of male respondents and their partners are independent? Explain your reasoning.
Independence rules: P(A and B) = P(A) * P(B) P(A|B) = P(A)
let P(A) = P(F-Blue), P(B) = P(M-Blue) P(F-Blue & M-Blue): P(F-Blue) * P(M-Blue) = 108/204 * 114/204 = 0.2958478 != 0.6842105 (from b)
P(F-Blue|M-Blue) = 0.6842105 != 0.5294118 = P(F-Blue)
Independence rules are violated so eye color of male respondents and their partners are dependent. ```
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.
(28/95) * (59/94) = 0.1849944
## Error in (28/95) * (59/94) = 0.1849944: target of assignment expands to non-language object
Determine the probability of drawing a fiction book first and then a hardcover book second, when drawing without replacement.
P(hardcover|fiction-1st)*P(fiction-1st, hardcover-2nd) + p(paperback|fiction-1st)*P(fiction-1st, hardcover-2nd)
(13/72)[(72/95) * (27/94)] + (59/72)[(72/95) * (28/94)] = 0.2243001Calculate 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.
(72/95) * (28/95) = 0.2233795The final answers to parts (b) and (c) are very similar. Explain why this is the case.
Whether you replace the book or not needs to be accounted for in the probabilities
as can bee seen from b vs c. In b you must update what the table looks like for the
second draw, and you have 2 versions of this table depending on whether
the fiction book from the first draw was a hardcover or a paperback.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.
# check sum to 1
total =.54 + .34 + .12
total
## [1] 1
probs = c(.54, .34, .12)
xi = c(0, 25, 60)
exp_rev = sum(probs*xi)
# 15.7$ revenue per passenger
exp_rev
## [1] 15.7
xi_subtract_mean = xi-exp_rev
xi_subtract_mean
## [1] -15.7 9.3 44.3
xi_subtract_mean_sqr = xi_subtract_mean**2
xi_subtract_mean_sqr
## [1] 246.49 86.49 1962.49
variance = sum(xi_subtract_mean_sqr*probs)
variance
## [1] 398.01
stand_dev = variance**.5
# 19.95019 standard deviation
stand_dev
## [1] 19.95019
# assume that passenger fall randomly into the 3 types of passengers paying for bags.
# There's probably cases of flights that have tons of people bringing luggage all
# at once, like maybe everyone is flying back to school with all their belongings.
# The assumption that a flight has passengers randomly sampled from the 3
# passenger types probably isn't entirely true.
exp_rev_120 = 120*exp_rev
# airline should expect to make $1,884
exp_rev_120
## [1] 1884
var_120 = sum((120*probs)**2 * xi_subtract_mean_sqr)
var_120
## [1] 1585938
std_dev_120 = var_120**.5
# the standard deviation is 1259.34
std_dev_120
## [1] 1259.34
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.
Describe the distribution of total personal income.
There are 9 bins of income, with the largest percentage of people in the 35,000 - 49,999 binWhat is the probability that a randomly chosen US resident makes less than $50,000 per year?
.212 + .183 + .158 + .047 + .022
## [1] 0.622
# 62.2%
# assume that males and females do not differ in income distribution from the shown table
# assume probabilities of income and gender are independent
.622 * .41
## [1] 0.25502
# 25.502%
# I assumed independence in gender and income:
# P(A and B) = P(A) * P(B)
# let P(A) = P(-50000), P(B) = P(Female)
# .718 != .25502
# My assumption of gender and income independence is not valid