library(VennDiagram)
## Loading required package: grid
## Loading required package: futile.logger
No possible outcomes have a sum of 1 from a pair of fair dice, thus
Prob(sum of 1) = 0
Outcomes that have a sum of 5: (1, 4) (2, 3) (3, 2) (4, 1)
Total number of outcomes: 36
Prob(sum of 5) = 4/36 = 1/9 = .11
Outcomes that have a sum of 12: (6, 6)
Total number of outcomes: 36
Prob(sum of 12) = 1/36 = .03
No, they are not disjoint because 4.2% fall into both categories.
grid.newpage()
draw.pairwise.venn(area1 = .146, area2 = .207, cross.area = .042, category = c("Poverty", "Foreign Language"), fill = c("light blue", "pink"), cat.pos = c(0, 0))
## (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])
# cat.pos - position of category titles, distanced from the center of circle
10.4% of Americans live below the poverty line and only speak English at home.
.165 + .042 + .104
## [1] 0.311
31.1% of Americans live below the poverty line or speak a foreign language at home.
\[ P(\textrm{above poverty and only English speaking}) = 1- P(\textrm{poverty or speak foreign language}) \]
1 - .311
## [1] 0.689
68.9% of Americans live below the poverty line or speak a foreign language at home.
If they are independent, then \[ P(\textrm{below poverty}) * P(\textrm{speaks foreign language}) = P(\textrm{below poverty & speak foreign language}) \]
.146 * .207 #prob. of below poverty multiplied by prob. of speaks foreign language
## [1] 0.030222
.042 #prob. of those fall into both category
## [1] 0.042
.146 * .207 == .042 #Are they equal?
## [1] FALSE
Since they are not equal, they are not independent of each other.
(114 + 108 - 78) / 204
## [1] 0.7058824
78 / 114
## [1] 0.6842105
19 / 54 #chosen male with brown eyes has a partner with blue eyes
## [1] 0.3518519
11 / 36 #chosen male with green eyes has a partner with blue eyes
## [1] 0.3055556
Eye colors of male respondents and their partners are independent if \[ P(\textrm{eye color of male}) * P(\textrm{eye color of female}) = P(\textrm{same color for both})\]
114/204 * 108/204
## [1] 0.2958478
78/204
## [1] 0.3823529
114/204 * 108/204 == 78/204
## [1] FALSE
Prob. of male with blue eye multiplied by prob. of their partners with blues does NOT equal to the prob. of both partners having blue eyes. Thus, they are not independent.
(28/95) * (59/94)
## [1] 0.1849944
2 cases:
- draw a hardcover fiction book first (prob. = 13/95), then a hardcover book second (prob. = 27/94), without replacement
- draw a paperback fiction book first (prob. = 59/95), then a hardcover book second (prob. = 28/94), without replacement
Sum the probabilities of these 2 cases
(13/95) * (27/94) + (59/95) * (28/94)
## [1] 0.2243001
(72/95) * (28/95)
## [1] 0.2233795
The answers are similar because the sample space is large; drawing 1 book out of 95 books doesn’t effect the probability of drawing next book much.
mean <- 0*.54 + 25*.34 + (25+35)*.12 #average revenue
sd <- sqrt(0^2*.54 + 25^2*.34 + 60^2*.12) #standard deviation
paste("Average revenue per passenger is $", mean)
## [1] "Average revenue per passenger is $ 15.7"
paste("Standard deviation is $", round(sd, 2))
## [1] "Standard deviation is $ 25.39"
Assume that 120 passengers are independent,
then the mean of this flight = 120 * individual mean
the variance of this flight = 120 * individual variance
paste("For a flight of 120 passengers we expect $", 120 * mean)
## [1] "For a flight of 120 passengers we expect $ 1884"
paste("with standard deviation $", round(sqrt(120 * sd^2), 2))
## [1] "with standard deviation $ 278.1"
income_gender <- data.frame(Income = c("1-9,999 or loss", "10,000-14,999", "15,000-24,999", "25,000-34,999", "35,000-49,999", "50,000-64,999", "65,000-74,999", "75,000-99,999", "100,000 or more"), Total = c(.022, .047, .158, .183, .212, .139, .058, .084, .097))
bp <- barplot(income_gender$Total)
axis(1, at = bp, labels = income_gender$Income)
Personal income distribution is unimodal and symmetric centered at 35,000-49,999.
.02 + .047 + .158 + .183 + .212
## [1] 0.62
.62 * .41
## [1] 0.2542
Assuming 59% males and 41% females distributed evenly across all income levels, the percentage of female making less than $50,000 per year is 25.42%.
71.8% is a big difference from 25.42% I obtained from part (c), therefore the assumption that male and female proportions are distributed evenly across all income levels is not valid.