Data 606 Homework 2 2.6, 2.8, 2.20, 2.30, 2.38, 2.44
2.6 Dice rolls. If you roll a pair of fair dice, what is the probability of
Answer: Zero. Minimum number with the pair of dice is 2
Answer: Combinations are (1,4), (2,3), (3,2), (4,1). So probability of getting a sum of 5 is 4/36 = 1/9
Answer: Combination is (6,6).So probability of getting a sum of 12 is 1/36
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.
Answer: No because there are 4.2% fall into both living below the proverty line and speaking a foreign language.
Answer:
library(venneuler)
## Loading required package: rJava
Venn <- venneuler(c(Poor=146, Foreign=207,"Poor&Foreign"=42))
Venn$labels <- c("Poor\n14.6","Foreign\n20.7")
plot(Venn)
Answer:
14.6-4.2
## [1] 10.4
Answer:
14.6+20.7-4.2
## [1] 31.1
Answer:
100-(14.6+20.7-4.2)
## [1] 68.9
Answer: The event that someone lives below the poverty line is not independent of the event that the person speaks a foreign language at home.
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. Partner (female) Blue Brown Green Total Blue 78 23 13 114 Self (male) Brown 19 23 12 54 Green 11 9 16 36 Total 108 55 41 204
Answer:
(114+19+11)/204
## [1] 0.7058824
Answer:
(78/114)
## [1] 0.6842105
Answer:
(19/54)
## [1] 0.3518519
What about the probability of a randomly chosen male respondent with green eyes having a partner with blue eyes?
Answer:
(11/36)
## [1] 0.3055556
Answer: The eye colors of male respondents and their partners are NOT independent.
P(blue male | blue female) = P(blue male) * P(blue female) (78/204) = (114/204) * (108/204). Since these are not equal The eye colors of male respondents and their partners are NOT independent
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. Format Hardcover Paperback Total Type Fiction 13 59 72 Nonfiction 15 8 23 Total 28 67 95
Answer:
(28/95) * (59/94)
## [1] 0.1849944
Answer:
(72/95) * (28/94)
## [1] 0.2257559
Answer:
(72/95) * (28/95)
## [1] 0.2233795
Answer:The final answers to parts (b) and (c) are very similar because the possible events are considerable large so the outcome will not be affected by much.
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.
Answer:
bag_piece <- c(0, 1, 2)
bag0 <- 0
bag1 <- 25
bag2 <- bag1 + 10
bag_fee <- c(bag0, bag1, bag2)
bag_percent <- c(0.54, 0.34, 0.12)
bag_revenue_per_person <- sum(bag_fee * bag_percent)
bag_revenue_per_person
## [1] 12.7
variance <- (25^2*.34 + 35^2*.12) - 12.7^2
variance
## [1] 198.21
standart_deviation <- sqrt(variance)
standart_deviation
## [1] 14.07871
Revenue per person is $12.7, Variance is 198.21 and the standard deviation is 14.07871
Answer:
revenue_120 <- 12.7 * 120
revenue_120
## [1] 1524
standart_deviation_120 <- sqrt(variance * 120)
standart_deviation_120
## [1] 154.2245
The expected revenue for the 120 passengers is $1524. The standard deviation will be $154.2245
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 Total $1 to $9,999 or loss 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%
Answer:
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)
distribution <- data.frame(income, total)
distribution
## income total
## 1 $1 to $9,999 2.2
## 2 $10,000 to $14,999 4.7
## 3 $15,000 to $24,999 15.8
## 4 $25,000 to $34,999 18.3
## 5 $35,000 to $49,999 21.2
## 6 $50,000 to $64,999 13.9
## 7 $65,000 to $74,999 5.8
## 8 $75,000 to $99,999 8.4
## 9 $100,000 or more 9.7
barplot(distribution$total, names.arg=income)
This looks like normal continuous distribution.
Answer:
sum(distribution[1:5,2]/100)
## [1] 0.622
Answer:
The sample has 41% females
0.622 * 0.41
## [1] 0.25502
The probability that a randomly chosen US resident makes less than $50,000 per year and is female is 0.25502
Assumption: The probability of an income of less than $50,000 and being female are independent events.
Answer: If 71.8% of females make less than $50,000 per year the the equation will be 0.718 = 0.622 * 0.41, which is not correct, so we can conclude that the assumption we made for step (c) is wrong. Withe the equation it looks like events are not independent.