Dice rolls. (3.6, p. 92) If you roll a pair of fair dice, what is the probability of
ANSWER: There are 36 possible outcomes from rolling a pair of dice.
b)There are 4 possible outcomes of getting a sum of 5: (1,4), (4,1), (2,3), (3,2). So the probability is 4/36.
4/36
## [1] 0.1111111
1/36
## [1] 0.02777778
Poverty and language. (3.8, p. 93) 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: The sets are not disjoint and in fact overlap with 4.2% falling in both categories.
library(VennDiagram)
## Loading required package: grid
## Loading required package: futile.logger
grid.newpage() # Move to new plotting page
draw.pairwise.venn(area1 = 20.7, # Create pairwise venn diagram
area2 = 14.6,
cross.area = 4.2)
## (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])
#x<-list(A=1:146, B=105:311)
#ggVennDiagram(x, label=count)
ANSWER: 10.4%
ANSWER: (10.4+4.2+16.5)/100
(10.4+4.2+16.5)/100
## [1] 0.311
ANSWER: (100-10.4-4.2-16.5)/100
(100-10.4-4.2-16.5)/100
## [1] 0.689
P(<pov)andP(foreign)=4.2%
vs Indep - P(<pov)P(foreign)=.145.207
.145*.207
## [1] 0.030015
#not equal to
.042
## [1] 0.042
#So not independent
Assortative mating. (3.18, p. 111) 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.
(114+108-78)/204
## [1] 0.7058824
78/204
## [1] 0.3823529
19/204
## [1] 0.09313725
What about the probability of a randomly chosen male respondent with green eyes having a partner with blue eyes?
11/204
## [1] 0.05392157
#If independent the following three probabilities would be equal:
#P(Fblue|Mblue)=78/114
78/114
## [1] 0.6842105
#P(Fblue|Mgreen)=11/36
11/36
## [1] 0.3055556
#P(Fblue|Mbrown)=19/54
19/54
## [1] 0.3518519
#not 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.
ANSWER: (28/95)*(59/94)
(28/95)*(59/94)
## [1] 0.1849944
ANSWER: (72/95)*(28/94)
(72/95)*(28/94)
## [1] 0.2257559
ANSWER: (72/95)*(28/95)
(72/95)*(28/95)
## [1] 0.2233795
ANSWER: Sampling from a larger population has less of an impact whether with or without replacement. Notice the denominator in the second fraction changes by 1.
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.
luggage<-data.frame(Event=c('No luggage','One piece','Two pieces'),
X=c(0,25,60), pX=c(.54,.34,.12))
luggage$XpX<-luggage$X*luggage$pX
names(luggage)
## [1] "Event" "X" "pX" "XpX"
lug2<-luggage$pX
names(lug2)<-c("0","1","2")
barplot(lug2, main='Probability of carrying # of luggage')
ANSWER: Average revenue per passenger is Expected Value, and Standard deviaton computed
# Expected Value
m1<-sum(luggage$XpX)
m1
## [1] 15.7
#Variance Calculation
v1<-(m1-luggage$XpX)^2
v2<-sum(v1)
sd<-sqrt(v2)
sd
## [1] 19.25045
#Revenue for 120 passgeners
R<-m1*120
R
## [1] 1884
#Var for 120 passengers
#Var(X1+X2+X3+ X120)
#Var(X1)+Var(X2)+ Var(X3)+....=120(Var(X))
V<-120*v2
V
## [1] 44469.6
#Standard deviation for 120 passengers
sd2<-sqrt(V)
sd2
## [1] 210.8782
ANSWER: In calculating the variance, its was assumed that each passenger is independent of each other. This may not be true, for example a family of 4 travelling by share bags and are not independent of each other.
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.
income<-data.frame(Event=c('$1 to $9,999 or loss','$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'),p=c(.022,.047,.158,.183,.212,.139,.058,.084,.097))
income
incomep<-income$p
names(incomep)<-income$Event
barplot(incomep, main='Probability distribution of personal income')
ANSWER: SEE PLOT - not symmetric, possible bimodal
.212+.183+.158+.047+.022
## [1] 0.622
#If income and gender are independent then....
.622*.41
## [1] 0.25502
#However, it is important to note that gender and income are typically not independent.
#Given P(<50|F)=.718
#In part C, it was assumed that gender and income were independent, subject to the calculation:
.622*.41
## [1] 0.25502
#.78 does not equal .255
#SO NOT INDEPENDENT