Chapter 2 - Probability Graded: 2.6, 2.8, 2.20, 2.30, 2.38, 2.44
library('VennDiagram')
2.6 If you roll a pair of fair dice, what is the probability of
getting a sum of 1?
s={}
P(s)=0
getting a sum of 5?
s={(1,4),(4,1),(2,3),(3,2)}
p(s)=4/36 = 1/8
getting a sum of 12?
s={(6,6)}
p(s)=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.59
pr_poor<-14.6/100 # %Americans live below the poverty line
pr_poor
[1] 0.146
pr_ESL<-20.7/100 # %speak a language other than English
pr_ESL
[1] 0.207
pr_poorESL<-4.2/100 # %fall into both categories
pr_poorESL
[1] 0.042
Are living below the poverty line and speaking a foreign language at home disjoint?
No.
Draw a Venn diagram summarizing the variables and their associated probabilities.
venn.plot <- draw.pairwise.venn(area1 = pr_poor,area2 = pr_ESL,cross.area = pr_poorESL,category = c("% Poor", "% ESL"),fill = c("light blue", "pink"));
grid.draw(venn.plot);
Ans<-pr_poor-pr_poorESL
Ans
[1] 0.104
Ans<-pr_poor+pr_ESL-pr_poorESL
Ans
## [1] 0.311
Ans<-1-(pr_poor+pr_ESL-pr_poorESL)
Ans
[1] 0.689
Ans<-pr_poor-pr_poorESL
Ans
[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.
## | Blue | Brown | Green | Total |
---|---|---|---|---|
Blue | 78 | 23 | 13 | 114 |
Brown | 19 | 23 | 12 | 54 |
Green | 11 | 9 | 16 | 36 |
Total | 108 | 55 | 41 | 204 |
ans<-108/204
ans
[1] 0.5294118
ans<-78/204
ans
[1] 0.3823529
ans<-19/204
ans
[1] 0.09313725
What about the probability of a randomly chosen male respondent with green eyes having a partner with blue eyes?
ans<-11/204
ans
[1] 0.05392157
Does it appear that the eye colors of male respondents and their partners are independent? Explain your reasoning.
No. Eye color of two male and female variable are joined together, female's eye color is depent on male's.
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.
## | Hardcover | Paperback | Total |
---|---|---|---|
Fiction | 13 | 59 | 72 |
Nonfiction | 15 | 8 | 23 |
Total | 28 | 67 | 95 |
ans<-(28/95)*(59/94)
ans
[1] 0.1849944
ans<-(72/95)*(28/94)+(72/95)*(27/94)
ans
[1] 0.443449
ans<-(72/95)*(28/95)+(72/95)*(27/95)
ans
[1] 0.4387812
The final answers to parts (b) and (c) are very similar. Explain why this is the case.
The difference is part b withou replacement and part c with replacement.With replacement, the probability of second object is picked also base on the complete data set.
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.
avg<-25*0.34+(35+25)*0.12
avg
[1] 15.7
var_x<-(0-avg)^2*0.54+0.34*(25-avg)^2+0.12*(35+25-avg)^2
standard_dev<-sqrt(var_x)
standard_dev
[1] 19.95019
#E(120x)=120*E(x)
E<-120*avg
E
[1] 1884
standard_dev<-sqrt(0.54*(0-E)^2+0.34*(25*120-E)^2+0.12*(60*120-E)^2) #35+25=60 for people who has tow pieces.
standard_dev
[1] 2394.023
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% |
Describe the distribution of total personal income.
The distribution is nearly normal, and mean is very closed to median.
What is the probability that a randomly chosen US resident makes less than $50,000 per year?
ans<-0.022+0.047+0.158+0.183+0.212
ans
[1] 0.622
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.
undefine
We don't know the female or male 's saraly distribution. If data distribution is skew, the general probability can not represent one of female/male distribution.
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.
#My assumption in c is correct. The femail's saraly is left skew.
ans<-0.718*0.41
ans
## [1] 0.29438