Graded: 2.6, 2.8, 2.20, 2.30, 2.38, 2.44
If you roll a pair of fair dice, what is the probability of:
There is no probability of getting a sum of 1 due to the lowest number on a pair of fair dice is 2.
# (2,3),(1,4), (3,2),(4,1)
(4/36)*100
## [1] 11.11111
#(6,6)
(1/36)*100
## [1] 2.777778
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 that English at home, and 4.2% fall into both categories.
library(VennDiagram)
## Loading required package: grid
## Loading required package: futile.logger
grid.newpage()
draw.pairwise.venn(area1 = 14.6, area2 = 20.7, cross.area = 4.2,
category = c("Below Poverty Line", "Speak Foreign Language"),
lty = rep("blank", 2), fill = c("yellow", "lightpink"),
alpha = rep(0.5, 2), cat.pos = c(0, 0), cat.dist = rep(0.025, 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])
(14.6+20.7)- 4.2
## [1] 31.1
100-31.1
## [1] 68.9
Poverty probability is 14.6%. Foreign speakers probability is 20.3%.
20.3%-14.6% = 5.7% which is relatevely large difference.
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.
library(knitr)
Male <- c("Blue", "Brown", "Green")
Blue <- c(78, 19, 11)
Brown <- c(23,23,9)
Green <- c(13,12,16)
df = data.frame(Blue, Brown, Green, row.names = Male) # Do not incldue Male yet:
df$Totals <- apply(df, 1, sum)
df["Total" ,] <- colSums(df)
kable(df)
| Blue | Brown | Green | Totals | |
|---|---|---|---|---|
| Blue | 78 | 23 | 13 | 114 |
| Brown | 19 | 23 | 12 | 54 |
| Green | 11 | 9 | 16 | 36 |
| Total | 108 | 55 | 41 | 204 |
(114+19+11)/204
## [1] 0.7058824
P(female=blue|male=blue) = 78/114 = 0.68
#P(female=blue|male=blue)
78/114
## [1] 0.6842105
#P(female=blue|male=brown)
19/54
## [1] 0.3518519
#P(female=blue|male=green)
11/36
## [1] 0.3055556
Does it appear that the eye colors of male respondents and their partners are independent? Explain your reasoning.
P(female=Blue|male=Brown) =19/54 = 0.35.
P(female=Blue) = 108/204 = 0.53.
P(female=Blue|male=Brown) not equal P(female=Blue) - the eye colors of male respondents and their partners are dependent.
(28/95) * (59/94)
## [1] 0.1849944
(72/95) * (28/94)
## [1] 0.2257559
(72/95) * (28/95)
## [1] 0.2233795
If we will take one book out of 95 books it will not make a huge difference, therefor the final answers are very similar.
BAGS <- c(0,1,2)
COST <- c(0,25,60)
PERCENT <- c(.54, .34, .12)
baggagefees <- data.frame(BAGS, COST, PERCENT)
baggagefees
## BAGS COST PERCENT
## 1 0 0 0.54
## 2 1 25 0.34
## 3 2 60 0.12
#compute the average revenue per passenger
Avg<-sum(COST*PERCENT)
Avg
## [1] 15.7
Average revenue per passenger is $15.7.
#compute the corresponding standard deviation
var <- ((COST - Avg)^2) * PERCENT
totalvar <- sum(var)
totalvar
## [1] 398.01
std <- round(sqrt(totalvar),2)
std
## [1] 19.95
Standard Deviation is 19.95.
# Expected revenue for a flight
revenue <-(Avg*120)
revenue
## [1] 1884
This sample is comprised of 59% males and 41% females
Assume the distribution of male and female remained similar across the income levels.
The assumption made in part (c) is not valid.
If 71.8% of females make lesser than $50k the distribution of male and female does not remained similar across the income levels.