This is an R Markdown format used for publishing markdown documents to GitHub. When you click the Knit button all R code chunks are run and a markdown file (.md) suitable for publishing to GitHub is generated.
Dice rolls. (3.6, p. 92) If you roll a pair of fair dice, what is the probability of (a) getting a sum of 1? (b) getting a sum of 5? (c) getting a sum of 12?
- 0/12
- 4/12
- 2/12
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, they are not disjointed because they do have elements in common.
## Warning: package 'VennDiagram' was built under R version 4.0.3
## Loading required package: grid
## Loading required package: futile.logger
## Warning: package 'futile.logger' was built under R version 4.0.3
grid.newpage()
draw.pairwise.venn(area1 = 14.6,
area2 = 20.7,
cross.area = 4.2,
fill = c("pink", "green"))
## (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])
What percent of Americans live below the poverty line and only speak English at home? > All Americans living below the poverty line either speak or don’t speak english at home; 14.6% live below the poverty line, and 4.2% percent don’t speak english at home. Therefore, 14.6-4.2 = 10.4% of those below the poverty line are english speakers.
What percent of Americans live below the poverty line or speak a foreign language at home? > Prob(pov OR eng) = Prob(pov) + Prob(eng) - P(BOTH) = 14.6 + 20.7 - 4.2 = 31.1
What percent of Americans live above the poverty line and only speak English at home? > Percent = 100 - prob(pov OR eng) = 100 - 31.1 = 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? > Prob(pov | eng) = prob(pov AND eng) / P(eng) = (4.2 / 20.7) = 20.3%
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.
What is the probability that a randomly chosen male respondent or his partner has blue eyes? > Looking at the table, we can determine there is a 78/204 = 28.24% a randomly chosen participant/partner has blue eyes.
What is the probability that a randomly chosen male respondent with blue eyes has a partner with blue eyes? > 78/108 = 72.22%
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? > 19/108 = 17.59%; 11/108 = 10. 19%
Does it appear that the eye colors of male respondents and their partners are independent? Explain your reasoning. > There does seem to be a correlation of affinity for males choosing partners with the same eye color. Therefore, this does not appear to be independent.
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.
Type/Format | Hardcover | Paperback | Total |
---|---|---|---|
Fiction | 13 | 59 | 72 |
Nonfiction | 15 | 8 | 23 |
Total | 28 | 67 | 95 |
Find the probability of drawing a hardcover book first then a paperback fiction book second when drawing without replacement. > Books are not replaced: prob(hrd) = 28/95; prob(ppbfic) = 59/94 (28/95) * (59/94) = 18.84%
Determine the probability of drawing a fiction book first and then a hardcover book second, when drawing without replacement. > Books are not replaced: prob(fic1st) = (72/95); prob(hrdcov) = (28/94) (72/95) * (28/94) = 22.58%
Calculate 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))= 22.34%
The final answers to parts (b) and (c) are very similar. Explain why this is the case. > Due to the law of large numbers, the sample is large enough where a difference of 1 is 0.0024 or, 0.24% less than the initial answer.
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.
### Build a probability model, compute the average revenue per passenger, and compute the corresponding standard deviation.
bags <- c(0, 1, 2)
fee <- c(0, 25, 35)
prob <- c(0.54, 0.34, 0.12)
baggage_fee <- data.frame(bags, fee, prob)
baggage_fee
## bags fee prob
## 1 0 0 0.54
## 2 1 25 0.34
## 3 2 35 0.12
average <- sum((baggage_fee$prob*baggage_fee$fee)) / sum(baggage_fee$prob)
std <- sqrt(0.54*(0-average)^2 + 0.34*(25-average)^2 + 0.12*(35-average)^2)
### (b) About how much revenue should the airline expect for a flight of 120 passengers? With what standard deviation? Note any assumptions you make and if you think they are justified.
expected_value <- (65*0 + 41*25 + 14*35)
expected_value
## [1] 1515
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. > The data follows a somewhat normal distribution, but in incremental groups of at least 2.
What is the probability that a randomly chosen US resident makes less than $50,000 per year? > 62.2%
What is the probability that a randomly chosen US resident makes less than $50,000 per year and is female? Note any assumptions you make. > 25.502%
## [1] 62.2
## [1] 25.502
### Problem 4 data distribution
df <- data.frame(
j <- 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"),
k <- c(2.2,4.7,15.8,18.3,21.2,13.9,5.8,8.4,9.7)
)
barplot(df$k, names.arg=j)