Below are the solutions to these exercises on probability.

#################### # # # Exercise 1 # # # #################### #1-You can use a binomial distribution. If we knew the average number of failure instead of a failure rate, we would have use the Poisson distribution. #2- Since there's a 1% failure rate each engine have a 99% chance to work correctly. To put it another way: dbinom(1, size=1, prob=.99)

## [1] 0.99

#3- dbinom(10, size=10, prob=.99)

## [1] 0.9043821

#4- pbinom(3, size=10, prob=.01)

## [1] 0.999998

#or dbinom(0, size=10, prob=.01)+dbinom(1, size=10, prob=.01)+dbinom(2, size=10, prob=.01)+dbinom(3, size=10, prob=.01)

## [1] 0.999998

#5- mean(rbinom(10000,10,0.01))

## [1] 0.1008

#################### # # # Exercise 2 # # # #################### data.ex.2<-read.csv("https://www.r-exercises.com/wp-content/uploads/2017/07/data.ex_.10.csv") library(boot) mean.boot<-function(data,indices) { return(mean(data[indices,])) } bot.results<-boot(data.ex.10,mean.boot,R=10000) bot.results$t<-sort(bot.results$t) quantile(bot.results$t,c(0.05,0.95))

## 5% 95% ## 6.969617 7.531576

#################### # # # Exercise 3 # # # #################### #1 dpois(4,lambda=(1-.9979)*1000)

## [1] 0.09923104

#2 dpois(6,lambda=(1-.9979)*1000)+dpois(7,lambda=(1-.9979)*1000)

## [1] 0.01896305

#3 dpois(0,lambda=(1-.9979)*1000)+dpois(1,lambda=(1-.9979)*1000)+dpois(2,lambda=(1-.9979)*1000)+dpois(3,lambda=(1-.9979)*1000)

## [1] 0.8386428

#4 1-ppois(10,lambda=(1-.9979)*3000)

## [1] 0.05627951

#################### # # # Exercise 4 # # # #################### dnbinom(3,1,0.05)

## [1] 0.04286875

pnbinom(2,1,0.05)

## [1] 0.142625

#################### # # # Exercise 5 # # # #################### #1 data.ex.4<-matrix(1,710,1) data.ex.4<-rbind(data.ex.4,matrix(0,290,1)) #2 proportion<-0 for(i in 1:1000) { data.sample<-sample(data.ex.4, size=1000, replace = TRUE) proportion<-c(proportion,sum(data.sample)/length(data.sample)) } proportion<-proportion[2:length(proportion)] proportion<-sort(proportion,decreasing = TRUE) proportion[0.95*1000]

## [1] 0.688

#3 (sum(proportion[which(proportion<0.7)])/length(proportion))*100

## [1] 15.2803

#Since more than 15% of the bootstrapped proportion is less than 70%, the critic value fixed by the start-up, we can say that there's a good chance that the real proportion of people knowing the product is less than 70%. As consequence, they should continue to promote their product. #################### # # # Exercise 6 # # # #################### #1 candidate.1<-matrix(rnorm(200,mean=5,sd=sqrt(35)),ncol=1) candidate.2<-matrix(rnorm(200,mean=5.5,sd=sqrt(25)),ncol=1) #2 bot.results<-boot(candidate.1,mean.boot,R=10000) bot.results$t<-sort(bot.results$t) quantile(bot.results$t,c(0.025,0.975))

## 2.5% 97.5% ## 3.817205 5.518557

bot.results<-boot(candidate.2,mean.boot,R=10000) bot.results$t<-sort(bot.results$t) quantile(bot.results$t,c(0.025,0.975))

## 2.5% 97.5% ## 4.755086 6.187075

#3 #The mean values from the exercise are estimations made from two samples. Each confidence interval we compute by bootstrapping has about a 95% chance to contain the real average time that each candidate takes to do their work. Since those intervals overlap, the two real average times could be the same. As consequence, we cannot conclude that the real average time are different or that a candidate is really faster than the other. #################### # # # Exercise 7 # # # #################### pexp(35000,rate=1/60000,lower.tail = FALSE)

## [1] 0.5580351

#Nope. #################### # # # Exercise 8 # # # #################### pnorm(1415, mean=998+202*2,sd=sqrt(5.2^2+2.25))-pnorm(1385, mean=998+202*2,sd=sqrt(5.2^2+2.25))

## [1] 0.991007

#################### # # # Exercise 9 # # # #################### data.ex.8<-read.csv("https://www.r-exercises.com/wp-content/uploads/2017/07/data.ex_.8.csv") mean(data.ex.8[,1])

## [1] 55.6

mean(data.ex.8[,2])

## [1] 54.02

mean(data.ex.8[,3])

## [1] 53.54

var(data.ex.8[,1])

## [1] 16.045

var(data.ex.8[,2])

## [1] 7.807

var(data.ex.8[,3])

## [1] 11.993

quantile(data.ex.8[,1])

## 0% 25% 50% 75% 100% ## 52.2 53.3 53.5 57.0 62.0

quantile(data.ex.8[,3])

## 0% 25% 50% 75% 100% ## 49.8 50.9 52.7 56.8 57.5

quantile(data.ex.8[,3])

## 0% 25% 50% 75% 100% ## 49.8 50.9 52.7 56.8 57.5

max(data.ex.8[,1])-min(data.ex.8[,1])

## [1] 9.8

max(data.ex.8[,2])-min(data.ex.8[,2])

## [1] 7.5

max(data.ex.8[,3])-min(data.ex.8[,3])

## [1] 7.7

#################### # # # Exercise 10 # # # #################### (pt(3,6)-pt(1,6))*100

## [1] 16.59547

paul_8326 says

The answer to the 3rd question of the 5th Exericise is completely wrong. The length of the subset vector is less than the length of the original proportion vector. Furthermore, adding the proportions would siffice for finding the average proportion. but since we’re interested in the proportion of proportions of customer awarness of the product that is less than 70%, the answer is:

mean(proportion < 0.7)