Dice rolls. If you roll a pair of fair dice, what is the probability of
(a) getting a sum of 1?
# The probability of getting a sum of 1 is zero when rolling a pair of dice. The lowest possible sum when rolling two dice is 2.
P(sum = 5) = P(1 & 4) or P(4 & 1) or P(3 & 2) or P(2 & 3)
P(sum = 5) = (1/36) * 4
(1/36) * 4
## [1] 0.1111111
P(sum = 12) = P(6 & 6)
P(sum = 12) = (1/6)*(1/6)
(1/6)*(1/6)
## [1] 0.02777778
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?
No because a person can both speak a foreign language and be living below the poverty line at the same time.
library(VennDiagram)
## Warning: package 'VennDiagram' was built under R version 3.4.4
## Loading required package: grid
## Loading required package: futile.logger
draw.pairwise.venn(area1 = 14.6,
area2 = 20.7,
cross.area = 4.2,
fill = c("yellow","green"),
category = c('Americans below poverty line', 'Foreign language'),
cat.dist = -0.1)
## (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])
The percent of Americans that live below the poverty line and only speak English can be calculated by subtracting the percent that fall into both catergories of speaking a foreign language and living below the poverty line from the percent of Americans living below the poverty line. We can also see this value in the above Venn diagram.
14.6% - 4.2% = 10.4%
(14.6 + 20.7) - 4.2
## [1] 31.1
100 - (14.6 + 20.7)
## [1] 64.7
Yes, the fact that someone is living below or above the poverty line does not influence whether or not the person speaks a foreign language at home.
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.
((total male w blue) + (total female w blue) - (both male and female w blue)) / (total)
(114 + 108 - 78) / 204
## [1] 0.7058824
P(female w blue | male w blue) = (both male and female w blue) / (total male w blue)
78 / 114
## [1] 0.6842105
P(female w blue | male w brown) = (male w brown and female w blue) / (total male w brown)
19 / 54
## [1] 0.3518519
P(female w blue | male w green) = (male w green and female w blue) / (total male w green)
11 / 36
## [1] 0.3055556
No, the observations above show that males and females are more likely to be with partners with the same eye color as themselves.
The table below shows the distribution of books on a bookcase based on whether they are nonfiction or fiction and hardcover or paperback.
((hardcover total) / (total)) * ((paperback fiction) / (total - 1))
(28/95) * (59/94)
## [1] 0.1849944
((fiction total) / (total)) + ((hardcover and first fiction hardcover) * (hardcover and first fiction paperback))
(72/95) * (((13/72)*(27/94)) + ((59/72)*(28/94)))
## [1] 0.2243001
(72/95) * (((13/72)*(28/95)) + ((59/72)*(28/95)))
## [1] 0.2233795
The answers to B and C are similar because there is a large enough number of books on the bookcase that removing one and not replacing it before selecting a second book does not change the probabilities significantly.
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.
prob <- c(.54, .34, .12)
bagfee <- c(0,25, 60)
df <- data.frame(bagfee,prob)
df$probtimesfee <- df$bagfee*df$prob
ex <- sum(df$probtimesfee)
# expected value or average revenue
ex
## [1] 15.7
df$fee_min_mean <- df$bagfee - ex
df$sq_fee_min_mean <- df$fee_min_mean ** 2
df$sq_times_prob <- df$sq_fee_min_mean * df$prob
# variance
variance = sum(df$sq_times_prob)
# SD
sd = sqrt(variance)
sd
## [1] 19.95019
We can assume that the expected revenue would be the avg expected revenue times the number of passengers and the same for the variance
ex * 120
## [1] 1884
sd * 120
## [1] 2394.023
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.
income <- c('$1 - $9,999 or less',
'$10,000 to $14,999',
'$15,000 to $24,999',
'$25,000 to $34,999',
'$35,000 to $49,999',
'$50,000 to $64,999',
'$65,000 to $74,999',
'$75,000 to $99,999',
'$100,000 or more')
percenttotal = c(.022,
.047,
.158,
.183,
.212,
.139,
.058,
.084,
.097)
incomedf <- data.frame(income, percenttotal)
par(mar = c(12, 4,4,2))
barplot(incomedf$percenttotal, names.arg = incomedf$income, las =3)
sum(incomedf$percenttotal[0:5])
## [1] 0.622
The sample was 41% female, therefore multiplying the answer from (b) by 0.41 shoudl give us the answer.
sum(incomedf$percenttotal[0:5]) * 0.41
## [1] 0.25502
I would not consider the assumption I made in part (c) to be valid because the distribution of income between gender varies with income range. In part (b) we calculated that 62.2% of the sample population is making less than 50k. Which means there this many people are earning below 50k from the sample:
96420486 * .62
## [1] 59780701
The number of females in the sample:
96420486 * .41
## [1] 39532399
Multiplying the number of females in the sample by 0.718 and then dividing by the number of people earning less than 50k returns 0.47 which differs from the 0.41 value given to us in part (c).
(39532399 * .718) / 59780701
## [1] 0.4748065