install.packages(“VennDiagram”) install.packages(“grid”)
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.
library(VennDiagram)
## Loading required package: grid
## Loading required package: futile.logger
library(grid)
venn_diagram <- draw.pairwise.venn(14.6, 20.7, 4.2, c("Foreing Language spoken", "Below poverty Line"), cat.dist=-0.295, scale = FALSE);
grid.draw(venn_diagram);
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.
x = (114 + 108 - 78)/204
x * 100
## [1] 70.58824
x = 78/114
x * 100
## [1] 68.42105
x = 19/54
x * 100
## [1] 35.18519
P (Female Blue | Male Green)
x = 11/36
x * 100
## [1] 30.55556
x = 19/54
x
## [1] 0.3518519
y = 108/204
y
## [1] 0.5294118
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.
x = (28/95) * (59/94)
x
## [1] 0.1849944
x = (72/95) * (28/94)
x
## [1] 0.2257559
x = (72/95) * (28/95)
x
## [1] 0.2233795
In my opinion since this is fairly large dataset the final answers to parts [b] and [c] are very similar. If this was instead say, a smaller dataset, the action of not placing back the first book on the bookcase would make a greater impact on the outcome.
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.
baggage_average = (0.54*(0) + 0.34*(25) + 0.12*(25+35))
print(baggage_average)
## [1] 15.7
var = (0-baggage_average)^2*0.54+(0.34*25-baggage_average)^2*0.34+(0.12*60-baggage_average)^2*0.12
standard_dev=sqrt(var)
print(standard_dev)
## [1] 12.62538
expected_rev <- 120 * (baggage_average)
expected_rev
## [1] 1884
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.
range_of_income <- c("$1 to $9999 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,999", "$65,000 to $74,999",
"$75,000 to $99,999", "$100,000 or more")
total <- c(.022, .047, 0.158, 0.183, 0.212, 0.139, 0.058, 0.084, 0.097)
y <- data.frame(range_of_income, total)
y
x = 21.2 + 18.3 + 15.8 + 4.7 + 2.2
print(x)
## [1] 62.2
y = 0.622 * 0.410
print(y)
## [1] 0.25502
per above calculation, we are expecting possibly 62.2% of female to make less than 50K. This shows us disparity in the values suggested of 71.8%. It is a pretty large difference.