Dice rolls. (3.6, p. 92) If you roll a pair of fair dice, what is the probability of
The answer: the probability of getting a sum of 1 is 0, we can’t get sum 1 in a pair of fair dice.
The answer: 11.11%, the probability of getting a sum of 5 is, first we get 1 and second 4 and vice versa, and we get first 2 and second 3 and vice versa, so there are 4 possible outcomes for getting sum of 5.
## [1] 0.1111111
The answer: 2.78%, the probability of getting a sum of 12 is we get in both pair of fair dice 6, therefore there is only one possibility.
## [1] 0.02777778
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.
14.6% poverty 20.7% speak another language 4.2% in both
The answer: No they are not disjoint, there are Americans in both categories.
## Loading required package: grid
## Loading required package: futile.logger
grid.newpage()
draw.pairwise.venn(14.6, 20.7, 4.2, category = c("Below Poverty Line", "Speak Other Language"), lty = rep("blank",2), fill = c("blue", "green"), alpha = rep(0.5, 2), cat.pos = c(0, 0), cat.dist = rep(0.025, 2))## (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 answer: 10.4%
## [1] 0.104
The answer: 31.1%
## [1] 0.311
The answer: 68.9%
## [1] 0.689
The answer: They are not independent because there is 4.2% fall in both categories.
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.
The answer: 70.6%
## [1] 0.7058824
The answer: 68.4%
## [1] 0.6842105
The answer: 35.2% is the probability that a randomly chosen male respondent with brown eyes has a partner with blue eyes and 30.6% is the probability of a randomly chosen male respondent with green eyes having a partner with blue eyes
## [1] 0.3518519
## [1] 0.3055556
The answer: Not its not independent, the percentage of male and their partners with the same eye color are higher than the percentages with different eye colors.
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.
The answer: 18.5%
## [1] 0.1849944
The answer: 22.6%
## [1] 0.2257559
The answer: 22.3%
## [1] 0.2233795
The answer: They are very similar and total here changed by only one book before randomly drawing the second book which is hardcover one.
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.
25$ first bag 35$ second bag 54% no bags 34% one bag 12% two bags
number_of_bages <- c(0, 1, 2)
charges <- c(0, 25, 60)
percenrages_of_passangers <- c(0.54, 0.34, 0.12)
the_charges <- tibble(number_of_bages, charges, percenrages_of_passangers)
the_charges## # A tibble: 3 x 3
## number_of_bages charges percenrages_of_passangers
## <dbl> <dbl> <dbl>
## 1 0 0 0.54
## 2 1 25 0.34
## 3 2 60 0.12
The answer: the average revenue = 15.7 & standard deviation = 19.3
Average_revenue <- sum(charges * percenrages_of_passangers)
print(paste("the average revenue = ", Average_revenue))## [1] "the average revenue = 15.7"
SD <- sqrt((0 - Average_revenue)^2 * 0.54 + (25 - Average_revenue)^.34 + (60 - Average_revenue)^2 * 0.12)
print(paste( "standard deviation =", SD))## [1] "standard deviation = 19.2545537791854"
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.
The answer: The distribution looks like a normal since the majority of the income distribution are in the middle of the of the percentages.
the_income <- c('$1 to $9,999',
'$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')
the_percentage <- c(0.022, 0.047, 0.158, 0.183, 0.212, 0.139, 0.058, 0.084, 0.097)## # A tibble: 9 x 2
## the_income the_percentage
## <chr> <dbl>
## 1 $1 to $9,999 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,999 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
The answer: 62.2%
## [1] 0.622
The answer: 25.5%
## [1] 0.25502
The answer: gender and income in the US are dependent.
## [1] 0.1831044
The END…
Karim Hammoud