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
belowPL <- 14.6/100
foreignL <- 20.7/100
PL_foreignL <- 4.2/100
(a) Are living below the poverty line and speaking a foreign language at home disjoint?
No, living below the poverty line and speaking a foreign language at home cannot be disjoint, because both of them are in proverty line
(b) Draw a Venn diagram summarizing the variables and their associated probabilities.
library('VennDiagram')
## Loading required package: grid
## Loading required package: futile.logger
grid.newpage()
draw.pairwise.venn(belowPL, foreignL, PL_foreignL, category = c("Poor", "English Speaking"), lty = rep("blank",2), fill = c("light green", "orange"), alpha = rep(0.5, 2), cat.pos = c(0,0), cat.dist = rep(0.025, 2), scaled = FALSE)
(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])
(c) What percent of Americans live below the poverty line and only speak English at home?
both_Poverty_English<-belowPL-PL_foreignL
both_Poverty_English
[1] 0.104
(d) What percent of Americans live below the poverty line or speak a foreign language at home?
FL_home<-belowPL+foreignL-PL_foreignL
FL_home
[1] 0.311
(e) What percent of Americans live above the poverty line and only speak English at home?
English_home<- 1-FL_home
English_home
[1] 0.689
(f) Is the event that someone lives below the poverty line independent of the event that the person speaks a foreign language at home?
Independent_Lang<-belowPL-PL_foreignL
Independent_Lang
[1] 0.104
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.
Color <- c("Blue","Brown","Green", "Total")
Blue <- c(78,19,11,108)
Brown <- c(23,23,9,55)
Green <- c(13,12,16,41)
Total <- c(114,54,36,204)
library("knitr")
library("kableExtra")
Partner <- data.frame(Color,Blue,Brown,Green,Total)
kable(Partner) %>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive"))
| Color | Blue | Brown | Green | Total |
|---|---|---|---|---|
| Blue | 78 | 23 | 13 | 114 |
| Brown | 19 | 23 | 12 | 54 |
| Green | 11 | 9 | 16 | 36 |
| Total | 108 | 55 | 41 | 204 |
(a) What is the probability that a randomly chosen male respondent or his partner has blue eyes?
male_blue<-108/204
male_blue
[1] 0.5294118
(b) What is the probability that a randomly chosen male respondent with blue eyes has a partner with blue eyes?
male_blue_partner<-78/204
male_blue_partner
[1] 0.3823529
(c) 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?
male_brown_eyes<-19/204
male_brown_eyes
[1] 0.09313725
male_green_eyes<-11/204
male_green_eyes
[1] 0.05392157
(d) Does it appear that the eye colors of male respondents and their partners are independent? Explain your reasoning.
Eye colors of male respondents and their partners are NOT independent
2.30 Books on a bookshelf
BookType <- c("Fiction","Nonfiction","Total")
Hardcover <- c(13,15,28)
Paperback <- c(59,8,67)
Total <- c(72,23,95)
books <- data.frame(BookType,Hardcover,Paperback,Total)
kable(books) %>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive"))
| BookType | Hardcover | Paperback | Total |
|---|---|---|---|
| Fiction | 13 | 59 | 72 |
| Nonfiction | 15 | 8 | 23 |
| Total | 28 | 67 | 95 |
(a) Find the probability of drawing a hardcover book first then a paperback fiction book second when drawing without replacement.
a230 <- (28/95) * (67/94) * 100
a230
[1] 21.00784
(b) Determine the probability of drawing a fiction book first and then a hardcover book second,when drawing without replacement.
b230 <- (72/95) * (28/94) * 100
b230
[1] 22.57559
(c) 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.
c230 <- (72/95) * (28/95) * 100
c230
[1] 22.33795 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.
(a) Build a probability model, compute the average revenue per passenger, and compute the corresponding standard deviation.
baggage <- c(0,1,2)
fee <- c(0,25,35+25)
percent <- c(.54, .34, .12)
baggage_fee <- data.frame(baggage, fee, percent, feepercent= fee*percent)
kable(baggage_fee) %>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive"))
| baggage | fee | percent | feepercent |
|---|---|---|---|
| 0 | 0 | 0.54 | 0.0 |
| 1 | 25 | 0.34 | 8.5 |
| 2 | 60 | 0.12 | 7.2 |
#average revenue per passenger
revenue <- sum(baggage_fee$feepercent)
revenue
[1] 15.7
#variance calculation
variance <- ((fee - revenue)^2) * percent
var_value <- sum(variance)
var_value
[1] 398.01
#standard deviation
sd <- round(sqrt(var_value),2)
sd
[1] 19.95
(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.
revenue_120 <- 120*revenue
revenue_120
[1] 1884
#variance
variance120 <- (120 * sd^2)
variance120
[1] 47760.3
#standard deviation
sd <- round(sqrt(variance120),2)
sd
[1] 218.54
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
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")
total <- c(2.2,4.7,15.8,18.3,21.2,13.9,5.8,8.4,9.7)
income_total <- data.frame(income, total)
kable(income_total) %>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive"))
| income | total |
|---|---|
| $1 to $9,999 | 2.2 |
| $10,000 to $14,999 | 4.7 |
| $15,000 to $24,999 | 15.8 |
| $25,000 to $34,999 | 18.3 |
| $35,000 to $49,999 | 21.2 |
| $50,000 to $64,999 | 13.9 |
| $65,000 to $74,999 | 5.8 |
| $75,000 to $99,999 | 8.4 |
| $100,000 or more | 9.7 |
(a) Describe the distribution of total personal income.
barplot(income_total$total,
main="Unimodal Distribution",
xlab="Income",
ylab="Total",
border="red",
col="blue",
density=5
)
summary(income_total)
income total
$1 to $9,999 :1 Min. : 2.20
$10,000 to $14,999:1 1st Qu.: 5.80
$100,000 or more :1 Median : 9.70
$15,000 to $24,999:1 Mean :11.11
$25,000 to $34,999:1 3rd Qu.:15.80
$35,000 to $49,999:1 Max. :21.20
(Other) :3
(b) What is the probability that a randomly chosen US resident makes less than $50,000 per year?
Picked the first 5 rows which is having less than $50,000 per year
ds<-sum(head(income_total,5)$total)
ds
[1] 62.2
(c) 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.
Based on the sample data is comprised of 59% males and 41% females
female41percent <- (sum(head(income_total,5)$total)/ sum(total)) * (41/100)
female41percent
[1] 0.25502
(d) The same data source indicates that 71.8% of females make less than $50,000 per year. Use this value to determine whether or not the assumption you made in part (c) is valid.
ds<-(71.8/100) * (41/100)
ds
[1] 0.29438