Problem 3

You were told that the amount of time elapsed between consecutive trades on a foreign stock exchange market followed a normal distribution with a mean of 15 seconds. You were also told that the probability that the time elapsed between two consecutive trades to fall between 16 to 17 seconds was 13%. The probability that the time elapsed between two consecutive trades would fall below 13 seconds was 7%.

Problem 3.a

#####a. What is the probability that the time elapsed between two consecutive trades will be longer than 17 seconds?

knitr::opts_chunk$set(echo = TRUE)
#Given mean = 15
mu <- 15
Xval <- 13
p_left_tail <- 0.07
Z_left_tail <- qnorm (p_left_tail)

#Now Z = (X-mu)/sd
#sdev= (X - mu)/Z
sdev <- (Xval - mu)/Z_left_tail
prob_less_17 <- pnorm(17,mean=mu, sd=sdev)
prob_longer_17 <- 1- prob_less_17
cat( "probability that elapsed time is longer than 17 is ", prob_longer_17)
## probability that elapsed time is longer than 17 is  0.07
#

Problem 3.b

######b. What is the probability that the time elapsed between two consecutive trades will be between 13 and 14 seconds?

knitr::opts_chunk$set(echo = TRUE)
prob_less_13 <- pnorm(13, mean= mu, sd=sdev)
prob_less_14 <- pnorm (14, mean=mu, sd=sdev)
prob_13_14 <- prob_less_14 - prob_less_13
cat( "probability that elapsed time is between 13 and 14 seconds is ", prob_13_14)
## probability that elapsed time is between 13 and 14 seconds is  0.160289

Problem 3.c

#####c. What is the probability that the time elapsed between two consecutive trades will be between 15 and 16 seconds?

knitr::opts_chunk$set(echo = TRUE)
prob_less_15 <- pnorm(15, mean= mu, sd=sdev)
prob_less_16 <- pnorm (16, mean=mu, sd=sdev)
prob_15_16 <- prob_less_16 - prob_less_15
cat( "probability that elapsed time is between 15 and 16 seconds is ", prob_15_16)
## probability that elapsed time is between 15 and 16 seconds is  0.269711

Problem 3.d

d. The probability is 80% that the time elapsed will be longer than how many seconds?
seconds_80_prob <- qnorm (0.8, mean=mu, sd=sdev)
cat ("80% of the time the elapsed time between two trades will be: ", seconds_80_prob)
## 80% of the time the elapsed time between two trades will be:  16.14057