###P(1) =0
###P(5)= P({1,4},{4,1},{3,2},{2,3})
4/36
## [1] 0.1111111
###P(12) = P({6,6})
1/36
## [1] 0.02777778
###Not disjoint since P(AB) is not 0.
PA <- 0.146 #P( A = Americans live below the Poverty line )
PB <- 0.207 #P( B = speak a language other than English )
PAB <- 0.042 # P( AB )
library('VennDiagram')
## Loading required package: grid
## Loading required package: futile.logger
venn.plot <- draw.pairwise.venn(area1 = PA,area2 = PB,cross.area = PAB,category = c("% of Americans live below the Poverty line", "% of speak a language other than English"),fill = c("blue", "yellow"));
grid.draw(venn.plot);
###P(A) - p(B)
14.6/100 -4.2/100
## [1] 0.104
###P(A) + P(B) - P(AB)
14.6/100 + 20.7 - 4.2/100
## [1] 20.804
###1- ( P(A) + P(B) - P(AB) )
1-(14.6/100 + 20.7/100 - 4.2/100)
## [1] 0.689
###P(A) - P(AB)
14.6/100 -4.2/100
## [1] 0.104
108/204
## [1] 0.5294118
78/204
## [1] 0.3823529
19/204
## [1] 0.09313725
11/204
## [1] 0.05392157
###No, because there are some males respondent with a color eyes have their partner with another color eyes.
(28/95) *(59/94)
## [1] 0.1849944
72/95 * 28/94 + 72/95 * 27/94
## [1] 0.443449
72/95 * 28/95 + 72/95 * 27/95
## [1] 0.4387812
###The difference is the total number changed at the second drawing - the total in without replacement method less one than that can be placed back.
p0 <- 0.54 # % of passengers have no checked luggage
p1 <- 0.34 # % of passengers have one checked luggage
p2 <- 0.12 # % of passengers have two checked luggages
m0 <- 0 # no charge
m1 <- 25 # money charge for one bag
m2 <- 25+35 # money charge for two bags: first bag $25 and second bag $35
avg <- p0*m0 + p1*m1 +p2*m2 # average revenue per passenger
avg
## [1] 15.7
sd <- sqrt(p0*(m0-avg)^2+p1*(m1-avg)^2 +p2*(m2-avg)^2) # standard deviation of the revenue
sd
## [1] 19.95019
n <- 120 # number of passenger in a flight
avgF <- n*avg # average revenue per flight
avgF
## [1] 1884
sdF <- sqrt((n*p0*(m0-avg))^2+(n*p1*(m1-avg))^2+(n*p2*(m2-avg))^2) # standard deviation of the revenue
sdF
## [1] 1259.34
income <- c("$1 to $9,999 or loss","$10,000 to 14,999","$15,000 to 24,999","$25,000 to 34,999","$30,000 to 49,999","$50,000 to 64,999","$65,000 to 74,999","$75,000 to 99,999","$100,000 or more" )
percent <- c(0.02,0.047,0.158,0.183,0.212,0.139,0.058,0.084,0.097)
df <- data.frame(income,percent)
names(df) <-c("income","total")
df
## income total
## 1 $1 to $9,999 or loss 0.020
## 2 $10,000 to 14,999 0.047
## 3 $15,000 to 24,999 0.158
## 4 $25,000 to 34,999 0.183
## 5 $30,000 to 49,999 0.212
## 6 $50,000 to 64,999 0.139
## 7 $65,000 to 74,999 0.058
## 8 $75,000 to 99,999 0.084
## 9 $100,000 or more 0.097
summary(df)
## income total
## $1 to $9,999 or loss:1 Min. :0.0200
## $10,000 to 14,999 :1 1st Qu.:0.0580
## $100,000 or more :1 Median :0.0970
## $15,000 to 24,999 :1 Mean :0.1109
## $25,000 to 34,999 :1 3rd Qu.:0.1580
## $30,000 to 49,999 :1 Max. :0.2120
## (Other) :3
barplot(percent, xlab="ranges of income")
###P(<$50,000) assume the sample data is unbiased
0.02+0.047+0.158+0.183+0.212
## [1] 0.62
###P(<$50,000 Females) assume the sample data is unbiased and female's income distribution matches the sample income distribution
(0.02+0.047+0.158+0.183+0.212) * 0.41
## [1] 0.2542
###Since 71.8% of females, who make less than $50,000 per year, is more than the assumption 62.2%, female's income distribution isn't matches the sample income distribution.