2.6 Dice rolls. If you roll a pair of fair dice, what is the probability of:
Ans: Zero probability of gettig a sum 1 with 2 fair dice.
Ans: Possible combinations for sume of 5
1 + 4
2 + 3
3 + 2
4 + 1
paste0('The probability of getting a sum of 5 is ', round((4/36),3))
## [1] "The probability of getting a sum of 5 is 0.111"
Ans: There is only 1 combination that will lead to a sum of 12, (6,6).
paste0('The probability of getting a sum of 12 is ', round((1/36),3))
## [1] "The probability of getting a sum of 12 is 0.028"
2.8 Poverty and language. 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.
Ans: No.
library(VennDiagram)
## Loading required package: grid
## Loading required package: futile.logger
#below data in percentile
below_poverty <- 14.6
foreign_language <- 20.7
both_cat <- 4.2
vennDgm <- draw.pairwise.venn(below_poverty, foreign_language, both_cat, category = c("BelowPoverty People", "ForeignLanguage"))
grid.draw(vennDgm)
Ans: It is evident from the diagram that only .104% people livebelow the poverty line and only speak english at home.
poverty_line <- 0.146
foreignlanguage <- 0.207
both_class <- 0.042
poverty_line - both_class
## [1] 0.104
Ans:
poverty_line + foreignlanguage - both_class
## [1] 0.311
Ans:
1- (poverty_line + foreignlanguage - both_class)
## [1] 0.689
Ans:
(poverty_line * foreignlanguage)
## [1] 0.030222
both_class
## [1] 0.042
Poverty having English with other language (.0302), does not equal to poverty and English with other lanaguage (0.042), so the events are dependent.
2.20 Assortative mating. 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.
108/204 + 114/204 - 78/204
## [1] 0.7058824
78/114
## [1] 0.6842105
19/54
## [1] 0.3518519
11/36
## [1] 0.3055556
#blue
78/204
## [1] 0.3823529
114/204 * 108/204
## [1] 0.2958478
#brown
23/204
## [1] 0.1127451
54/204 * 55/204
## [1] 0.07136678
#green
11/204
## [1] 0.05392157
36/304 * 41/204
## [1] 0.02380031
Ans: The events are not independent according to the multiplication rule
2.30 Books on a bookshelf. The table below shows the distribution of books on a bookcase based on whether they are nonfiction or fiction and hardcover or paperback.
round(28/95 * 59/94, 3)
## [1] 0.185
round(72/95 * 28/94, 3)
## [1] 0.226
round(72/95 * 28/95, 3)
## [1] 0.223
Ans: One book difference will not impact the probability as much as if there were a lot less books since there are a lot of books (94 vs. 95)
2.38 Baggage fees. 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.
luggage_0 <- 0
luggage_1 <- 25
luggage_2 <- 25+35
baggage_fee <- c(luggage_0, luggage_1, luggage_2)
luggage_percent <- c(0.54, 0.34, 0.12)
luggage_rev <- baggage_fee * luggage_percent
expected_val <- sum(luggage_rev)
# sqrt((x1 - u)^2 * P(X = x1) + .... + (xk - u)^2 * P(X = xk))
baggage_sd <- sqrt((luggage_0 - expected_val)^2 * (luggage_percent[1]) + (luggage_1 - expected_val)^2 * (luggage_percent[2]) + (luggage_2 - expected_val)^2 * (luggage_percent[3]))
paste0("The Expected value is:", expected_val)
## [1] "The Expected value is:15.7"
paste0('The baggage sd value is:', round(baggage_sd,4))
## [1] "The baggage sd value is:19.9502"
expected_120 <- 120 * expected_val
variance_120 <- 120 * baggage_sd^2
variance_120
## [1] 47761.2
sd_120 <- sqrt(variance_120)
sd_120
## [1] 218.5434
round(expected_120,2)
## [1] 1884
2.44 Income and gender. 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.
Ans: The distribution is skewed to the right. The distribution is skewed probably because of the fewer people with very high salaries ($100k or more)
less_50k <- 2.2 + 4.7 + 15.8 + 18.3 + 21.2
less_50k
## [1] 62.2
females <- 0.41
femaleless_50k <- less_50k * females
femaleless_50k
## [1] 25.502
less_50k
## [1] 62.2
femaleless_50k
## [1] 25.502
Income and gender are dependent. The percentage of females who made less than 50k a year (71.8%) does not equal the % of all people who made less than 50K a year (62.2%)